APT is a free and open source package management system used by many popular Linux distributions, such as Debian and Ubuntu. APT provides an easy way to install, update, and remove packages for your server. By default, APT includes repositories for your installation CD and the default online distribution repositories. If you want access to third-party repositories, you need to add them manually.
In Debian you can easily add APT repositories by editing the sources.list file. You can usually find this file on most Debian-based distributions at /etc/apt/sources.list. In it, you will see “deb” lines for each repository. These lines always follow the same format:
- package type
- web address
For example, an APT line may look like this:
deb http://www.serverschool.com/apt/fakerepository debian unstable
To add a repository to the file, you will need to get the correct APT line from the third-party provider. In most cases, it must match your distribution and version in order for apt-get to actually install packages from it. There are exceptions, however, for general repositories that support multiple operating systems.
Add the deb line to the bottom of the file, save the file, and exit your text editor. Most repositories also have authentication keys that you should install. Use the following commands to retrieve and install the key:
# gpg –keyserver [name of keyserver] –recv-keys [keyhash]
# gpg –export –armor [keyhash] | apt-key add –
Finally, to complete the process, you must update APT to add the new repository data to your system’s cache.
# apt-get update
You should then be able to download and install new packages from your third-party repository.