In Debian repository packages are sorted into 3 package areas: main, contrib and non-free. By default, we can install packages only from main area. If we want to install packages from contrib, non-free areas we need to apply additional settings to our system. There is a way to do that using /etc/apt/sources.list file, but in this article we’ll use more simple way – via apt itself.
But before it, let’s talk about package areas.
What main is? Main area contains packages that satisfy “Debian Free Software Guidelines” rules. Main area contains really free software.
What contrib is? Contrib area contains free packages like main area but this packages have non-free dependencies. It may be a program which works with archives, but, for example, it needs unrar (non-free area) utility as a dependency to open .rar archives.
What non-free is? Non-free area contains non-free packages that don’t satisfy “Debian Free Software Guidelines” rules.
Add contrib and non-free components in apt
apt can open sources.list with the system’s default text editor, use the following command:
sudo apt edit-sources
We should see something like this:
deb http://ftp.uk.debian.org/debian/ buster main deb-src http://ftp.uk.debian.org/debian/ buster main deb http://security.debian.org/debian-security buster/updates main deb-src http://security.debian.org/debian-security buster/updates main
Add contrib and non-free after main:
deb http://ftp.uk.debian.org/debian/ buster main contrib non-free deb-src http://ftp.uk.debian.org/debian/ buster main contrib non-free deb http://security.debian.org/debian-security buster/updates main deb-src http://security.debian.org/debian-security buster/updates main
Don’t need to do it for security updates. Save the changes.
Update the available packages information:
sudo apt update
Now we can install contrib and non-free packages, for example, nvidia-driver:
sudo apt install nvidia-driver
What is deb and deb-src in these lines?
deb is used to get already compiled binary packages. It is used by apt install command.
deb-src is used to get a package source code. It is used by apt source command:
mkdir nano cd nano apt source nano ls ... nano-3.2 nano_3.2-2.debian.tar.xz nano_3.2-2.dsc nano_3.2.orig.tar.xz nano_3.2.orig.tar.xz.asc