了解 Ubuntu 上的 /etc/apt/sources.list

use*_*468 1 ubuntu apt

注意:我对 Ubuntu 很陌生(我是 CentOs 人)

我试图安装到 openssh-server 但我得到了:

root@5b4ca6d66450:/home# apt-get install openssh-server
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package openssh-server
Run Code Online (Sandbox Code Playgroud)

现在,当我检查我的 /etc/apt/sources.list 时,我得到:

root@5b4ca6d66450:/home# cat /etc/apt/sources.list
deb http://deb.debian.org/debian jessie main
deb http://deb.debian.org/debian jessie-updates main
deb http://security.debian.org jessie/updates main
Run Code Online (Sandbox Code Playgroud)

我接下来添加以下行 - 但我仍然得到相同的结果

deb http://deb.debian.org/debian jessie contrib
Run Code Online (Sandbox Code Playgroud)

有什么明显的我做错了吗?

小智 7

source.list 文件没有任何问题,但您可能需要apt-get update在能够运行安装命令之前更新本地包数据库,因为 apt-get install 不会自动执行。

(顺便说一下,您使用的是 Debian,而不是 Ubuntu,尽管它对此没有任何改变)。