|
In Ubuntu 24.04 and later Ubuntu software sources have been moved to /etc/apt/sources.list.d/ubuntu.sources. As a result the command cat /etc/apt/sources.list returns # Ubuntu sources have moved to /etc/apt/sources.list.d/ubuntu.sources in Ubuntu 24.04 and later. Types: deb URIs: Suites: noble noble-updates noble-backports Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpg Types: deb URIs: Suites: noble-security Components: main restricted universe multiverse Signed-By: /usr/share/keyrings/ubuntu-archive-keyring.gpgUbuntu 24.04 uses a new format for managing sources. Sources are stored in separate files within the /etc/apt/sources.list.d/ directory, each named with a .list or .sources extension (example: ondrej-ubuntu-php-noble.sources). When you add a PPA source, it usually creates a new file within this directory specific to that PPA. The PPA information goes into this new file, not the existing ubuntu.sources file. You can recreate a standard ubuntu.sources in Ubuntu 24.04 and later using a heredoc by running the following commands. sudo cp /etc/apt/sources.list.d/ubuntu.sources /etc/apt/backup.txt cat <<EOF | sudo tee /etc/apt/sources.list.d/ubuntu.sources deb $(lsb_release -cs) main restricted universe multiverse deb $(lsb_release -cs)-updates main restricted universe multiverse deb $(lsb_release -cs)-security main restricted universe multiverse deb $(lsb_release -cs)-backports main universe restricted multiverse EOF sudo apt updateYou can recreate a standard sources.list in Ubuntu 22.04 using a heredoc by running the following commands. sudo cp /etc/apt/sources.list /etc/apt/backup.txt cat <<EOF | sudo tee /etc/apt/sources.list deb $(lsb_release -cs) main restricted universe multiverse deb $(lsb_release -cs)-updates main restricted universe multiverse deb $(lsb_release -cs)-security main restricted universe multiverse deb $(lsb_release -cs)-backports main universe restricted multiverse EOF sudo apt updateYou can also write a new standard sources.list to a new backup file named BACKUP.txt in Ubuntu 22.04 without changing the existing /etc/apt/sources.list file using a heredoc like this. cat <<EOF >> ~/Desktop/BACKUP.txt deb $(lsb_release -cs) main restricted universe multiverse deb $(lsb_release -cs)-updates main restricted universe multiverse deb $(lsb_release -cs)-security main restricted universe multiverse deb $(lsb_release -cs)-backports main universe restricted multiverse EOFHere is a simple example of a standard /etc/apt/sources.list file for Ubuntu 22.04: deb jammy main restricted universe multiverse deb jammy-updates main restricted universe multiverse deb jammy-backports main restricted universe multiverse deb jammy-security main restricted universe multiverseThe partner repository has been empty since Ubuntu 20.10. The easiest way to edit the sources.list file is from the terminal in nano editor using the following command: sudo nano /etc/apt/sources.listThe instructions for using nano are always displayed at the bottom of the page. Use the keyboard combination Ctrl + O and after that press Enter to save the file to its current location. Use the keyboard combination Ctrl + X to exit nano. Make sure to run this command after changing sources.list to refresh the list of available software. sudo apt updateA standard sources.list file for Ubuntu 20.04 looks like this: deb focal main restricted universe multiverse deb focal-updates main restricted universe multiverse deb focal-backports main restricted universe multiverse deb focal-security main restricted universe multiverse deb focal partnerA standard sources.list file for Ubuntu 18.04 looks like this: deb bionic main restricted universe multiverse deb bionic-updates main restricted universe multiverse deb bionic-backports main restricted universe multiverse deb bionic-security main restricted universe multiverse deb bionic partnerA standard sources.list file for Ubuntu 16.04 looks like this: deb xenial main restricted universe multiverse deb xenial-updates main restricted universe multiverse deb xenial-backports main restricted universe multiverse deb xenial-security main restricted universe multiverse deb xenial partnerA standard sources.list file for Ubuntu 14.04 looks like this: deb trusty main restricted universe multiverse deb trusty-updates main restricted universe multiverse deb trusty-backports main restricted universe multiverse deb trusty-proposed main restricted universe multiverse deb trusty-security main restricted universe multiverse deb trusty partnerA standard sources.list file for Ubuntu 12.04 looks like this: deb precise main universe restricted multiverse deb precise-updates universe main multiverse restricted deb precise-backports universe main multiverse restricted deb precise-security universe main multiverse restricted
Share Improve this answer Follow
edited Sep 17, 2024 at 16:38
answered Apr 3, 2014 at 22:06
karel 123k136 gold badges307 silver badges338 bronze badges (责任编辑:) |

