Methods to Add Repository on Debian 9 Stretch

add repo debian

Debian 9 is released recently, today we will see how to configure repository in Debian 9. Debian and Debian-based distributions (like Ubuntu, Linspire, Xandros, Knoppix and Mepis etc.) use a tool called APT (Advanced Packaging Tool) to manage all software on the system. The term "package" refers to an individual file with a .deb extension that contains either all or part of an application.

APT checks the health of all the packages, dependencies of the package before installing it. APT fetch packages from the repository. Normal installation comes with default repositories configured, but these contain only a few packages out of an ocean of free software available. Following post explains how to setup additional repository on Debian to leverage benefits of other software.

The /etc/apt/sources.list file contains the details for each available software repository. An extra repository can be added by editing this file can manually or it can be modified by using a graphical manager.

1) Adding repository from Shell

All entries in the /etc/apt/sources.list file follows a format with 4 distinct regions: package type, web address (URL), distribution, and section(s). In case of Debian, Format is

"deb {respository server/mirror} {repository name} {sub branches of the repo}"

Open /etc/apt/sources.list using your favorite text editor, when you open you will see below content with default repositories configured. Add a new line at the end of the file with above format to add a repository.

pradips@debian:vi /etc/apt/sources.list
deb stretch main
deb stretch-updates main
deb stretch/updates main

2) Adding repository from GUI

a) Open synaptic package manager from application search.

synaptic manager

b) Go to Settings -> Repositories as shown below

synaptic package manager navigation to repositories

c) Go to "Other Software" tab as shown below. You will find default configured repository there.

other repositories tab for configure repositories on debian

d) Click on "Add..." button to add the repository. I am adding "deb testing main contrib non-free" repository. You need to follow format

deb {respository server/mirror} {repository name} {sub branches of the repo}
repository add dialogue box to add repostory with format


By following any of above methods you can configure an additional repository in Debian 9. Hope you have smooth experience executing above steps. Let us know in the comments section for any issue or additional things.

Leave a Comment