尝试升级我的 Ubuntu 12.04 vps 时出现以下错误:
henrik@neung:~$ sudo apt-get upgrade
[sudo] password for henrik:
Reading package lists... Done
Building dependency tree
Reading state information... Done
You might want to run 'apt-get -f install' to correct these.
The following packages have unmet dependencies:
nginx-full : Depends: nginx-common (= 1.2.4-1ubuntu0ppa2~precise) but 1.2.4-2ubuntu0ppa1~precise is installed
E: Unmet dependencies. Try using -f.
所以我尝试运行这个:
henrik@neung:~$ sudo apt-get -f install
Reading package lists... Done
Building dependency tree
Reading state information... Done
Correcting dependencies... Done
The following extra packages will be installed:
nginx-full
The following packages will be upgraded:
nginx-full
1 upgraded, 0 newly installed, 0 to remove and 42 not upgraded.
2 not fully installed or removed.
Need to get 0 B/441 kB of archives.
After this operation, 0 B of additional disk space will be used.
Do you want to continue [Y/n]? y
dpkg: dependency problems prevent configuration of nginx-full:
nginx-full depends on nginx-common (= 1.2.4-1ubuntu0ppa2~precise); however:
Version of nginx-common on system is 1.2.4-2ubuntu0ppa1~precise.
dpkg: error processing nginx-full (--configure):
dependency problems - leaving unconfigured
dpkg: dependency problems prevent configuration of nginx:
nginx depends on nginx-full | nginx-light; however:
Package nginx-full is not configured yet.
Package nginx-light is not installed.
dpkg: error processing nginx (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
nginx-full
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
有人可以帮忙解决这个问题吗?
答案1
问题是,nginx-full
依赖于nginx-common
,这意味着nginx-full
如果没有具体版本的nginx-common
。
这里是专门针对这个问题的一道题,但解决方法非常广泛,涉及的不只是一种情况,而是不同的情况。所以我将向你展示一种简短但有效的方法。
实际上,我不知道如何安装该版本nginx-common
,但我知道你会通过以下方式解决你的问题重新安装所有包。为此,您必须在终端中输入以下命令。
sudo apt-get remove nginx* && sudo apt-get install nginx-full
答案2
我也遇到了同样的问题。我没有安装 Apache,也没有其他东西阻塞我的 80 端口。我无法使用
sudo apt-get install nginx
也不与
sudo apt-get install nginx-common nginx-full
一周后,我偶然发现了这个小博客:https://etc.banana.fish/?p=75
在这篇博客中,解决方案是:
- 安装 nginx-common:
sudo apt-get install nginx-common
listen [::]:80 default_server;
从......中去除/etc/nginx/sites-enabled/default(我使用 root 用户执行此操作)- 为了确保万无一失,我确实重新启动了服务器。
- 为了确保万无一失,我
sudo apt-get update
又这样做了sudo apt-get upgrade
。 - 现在我终于打通了电话
sudo apt-get install nginx-full
并且成功了!
之后当我输入远程服务器的 IP 时,我就可以看到 nginx 的标题屏幕!
答案3
我强烈地感觉到你sudo apt-get update
在运行之前忘记了运行sudo apt-get upgrade
——包管理器使用有关nginx-common
包版本的旧信息,而nginx-full
需要较新的版本。