Thursday, 26 June 2008

Adding repositories

Ubuntu ships pre-configured to connect to the standard repositories.

A lot of extra packages are available from the "universe" and "multiverse" repositories.

You can add these by editing the file /etc/apt/sources.list (backup the original file first!)

gksu cp /etc/apt/sources.list /etc/apt/sources.list.bak
gksu gedit /etc/apt/sources.list

The sources.list file can look a bit daunting to the novice. Essentially there are four "sections" in each repository, they are;

hardy
hardy-updates
hardy-backports
hardy-security

Note: If you are using another release, replace "hardy" with the name of your release.

There are also four primary repositories;

main
restricted
universe
multiverse

The default sources.list file uses a seperate line for each repository and section. Most of the extra lines you require are already included but are commented out. You can uncomment them by removing the # from the beginning of each line that starts with "deb"

It is also possible to neaten things up by just adding all the repositories to a single set of four lines and simply removing everything else from the file (assuming you did the backup above!)

A simple sources.list using the repository at the main ubuntu site (http://archive.ubuntu.com) would be;

deb http://archive.ubuntu.com/ubuntu/ hardy main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-backports main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu/ hardy-security main restricted universe multiverse

After you have made the changes and saved the file you need to tell the system to update the repository information;

sudo apt-get update

Now you have access to a whole lotta extra software goodness!