织梦CMS - 轻松建站从此开始!

abg欧博官网|登陆|游戏|

Contents of a default sources.list or ubuntu.sour

时间:2026-01-09 06:35来源: 作者:admin 点击: 1 次
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/sour

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.gpg

Ubuntu 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 update

You 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 update

You 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 EOF

Here 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 multiverse

The 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.list

The 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 update

A 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 partner

A 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 partner

A 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 partner

A 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 partner

A 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's user avatar

karel

123k136 gold badges307 silver badges338 bronze badges

(责任编辑:)
------分隔线----------------------------
发表评论
请自觉遵守互联网相关的政策法规,严禁发布色情、暴力、反动的言论。
评价:
表情:
用户名: 验证码:
发布者资料
查看详细资料 发送留言 加为好友 用户等级: 注册时间:2026-01-12 01:01 最后登录:2026-01-12 01:01
栏目列表
推荐内容