This post is dedicated to those new to the distribution and especially in the GNU/Linux world. Today we will talk about one of the most important files in Linux, more specifically the file sources.list. The name of this file is already quite inspiring and indicative of what it can be, little in English that we know.
The operation of a Gnu / Linux distribution is simple, we have the components of the operating system on the one hand and on the other we have a secure connection to a server where the operating system is provided with programs, packages and updates. This quality that many paranoid about security may seem like a big hole is one of the best qualities it has and that allows distributions to improve day by day.
Ubuntu It has a series of servers and a series of applications that allow us to update and secure our operating system, as well as improve our interaction and update experience. But even so, what works best, or what will always work no matter what version of the system we are in, is manually editing the sources.list file.
Table of Contents
How do I edit and enhance my sources.list file?
Editing such a file is very simple, but at the same time it is necessary to do it with administrator permissions.
We open the terminal and write:
sudo nano /etc/apt/sources.list
They will ask us for the password and, after confirming it, a nano screen will open with the text of the file. Other text editors can be chosen, but nano is widely used and works directly from the terminal. It may be that we mistyped the address above, in which case what will be shown will be a blank page, so we close without saving and write it again, but this time correctly.
The file will look like the following:
The first lines that include the word cd-rom are references to the installation cd, they always come with the words “deb cdrom:” even if it was installed over the network or a usb. From here, various lines begin to appear that start with “deb http://” or “deb-src”. The uncommented lines are those of the repositories activated, in the case of the main image (main), the software maintained by the community (universe).
Lines starting with ## (although just a hash mark should suffice) are commented lines that either have text that explains the repository that follows or are repositories that we do not want our operating system to access. In any case, when the system sees these symbols at the beginning of the line, it understands that what follows is not necessary and jumps to the next line that does not begin with this sign.
There are times when the repository is temporarily damaged or we do not want the version of a program from that repository to be installed, then the best option is to put this sign at the beginning of the repository line and we will stop having problems. Be careful, if you comment on a repository, that is, put the # at the beginning of the server address, you must also comment on the address of the sources, otherwise it will give an error.
And how do I add a repository that a friend has told me?
Well, to add a repository we just have to go to the end of the document and put the address of the repository and the address of the sources, that is, the deb and deb-src
And how do I know it is a valid repository?
All valid repository addresses have this format:
deb http://server_address/folder_name version_name (main or universe or multiverse or main restricted, etc)
This last part of the line indicates the sections of the repository: main is main, while main restricted indicates restricted software section.
The only precaution that must be taken in this file in general is that it is necessary to try to put repositories of the same version, that is, of the adjective of the animal that is the mascot of our current version of Ubuntu. Otherwise, we run the risk that when updating, our system mixes packages and versions and goes crazy reaching the state of "distribution Rattan”, which is when the system of using repositories does not work properly.
Once the repositories are set to our liking, we just have to save, close, go to the console and write:
sudo apt update && sudo apt upgrade
And so the update of the list of packages recognized by the operating system would begin.
If you have read the entire Tutorial you will see that it is simple, at least try to see the file. Worth. Greetings.
More information - How to add PPA repositories to Debian and distributions based on it,