0

I have a question about the sources.list file in /etc/apt/sources.list Does it affect the outcome of the apt commands as illustrated below:

If you run the apt update command, will it only update all the packages from the repository indicated in sources.list? (Likewise, if you installed a package that is not part of the repository, then it will not be included in the apt update command?)

What if you do an apt install (package_name) - but the package that you want to install is not part of the repository indicated in sources.list, it will "never be able to find" the package from the internet?

I am wondering if sources.list constrains or limits the packages that you can find and interact with the use of the apt commands.

Also if the above were true - then to be able to download and install packages from another disto, then you would need to strictly edit the sources.list file and add the repository from the other distro?

1 Answer 1

3

Think of the /etc/apt/sources.list file as a master list of packages your apt always tries to synchronize with. apt doesn't magically fetch packages from random places from the internet, so

it only update all the packages from the repository indicated in sources.list

is correct.

it will "never be able to find" the package from the internet?

again, correct.

I am wondering if sources.list constrains or limits the packages that you can find and interact with the use of the apt commands.

again, correct.

Also if the above were true - then to be able to download and install packages from another disto, then you would need to strictly edit the sources.list file and add the repository from the other distro?

Normally people do not add repositories from other distros because distros slightly differ in too many ways and by adding other ditros sources you may break everything.

In certain cases you can download a deb package from the internet (e.g. from another distro) and install it this way:

sudo apt install ./package.deb

If you use Ubuntu, this distro has thousands of repositories called PPAs: they offer packages which are not officially bundled by Ubuntu. PPAs are popular but they can also wreak havoc to your system.

1
  • 1
    Typically you would add additional repositories in individual files in /etc/apt/sources.list.d/ rather than edit /etc/apt/sources.list. The main advantage of doing so is that it is easier to automate adding and deleting a file compared to editing part of a file.
    – icarus
    Commented Sep 7, 2020 at 2:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .