使用 cat /etc/apt/sources.list 检查 apt 源
在这一步中,你将探究系统从何处获取软件包。在上一个实验中,当你使用 sudo apt update 和 sudo apt install htop 时,apt 需要知道从哪些服务器下载软件。这些信息存储在配置文件中。
列出 apt 源的主要文件是 /etc/apt/sources.list。我们可以再次使用 cat 命令来查看其内容。
在你的终端中输入以下命令并按回车键:
cat /etc/apt/sources.list
你会看到以 deb 或 deb-src 开头的行。这些行指定了 apt 查找软件包的仓库(服务器)。
## See http://help.ubuntu.com/community/UpgradeNotes for how to upgrade to
## newer versions of the distribution.
deb http://archive.ubuntu.com/ubuntu/ jammy main restricted
## deb-src http://archive.ubuntu.com/ubuntu/ jammy main restricted
### Major bug fix updates produced after the final release of the
### distribution.
deb http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
## deb-src http://archive.ubuntu.com/ubuntu/ jammy-updates main restricted
### N.B. software from this repository is ENTIRELY UNSUPPORTED by the Ubuntu
### team. Also, please note that software in universe WILL NOT receive any
### review or updates from Canonical except for security updates. The
### responsibility for security updates from this repository rests entirely
### with the community.
deb http://archive.ubuntu.com/ubuntu/ jammy universe
## deb-src http://archive.ubuntu.com/ubuntu/ jammy universe
... (output may vary)
每一行 deb 通常遵循以下格式:
deb [options] uri distribution [component1] [component2] [...]
deb:表示二进制软件包仓库。
uri:仓库的地址(例如,http://archive.ubuntu.com/ubuntu/)。
distribution:发行版的代号(例如,jammy)。
components:软件类别(例如,main、restricted、universe、multiverse)。
以 # 开头的行是注释,apt 会忽略这些行。
如果你需要添加第三方仓库来安装默认源中没有的软件,理解 sources.list 就很重要。
点击 继续 完成此步骤。