Debian sources.list Demystified
November 16, 2008 5 Comments
I have always had a hard time trying to figure out how to configure sources.list in Debian or its derivatives, like Ubuntu. To learn this thing myself, and to give a basic introduction to all, this post is being written.
Debian uses dpkg, apt-get, aptitude, and other programs to install and maintain software packages. These applications, in turn, use the /etc/apt/sources.list file to figure out which repositories to use and where they are located. Depending on how you configure sources.list, the selection of software available to you will vary. So it is important to learn more about this critical piece of your Debian experience.
The format of sources.list file is thus:
deb uri distribution [component1] [component2] [...], and these parts are explained below. There is one source on one line, and the most important source comes first. As you add more sources on more lines, their importance decreases based on their location (from top to bottom).
You have two choices here:
deb means that you want binary packages, and
deb-src means you want source packages. Usually both are used, on their own lines, of course.
This is where you specify the location of the repository. It can be local (file:/), CD (cdrom:/), FTP, HTTP, SSH, RSH, and copy.
You have the following choices, written here in descending order of stability and ascending order of new versions of software available: stable, testing, unstable, and experimental.
Component or category has three choices: main, contrib, and non-free. These are “kinds” of packages as sorted based on the Debian philosophy: Debian Policy Manual – The Debian Archive.
deb http://ftp.us.debian.org/debian/ stable main contrib non-free
deb-src http://ftp.us.debian.org/debian/ stable main
deb http://security.debian.org/ stable/updates main contrib non-free
deb-src http://security.debian.org/ stable/updates main
This was just a basic introduction to get you started. To learn more, check out sources.list manpage; How to Have a Pleasant Installation (for Debian Newbies); use aptitude instead of synaptic and why;