这两天在完成nginx任务时,遇到了nginx安装的坑:
$ sudo apt-get install 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:
nginx : Depends: libssl1.0.0 (>= 1.0.2~beta3) but it is not installable
E: Unable to correct problems, you have held broken packages.
方法一:
sudo apt-get install libssl1.0.0=1.0.2g-1ubuntu4 (因为版本信息不全导致指令报错,后经验证用 libssl1.0.0=1.0.2g-1ubuntu4.16),这种方法不是很给力,一不小心就无法安装成功。
方法二:
利用ngnix离线安装包中依赖包去安装这个libssl,生成离线安装nginx (链接中是如何离线安装nginx,很详细),里面找到了一个‘libssl1.0.0_1.0.2g-1ubuntu4.16_amd64.deb’,直接用dpkg指令直接安装了这个离线包。
sudo dpkg -i libssl1.0.0_1.0.2g-1ubuntu4.16_amd64.deb
执行完成之后可以顺利安装nginx了。
总结一点:
如果离线包能正常安装,而在线包无法下载,可以查看离线包中依赖包去安装,之后就能完成后续安装了。
网友评论