我需要将 nginx 从 1.10.1 降级到 1.4.6。但是我遇到了问题。请查看以下列表:
root@FServer:~# nginx -v
nginx version: nginx/1.10.1
root@FServer:~# apt-cache policy nginx
nginx:
Installed: 1:1.10.1-8.5.0.29~trusty1
Candidate: 1:1.10.1-8.5.0.29~trusty1
Version table:
*** 1.10.1-0+trusty0 0
500 http://ppa.launchpad.net/nginx/stable/ubuntu/ trusty/main amd64 Packages
1.4.6-1ubuntu3.5 0
500 http://mirrors.digitalocean.com/ubuntu/ trusty-updates/main amd64 Packages
500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
root@FServer:~# apt-get remove --auto-remove nginx
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages will be REMOVED:
nginx
0 upgraded, 0 newly installed, 1 to remove and 388 not upgraded.
After this operation, 55.3 kB disk space will be freed.
Do you want to continue? [Y/n] Y
(Reading database ... 125312 files and directories currently installed.)
Removing nginx (1:1.10.1-8.5.0.29~trusty1) ...
root@FabServer:~# sudo apt-get install nginx=1.4.6-1ubuntu3
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:
nginx : Depends: nginx-core (< 1.4.6-1ubuntu3.1~) but 1:1.10.1-8.5.0.29~trusty1 is to be installed or
nginx-full (< 1.4.6-1ubuntu3.1~) but 1:1.10.1-8.5.0.29~trusty1 is to be installed or
nginx-light (< 1.4.6-1ubuntu3.1~) but 1:1.10.1-8.5.0.29~trusty1 is to be installed or
nginx-extras (< 1.4.6-1ubuntu3.1~) but 1:1.10.1-8.5.0.29~trusty1 is to be installed or
nginx-naxsi (< 1.4.6-1ubuntu3.1~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
root@FServer:~# apt-get remove --auto-remove nginx-core
Reading package lists... Done
Building dependency tree
Reading state information... Done
Package 'nginx-core' is not installed, so not removed
0 upgraded, 0 newly installed, 0 to remove and 388 not upgraded.
所以我遇到了一个奇怪的情况——正式的 nginx 包在删除时没有依赖项,但在安装时却有。而且我无法删除像 nginx-core 这样的包,因为系统认为它没有安装。
你有什么推荐吗?
答案1
使用官方 nginx Docker 镜像解决了依赖问题