Login

The Basics

Ubuntu uses apt for package management. Apt stores a list of repositories or software channels in the file

/etc/apt/sources.list

By editing this file from the command line, we can add, remove, or temporarily disable software repositories.

  • IconsPage/note.png Note: It's always a good idea to backup a configuration file like sources.list before you edit it. To do so, issue the following command:

    sudo cp /etc/apt/sources.list /etc/apt/sources.list.backup


Typically, the beginning of the file /etc/apt/sources.list looks like this:

 

# sources.list
#deb cdrom:[Ubuntu 13.10 _Saucy Salamander_ - Release i386 (20131016.1)]/ saucy main restricted

# See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
# newer versions of the distribution.
deb http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted
deb-src http://ch.archive.ubuntu.com/ubuntu/ saucy main restricted
#...

 

Explanation of the Repository Format

  • All the lines beginning with one or two hashes (#) are comments, for information only.
  • The lines without hashes are apt repository lines. Here's what they say:

    • deb: These repositories contain binaries or precompiled packages. These repositories are required for most users.

    • deb-src: These repositories contain the source code of the packages. Useful for developers. 

    • http://archive.ubuntu.com/ubuntu: The URI (Uniform Resource Identifier), in this case a location on the internet. See the official mirror list or the self-maintained mirror list to find other mirrors.

    • saucy is the release name or version of your distribution.

    • main & restricted are the section names or components. There can be several section names, separated by spaces.

 

Other Versions

  • IconsPage/note.png For other Ubuntu releases you would replace the 'saucy' with the current version you have installed ('precise', 'quantal', 'raring', 'saucy', 'trusty', ...) Type lsb_release -sc to find out your release.

 

Adding Repositories

  • sudo add-apt-repository "deb http://us.archive.ubuntu.com/ubuntu/ saucy universe multiverse"
  • sudo add-apt-repository ppa:<repository-name>

Don't forget to retrieve the updated package lists:

  • sudo apt-get update
Go to top