Contrib, Non-Free, Backport Sources

To install firmware and non-free software, you need to update your apt source list to include contrib and non-free sources lists.

Edit with Sudo / Root Account

You need to use your sudo or root account to edit the source list using your favorite editor. For me, I with vim (the vi):

sudo account:

$ sudo vi /etc/apt/source.list

root account:

$ su
$ type in your password:
$ vi /etc/apt/source.list 

Add Contrib and Non-Free tags

You should see something like (the link may changed depending on your installation):

deb http://deb.debian.org/debian stretch main
deb-src http://deb.debian.org/debian stretch main

deb http://deb.debian.org/debian-security/ stretch/updates main
deb-src http://deb.debian.org/debian-security/ stretch/updates main

deb http://deb.debian.org/debian stretch-updates main
deb-src http://deb.debian.org/debian stretch-updates main

Add the tags, so it looks something like this:

deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free

deb http://deb.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ stretch/updates main contrib non-free

deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free

Add Backport Entries

Now that you have non-free and contrib sources, it's time to add backport. By now, your source.list should look something like this:

deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free

deb http://deb.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ stretch/updates main contrib non-free

deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free


Duplicate the main sources and the replace the "stretch" with "stretch-backports" to link them:

deb http://deb.debian.org/debian stretch main contrib non-free
deb-src http://deb.debian.org/debian stretch main contrib non-free

deb http://deb.debian.org/debian stretch-backports main contrib non-free
deb-src http://deb.debian.org/debian stretch-backports main contrib non-free

deb http://deb.debian.org/debian-security/ stretch/updates main contrib non-free
deb-src http://deb.debian.org/debian-security/ stretch/updates main contrib non-free

deb http://deb.debian.org/debian stretch-updates main contrib non-free
deb-src http://deb.debian.org/debian stretch-updates main contrib non-free


Save the file.

Update and Upgrade Again

With the new list available, perform another update again:

$ sudo apt update -y && sudo apt upgrade -y

You're done setting up all the sources lists. You can now install non-free packages like firmware and semi-free software inside contrib listing.