LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Blogs > hydrurga
User Name
Password

Notices


Rate this Entry

Manage your software sources in Debian, Ubuntu and Mint

Posted 05-23-2019 at 07:36 AM by hydrurga
Updated 05-23-2019 at 11:15 AM by hydrurga

Introduction
The following information concentrates on the latest long-term versions of Debian, Ubuntu and Mint, namely Debian 9 (Stretch), Ubuntu 18.04 (Bionic) and Mint 19.x (Tara, Tessa, Tina, ...), but should be applicable, with modifications, to any Debian-derived distro.

Note that the instructions don't cover the addition or deletion of repositories to/from your software sources. It is intended rather as a diagnostic tool when apt update is generating errors that appear to relate to an incorrect software source setup.

A distro's software sources consist of files that specify the location of the repositories that it will use to obtain its packages. The distro usually keeps its main software sources in /etc/apt/sources.list while other software sources (third-party software etc.) are kept in .list files in the /etc/apt/sources.list.d directory. Mint differs in that its main software sources are kept in /etc/apt/sources.list.d/official-package-repositories.list.

One practice that is important is to not mix distro versions in your software sources. This can lead to what Debian users, for example, call a FrankenDebian. This can cause significant problems in your system and may even necessitate a re-install if the situation is too far advanced. So, for example, if you're a Debian user, don't mix Stretch and Jessie or Sid; if you're an Ubuntu user, don't mix Bionic and Xenial; if you're a Mint user, don't mix tessa and Xenial.

Listing your software sources
You can obtain a list of your software sources by running

Code:
inxi -r
If you don't have the system info tool inxi installed, then it can be installed from the repositories or downloaded from here.

As an alternative, if for some reason you can't install or run inxi, use the following command:

Code:
for i in /etc/apt/sources.list{,.d/*}; do echo file: $i; cat $i; echo ====; done
Note that some lines start with deb-src rather than deb - these lines indicate where your distro will obtain the source code for packages, rather than the usual binaries. Also, any line can be commented out by placing a # at the start of the line. For example, if you don't want to download any source code at all then you can comment out all the deb-src lines. Duplicate lines will be ignored, but it best to delete these where possible.

Editing your software sources
You can modify your software sources by either editing them directly (as root) or using a GUI program available in your distro.

For example (assuming you use sudo to gain root privileges; replace gedit or xed with your favourite test editor),

Code:
(Debian/Ubuntu) sudo gedit /etc/apt/sources.list

(Mint) sudo xed /etc/apt/sources.list.d/official-package-repositories.list
In Ubuntu, you can use the Software & Updates program to edit your repositories. In Mint, you can use Software Sources. In all three distros, you can use Synaptic.

Main software sources - Debian (reference)

For Debian Stretch, /etc/apt/sources.list should look like this (miss out the contrib and non-free keywords if you don't want those repositories):

Code:
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
In addition, if you need to use the backports repository, add:

Code:
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
Main software sources - Ubuntu

In Ubuntu, /etc/apt/sources.list comes in a more cluttered form than the Debian equivalent. However, for Ubuntu 18.04 (Bionic), the key elements it contains should be the following (miss out the universe and multiverse keywords if you don't want those repositories):

Code:
deb http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic main restricted universe multiverse

deb http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-updates main restricted universe multiverse

deb http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse
deb-src http://us.archive.ubuntu.com/ubuntu/ bionic-backports main restricted universe multiverse

deb http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu bionic-security main restricted universe multiverse

deb http://archive.canonical.com/ubuntu bionic partner
deb-src http://archive.canonical.com/ubuntu bionic partner
Main software sources - Mint

For Mint, /etc/apt/sources.list.d/official-package-repositories.list should be as follows (deb-src lines have been left out for simplicity; replace tessa (Mint 19.1) with the codename of your version of Mint 19.x):

Code:
deb http://packages.linuxmint.com tessa main upstream import backport 
deb http://archive.ubuntu.com/ubuntu bionic main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-updates main restricted universe multiverse
deb http://archive.ubuntu.com/ubuntu bionic-backports main restricted universe multiverse
deb http://security.ubuntu.com/ubuntu/ bionic-security main restricted universe multiverse
deb http://archive.canonical.com/ubuntu/ bionic partner
Other software sources

Additional third-party repositories (including Ubuntu's Personal Package Archives (PPAs)) can be added to your software sources by different means. It is important to remember only to add such repositories if they apply to the version of your distro (for Mint 19.x users, you can also include Ubuntu Bionic repositories). Do not mix Debian and Ubuntu repositories. Ubuntu PPAs can cause problems if installed in Debian and doing so is not advised.

Following are some examples of third-party repositories (deb-src lines have been missed out to keep things simple):

Chrome (/etc/apt/sources.list.d/google-chrome.list)
Code:
deb [arch=amd64] http://dl.google.com/linux/chrome/deb/ stable main
Etcher (/etc/apt/sources.list.d/balena-etcher.list)
Code:
deb https://deb.etcher.io stable etcher
Git (/etc/apt/sources.list.d/git-core-ppa-bionic.list)
Code:
deb http://ppa.launchpad.net/git-core/ppa/ubuntu bionic main
Skype (/etc/apt/sources.list.d/skype-stable.list)
Code:
deb [arch=amd64] https://repo.skype.com/deb stable main
VirtualBox (/etc/apt/sources.list.d/virtualbox.org.list)
Code:
deb [arch=amd64] https://download.virtualbox.org/virtualbox/debian bionic contrib
Wine (/etc/apt/sources.list.d/additional-repositories.list )
Code:
deb https://dl.winehq.org/wine-builds/ubuntu/ bionic main
Please provide any feedback on these instructions in the comments so that they can be improved if necessary.
Posted in Uncategorized
Views 623 Comments 4
« Prev     Main     Next »
Total Comments 4

Comments

  1. Old Comment
    Nice work hydrurga!

    Not that I use either of those distros myself, but some very useful info there!

    I was actually thinking of creating a post (not a blog) about common yum problems, people mixing different versions of repo's for CentOS. Like having repo's for CentOS 6 in yum's repolist on CentOS 7 and similar.

    I was going to post a question in LQ S&F forum about if it would be a good idea to create a sticky advising people about yum's repolist, along with some common problems (chief among them mixing the wrong repo's and alike), and how to check to see what the problem could be, then how to fix it. As at least some of what you've said here could also apply to yum and such too. But I've been too lazy to ask...

    Nice work again tho!
    Posted 05-23-2019 at 08:51 AM by jsbjsb001 jsbjsb001 is offline
  2. Old Comment
    Thanks, jsbjsb001! I'd been meaning to create a couple of extra blog posts for a while but hadn't got around to it. I'm glad I did now.

    You should create that post - it could prove very useful for users of CentOS. A sticky in the CentOS distribution sub-forum sounds like a good plan!
    Posted 05-23-2019 at 11:18 AM by hydrurga hydrurga is offline
  3. Old Comment
    I wish this had been around when I was learning Debian.
    Posted 05-23-2019 at 01:05 PM by Lysander666 Lysander666 is online now
  4. Old Comment
    Better late than never.
    Posted 05-23-2019 at 06:27 PM by hydrurga hydrurga is offline
 

  



All times are GMT -5. The time now is 06:12 AM.

Main Menu
Advertisement
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration