IconsPage/terminal.png This page describes how to manage software repositories from the command line. (GUI tools are also available: Managing Repositories in Ubuntu or Kubuntu).

IconsPage/important.png If you are using a minimal install or server install you will need to be familiar with a terminal based text editor like nano. If you are using a GUI install you can use Nano or GEdit.

The Basics

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

/etc/apt/sources.list

and in any file with the suffix .list under the directory

/etc/apt/sources.list.d/

See man sources.list for more about this storage mechanism.

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


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

Other Versions

Adding Repositories

Adding the Universe and Multiverse Repositories

Additional software repositories such as Universe and Multiverse can be enabled by uncommenting the corresponding apt lines (i.e. delete the '#' at the beginning of the line). For Universe, uncomment those lines:

There are four similar lines for 'multiverse'.

OR you may use the add-apt-repository command. If your release is 'saucy':

IconsPage/note.png Depending on your location, you should replace 'us.' by another country code, referring to a mirror server in your region. Check sources.list to see what is used!

Type lsb_release -sc to find out your release. You may repeat the commands with "deb-src" instead of "deb" in order to install the source files.

Don't forget to retrieve the updated package lists:

Adding Partner Repositories

You can add the partner repositories by uncommenting the following lines in your /etc/apt/sources.list file:

Then update as before:

Adding Other Repositories

There are some reasons for which you might want to add non-Ubuntu repositories to your list of software sources. Caution: To avoid trouble with your sytem, only add repositories that are trustworthy and that are known to work on Ubuntu systems!


Adding Launchpad PPA Repositories

Adding Launchpad PPA (Personal Package Archive) is possible conveniently via the command: add-apt-repository. This command is similar to "addrepo" on Debian.

Enabling Repositories with a (non-interactive) Script

IconsPage/note.png This section seemed obsolete due to the add-apt-repository command, thus it has been removed.

Suggestions & Recommendations

Further Reading


CategoryCommandLine CategoryPackageManagement

Repositories/CommandLine (last edited 2015-07-27 15:42:33 by 2580DCEA)