在 Ubuntu 16.04.4 LTS(在 Azure 上)上安装 certbot 失败,并显示“您持有损坏的软件包”。

在 Ubuntu 16.04.4 LTS(在 Azure 上)上安装 certbot 失败,并显示“您持有损坏的软件包”。

按照此处的说明进行操作https://certbot.eff.org/lets-encrypt/ubuntuxenial-nginx我尝试运行这个命令:

sudo apt-get install python-certbot-nginx 

但我收到以下错误:

~$sudo apt-get install python-certbot-nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python-certbot-nginx : Depends: python3-certbot-nginx but it is not going to be installed
E: Unable to correct problems, you have held broken packages.

尝试安装 python3-certbot-nginx 会显示更多详细信息:

~$ sudo apt-get install python3-certbot-nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 python3-certbot-nginx : Depends: certbot (>= 0.25.0~) but it is not going to be installed
                         Depends: python3-acme but it is not going to be installed
                         Depends: python3-certbot but it is not going to be installed
                         Depends: python3-mock but it is not installable
                         Depends: python3-pyparsing (>= 1.5.5) but it is not installable
E: Unable to correct problems, you have held broken packages.

我运行了sudo apt upgrade,升级了几个东西,但我仍然收到相同的错误。升级命令拒绝升级这三个项目:(liblxc1, lxd, lxd-client不确定为什么)

然后我尝试使用 certbot-auto 工具,似乎遇到了类似的问题:

~$ wget https://dl.eff.org/certbot-auto
~$ chmod a+x ./certbot-auto
~$ sudo ./certbot-auto --install-only
Bootstrapping dependencies for Debian-based OSes... (you can skip this with --no-bootstrap)
Hit:1 http://ppa.launchpad.net/certbot/certbot/ubuntu xenial InRelease
Hit:2 http://azure.archive.ubuntu.com/ubuntu xenial-backports InRelease
Hit:3 http://security.ubuntu.com/ubuntu xenial-security InRelease
Hit:4 https://repos.influxdata.com/ubuntu xenial InRelease
Hit:5 https://nginx.org/packages/mainline/ubuntu xenial InRelease
Reading package lists... Done
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package gcc is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  gcc-5-doc

Package libffi-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package python-virtualenv is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Package python-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  python

E: Package 'python-dev' has no installation candidate
E: Package 'python-virtualenv' has no installation candidate
E: Package 'gcc' has no installation candidate
E: Package 'libffi-dev' has no installation candidate

我不知道接下来该怎么办。您知道为什么会发生这种情况以及如何解决该问题吗?

答案1

我在 18.04 上做了什么来解决这个问题。看看你是否安装了 python 而不仅仅是 python3。

python -V

应该会给出版本号。如果没有:

sudo apt install python

然后您可以添加 python certbot。您需要添加包含它的存储库:

sudo add-apt-repository universe

然后你应该能够:

sudo apt-get install python-certbot-nginx 

您可以在这里搜索存储库: https://packages.ubuntu.com/search?keywords=python-certbot-nginx&searchon=names&suite=bionic§ion=all

相关内容