How to add a new Debian repository

Debian and derivated linux distros (Ubuntu, Linux mint) use APT to manage software and software locations. It is so easy that you can install everything with a simple command like :

apt-get install “something”

Where “something” can be a an app that you know about or it can be something that you don’t remember, and just use TAB to see what suggestions there are. When you can’t install a certain app (that you know for sure it can be installed) you typically see this error:

E: Unable to locate package “something” 

When i get that i usually google for the app that i want and find out in which repository i can get it from. A recent case was with Ettercap. Since i’m using Debian, i searched Debians official website and found the Ettercap package page. Next i’ve added the location (link) of the repository in a file that APT stores its repository links (/etc/apt/sources.list). You can do that in 2 ways – adding the link from the command line or editing.

echo “deb http://ftp.dk.debian.org/debian/ squeeze main contrib non-free” >> /etc/apt/sources.list

Or edit the file with nano, where you paste the above link wherever you want in the file. Note that you must be root to do this and you should also change the “dk” in the link with the appropriate country prefix (e.g. if you’re from Italy, that prefix should be “it”).

nano /etc/apt/sources.list

The last step is to make APT check it’s new repository for new software.

apt-get update