The Ubuntu Repository and sources.list

sources.list

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.

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.

[WATCH OUT] The wrong editing or deletion of the information can make the operating system unstable and even make it inoperative. A good means of security is to open the file with a text editor, copy the information and paste it into another file. So much ubunlog like me we are not responsible for what may happen, although there are many copies of the Ubuntu sources.list.

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:

nano editor with sources.list

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,


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

3 comments, leave yours

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.

  1.   Alberto said

    Thank you very much for the information

  2.   Pep said

    Thanks, Merci, Tanke, Thanks, Forced….

  3.   José Luis said

    Hi, I'm new to this, but I'm going for everything, I don't want anything else to learn.
    I tell you, when I get to where canonical…. well, I'm going step by step… .System Configuration - Software and Updates - Other software - I point to Canonical Partners (2) Independent (1) - Add, and here I copy and paste the line that appears above as an example to paste it where I it asks APT, Add source, and Refresh or something very similar, and in the end it tells me that it fails due to the connection, when I have a connection ... and I got into the sources.list with nano, and took a screenshot just in case, and there appear several lines in which they end in main, and as if telling me that there is something wrong ... and I ... well no idea, sorry. Can you help me? I think I have 16.04 and I would like to update the libreoffice at least, I don't know how to do it. Thanks for your answer. All the best