January 7, 2018 · Code Snippet

Debian 9 Stable ("stretch") Repository Configuration

This post is based on one of my Gists in GitHub. Normally, when you install Debian Stable from DVD or USB, it defaults all package installs from installation media. This is not desirable when we have a fast internet connection and we don't want to be limited by the package selection available in the installation media.

With this snippet, we also enable backports and non-free packages to be installed in our new Debian system.

First, we need to edit /etc/apt/sources.list from console:

sudo nano /etc/apt/sources.list

Inside nano text editor, remove all file contents and replace them with this:

# Official Debian Repos (US Mirrors) #
deb http://ftp.us.debian.org/debian/ stretch main contrib non-free
deb http://ftp.us.debian.org/debian/ stretch-updates main contrib non-free

# Debian Security Updates #
deb http://security.debian.org/ stretch/updates main contrib non-free

# Debian Backports #
deb http://ftp.debian.org/debian stretch-backports main

USEFUL ADVICE: You can copy and paste in GNU/Linux terminal with CTRL+SHIFT+C and CTRL+SHIFT+V respectively.

You can replace the US mirror URLs with some local mirrors, here's some mirrors by country:

Chile:
http://debian.redlibre.cl/debian/
http://debian.netlinux.cl/debian/
http://debian.utalca.cl/debian/
http://mirrors.tecnoera.com/debian/

Argentina:
http://mirrors.dcarsat.com.ar/debian/

Mexico:
http://mmc.geofisica.unam.mx/debian/

Spain:
http://debian.redimadrid.es/debian/

United States:
https://mirrors.wikimedia.org/debian/

You can get the full Debian Repo Mirror List on https://www.debian.org/mirror/list

Save the file with CTRL+O and close it with CTRL+X.

Now run the following command to load your new repo list:

sudo apt-get update

I hope this can help someone!

Cheers!