Today's article is about your sources list.
It's really important to have the sources list correct so that your Linux distro can receive the updates it needs. Think of it as a way to keep the old stuff out and bring the new stuff in.
The sources list is located in /etc/apt/sources.list on a Debian system.
If you just want to take a look at your sources list you can use the cat command as I did in the screenshot above. The sources list is located in the same place on a Devuan (based on Debian without systemd) too.
The sources list contains exact url's from the Debian repositories/mirrors. A repository is a place where files, data and other information is stored in an organized fashion. A trusted source for security updates is essential these days.
You can add to your sources.list to pull in other packages or remove entries as well.
To edit your sources.list you can use nano or vim.
Above is a screenshot of my sources list on my Debian 12 Stable installation.
To edit your sources.list you can use nano or vim. There are other text editors you can use, however; I'm covering the basic's on how to use nano and vim at this time.
So let's say you wanted to add a backport Debian repository to your sources.list. using nano.
Using the command-line you would type:
sudo nano /etc/apt/sources.list
Then, press the Enter key. You're sources.list will open in the editor and you'll be able to navigate with your arrow keys to move to any string you wish. Definition of string: (long line of words that include the url to the backport)
Carefully copy the exact url you want to add and paste it into the editor.
Keeping a empty line in between the mirrors is a good idea.
When done, hold down the CTRL key and the letter o (the o key next to the p key) key at the same time. Press the Enter key once to save and then the editor will exit and take you back to the command-line prompt. To check your entry use the cat command as mentioned above to ensure your entry is correct.
The screenshot above reflects where the sources list is located on this Debian system.
Vim can be a little tricky if you haven't used it before.
To use vim you have to type the letter 'i' to put the editor in insert mode. To save changes and other operations, you'll have to press the ESC key to get out of insert mode and into command mode.
If you'd like to use the vim editor you would type:
sudo vim /etc/apt/sources.list
Using vim is a little different. To save the changes you have done in vim you have to press the ESC key to get out of insert mode. Then type:
:wq
That's a colon followed by a lower case w and a lower case q. Then press Enter. Vim exit's and Bob is your uncle.
Back-ports are the most recent packages from Debian Testing and some are unstable in a few cases. So, having said that:
Pulling in what you 'only need' is recommended. I wouldn't have it any other way really. My top reason for that is simply because the latest and greatest isn't always the best.
Here's a few links to help you get well educated with the sources list, the Debian backports WiKi and the sources list in general.
As always, drive your Linux safe and have a great week ahead!
Alex
Comments