Using Software Repositories
A Software Repository is basically a database of application installation packages and upgrade packages available for your Linux distro.
When you install Linux, your Software Centre will come pre-configured with a default Repository. Normally, this is perfectly acceptable, but there are times when the applications you need are not listed in this repository and it becomes necessary to add additional Repositories to access the additional functionality.
In this chapter, we will look at how to add and remove a Repository in the various different flavours of Linux. In general, Distros rely on a Package Manager - and this is normally one of two: apt (-for Ubuntu/Debian based distros) or yum (-for Fedora based distros).
Repositories in Fedora are managed via .repo files. These are simply text files (-one per repository) that sit under the directory:
/etc/yum.repos.d/
There is one file per repository, with a filename conforming to the following standard:
<repository name>.repo
Normally, once you locate the Repository that you want, it is simply a matter of downloading the .repo file and saving it under the /etc/yum.repos.d/ directory. The yum command should then pick up the new Repository.
Like Fedora, Repositories in Ubuntu are managed via files. In this case it is by editing a single file:
/etc/apt/sources.list
Note: before you make any changes to this file, always make a backup copy first!
The file comes supplied with all the common Ubuntu Repositories : it is just that the majority are commented out! To enable a particular Repository, all you need to do is to uncomment them, by removing the initial hash (#) character on the line.
Let's look at an example:
- From the Command Line, make a backup of the file - e.g.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.sav
- Edit the file using your favourite editor - e.g.
sudo vi /etc/apt/sources.list
- Remove the initial hash from the line for the desired repository. For example, change:
#deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe
to deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe
- Save your changes:
:wq
If the Repository is not listed in the file, it is normally just a matter of cutting and pasting a line from the Repository website into the /etc/apt/sources.list and saving this.
A Repository can be removed in Fedora by simply deleting it's .repo file under the directory:
/etc/yum.repos.d/
However, this is normally a bit drastic - and irreversible - so the recommended way is normally just to disable them by doing the following:
A Repository can be removed in Ubuntu by simply commenting out it's definition in the /etc/apt/sources.list - for example:
- From the Command Line, make a backup of the file - e.g.
sudo cp /etc/apt/sources.list /etc/apt/sources.list.sav
- Edit the file using your favourite editor - e.g.
sudo vi /etc/apt/sources.list
- Add an initial hash from the line for the desired repository. For example, change:
deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe
to #deb http://us.archive.ubuntu.com/ubuntu/ oneiric universe
- Save your changes:
:wq
The best way to locate a suitable Repository (-and to see what it contains) is to search for candidates with a Search Engine using a string such as:
software repository <Linux Distro Name>
The following pages, located with the above search criteria, also list some of the available Repositories currently available: