将Debian 9(Stretch)后端口添加到我的sources.list中

5

我正在尝试使用Certbot来保护网站的安全,但是遇到了关于"stretch-backports"的问题。 这是Certbot要求我输入的代码行,但我收到了一个错误提示,说"stretch-backports"不是可用资源的一部分。

$ sudo apt-get install certbot -t stretch-backports

因此,我尝试使用以下代码行添加后备存储库:

deb http://ftp.debian.org/debian stretch-backports main

但是“deb”未被识别。因此,我安装了类似的gdebi:

sudo apt-get install gdebi

安装完成后,我稍微修改了之前的那行代码并再次尝试:
gdebi http://ftp.debian.org/debian stretch-backports main

现在显示“gdebi错误,文件未找到:http://http.debian.net/debian”。

我的问题有两个,如果我之前的步骤没有出错,是否有人拥有可用于stretch-backports的功能地址,并且gdebi是deb的良好替代品吗?

提前感谢您。

3个回答

2
引用官方后端文档,以下是翻译内容:

For jessie add this line

deb http://ftp.debian.org/debian jessie-backports main

to your sources.list (or add a new file with the ".list" extension to /etc/apt/sources.list.d/) You can also find a list of other mirrors at https://www.debian.org/mirror/list

For stretch add this line

deb http://ftp.debian.org/debian stretch-backports main

to your sources.list (or add a new file with the ".list" extension to /etc/apt/sources.list.d/) You can also find a list of other mirrors at https://www.debian.org/mirror/list

现在这些指示看起来非常清晰(而不是“相当模糊”),你应该编辑一个文件,而不是运行deb命令。 (可能“你的sources.list”可以更改为“你的/etc/apt/sources.list”)

谢谢你的意见!但我们必须同意不同,我看了那份文档,对于一些官方的东西,我并没有觉得很清晰,我仍然坚持这个看法!我承认我的回答也不是很好,但多亏了你的介入,现在可以更好了! - Outjacked

1

你也可以通过 echo 命令将密钥追加到 sources.list 文件中。

sudo echo "deb http://deb.debian.org/debian stretch-backports main" | tee -a /etc/apt/sources.list

我的完整安装脚本如下(全部以root或sudo身份运行)

echo "deb http://deb.debian.org/debian stretch-backports main" | tee -a /etc/apt/sources.list
apt-get update
apt-get install certbot python-certbot-apache -t stretch-backports

2
对于管道版本,"sudo" 需要在 "tee -a" 调用中,而不是在 "echo" 中。 - ncoghlan

0

好的,我弄清楚了这个工作原理,并且想回答一下,因为我觉得我找到的文档非常模糊,所以这是如何将Debian 9 stretch-backports添加到您的sources.list文件中:

  • 手动并使用管理员权限,导航到 /etc/apt/sources.list 然后创建你的 stretch-backport.list 文件,然后使用 nano 进入它,在我的情况下我添加了整个行:

    deb http://ftp.debian.org/debian stretch-backports main
    

转换成这个

 sudo nano /etc/apt/sources.list.d/stretch-backports.list

就是这么简单,我随后可以使用以下代码行而没有任何错误:

sudo apt-get install certbot -t stretch-backports

就是这样!希望我表达清楚了。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接