Modify the List of Package Repositories




Modify the List of Package Repositories

Add extra Ubuntu software repositories to your system to gain access to thousands of new pieces of packaged software.

If you are used to installing programs on operating systems other than Linux, the idea of package managers and repositories might seem a bit foreign. To install a program on Windows or Mac OS X, you would insert a CD or download an installer from the Internet and run it. Under Ubuntu, software comes in packages. Packages are the different groups of files that make up a particular piece of software, along with the instructions Ubuntu needs to install and remove the software, dependency information, and so on. With packages, Ubuntu lets you install and update all of your software using a single tool. Whether you use Synaptic [Hack #55], Adept [Hack #56], or apt-get [Hack #54], your package manager will automatically download and install packages you specify along with any other packages (dependencies) they might require.

Instead of being randomly scattered on project pages around the Internet, Ubuntu packages reside in software repositories, which are centralized sites that contain a large number of packages. Each software repository contains a certain class of software that is generally intended for a particular release of Ubuntu, usually in both source and binary form (these are divided into their own repositories) and then further subdivided by what sort of support or software license the package has. Here are some of the main package repositories available for Ubuntu:


dapper

This is the main repository for the Dapper Drake release of Ubuntu. Prior releases of Ubuntu also have repositories named after their release names, so there are Breezy, Hoary, Warty, etc. repositories. When Ubuntu releases a new version, it will also create a repository named after its release name. This method makes it easy to ensure that packages intended for a particular Ubuntu release don't get mixed up with other versions.


dapper-updates

This repository contains updates for a particular release, so you'll generally want to be subscribed to this repository (and you are by default).


dapper-security

Ubuntu uses this repository to separate out security updates that have been applied to a particular package. These updates are often backported to a particular version of software that ships with a release, so you aren't required to update to the latest version of a piece of software to get the security fix.


dapper-backports

This repository is disabled by default, but it contains updated versions of software that has been backported to work with Dapper. This repository is disabled by default because these backports do not undergo the level of testing that other packages do. It has been made available since it might be handy to have a newer version of software with new features.

These repositories are further subdivided into categories based on what level of support a package has and, in some cases, what sorts of licenses or restrictions the software has. If you, for instance, want only software that is fully supported by Ubuntu, you can ensure that by choosing only the main subcategory. Here are the primary subcategories:


main

The primary package category is called main (also referred to as Officially Supported) and contains all of the default Ubuntu packages that have been tested to such a level that they are officially supported by the distribution. As such, this category is enabled by default.


restricted

This category contains packages that are restricted due to copyright or possibly other aspects of their licenses such that they are considered nonfree. This repository exists so that users who want to use only "free" open source software can disable this category and pull software only from main.


universe

Ubuntu is based on the Debian Linux distribution but contains only a subset of Debian's software due to the amount of testing required to support each package. universe is a subcategory that contains software that the community has packaged and supports for Ubuntu. If you are looking for a particular piece of software and can't seem to find it, there's a good chance that it is in universe or the next subcategory, multiverse. Note that since these packages are not officially supported by Ubuntu, there's a chance that you risk some instability by installing software from this category.


multiverse

Like universe, the multiverse category contains software that is not officially supported but is maintained by the Ubuntu community. multiverse is to universe as restricted is to main. Here you will find contributed or nonfree packages that are not officially supported by Ubuntu.

Add and Remove Repositories

There are a few different ways to change the repositories you subscribe to, based on what tools you use for package management. "Manage Packages with Synaptic" [Hack #55] and "Manage Packages with Adept" [Hack #56] cover managing package repositories with those tools. Still, all of these package managers reference the same /etc/apt/sources.list file. Here is a sample sources.list file for Dapper that illustrates the syntax:

# dapper
deb http://archive.ubuntu.com/ubuntu/ dapper main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ dapper main restricted

# dapper-updates
deb http://us.archive.ubuntu.com/ubuntu/ dapper-updates main restricted
deb-src http://us.archive.ubuntu.com/ubuntu/ dapper-updates main restricted

# dapper-security
deb http://security.ubuntu.com/ubuntu dapper-security main restricted
deb-src http://security.ubuntu.com/ubuntu dapper-security main restricted

Knowing how Ubuntu separates repositories into categories, you can see how the syntax of these lines works. The first section of a line specifies whether Ubuntu is going to pull binary packages (deb) or source packages (deb-src) for a particular repository. The next section of the line contains the URL for the particular repository, which is usually either HTTP or FTP. Next, the particular repository is listed (in this example, dapper, dapper-updates, or dapper-security). Finally, you see a space-delimited list of subcategories to pull from. By default, Ubuntu will use main and restricted subcategories, but to add new subcategories, just add their names at the end of a particular line. So, for instance, to add universe and multiverse to the Dapper repository for both binary and source packages, change:

deb http://archive.ubuntu.com/ubuntu/ dapper main restricted
deb-src http://archive.ubuntu.com/ubuntu/ dapper main restricted

to:

deb http://archive.ubuntu.com/ubuntu/ dapper main restricted universe 
multiverse deb-src http://archive.ubuntu.com/ubuntu/ dapper main restricted universe
multiverse

Once you save your changes, you will need to update your package list to use the new repositories either via apt-get update or through the Synaptic or Adept interface. To add new subcategories to other repositories, simply make the appropriate changes to their repository entries.

Unofficial Repositories

There are a number of other unofficial package repositories on the Internet that you can also use with Ubuntu. Often these repositories provide a small subset of special packages that Ubuntu doesn't package by default, or perhaps provide a newer version of a package. These repositories generally will tell you the particular line to add to your sources.list, but be sure that the repository is designed to work with your particular Ubuntu release, or you may face compatibility conflicts between dependencies in the third-party repository and Ubuntu's native packages.