我在 AWS EC2 上使用 Ubuntu 16.04 LTS。安装 varnish 缓存服务器时出现以下错误。
Reading package lists... Done
Building dependency tree
Reading state information... Done
Suggested packages:
varnish-doc
The following NEW packages will be installed:
varnish
0 upgraded, 1 newly installed, 0 to remove and 1 not upgraded.
Need to get 0 B/543 kB of archives.
After this operation, 1,681 kB of additional disk space will be used.
Selecting previously unselected package varnish.
(Reading database ... 92641 files and directories currently installed.)
Preparing to unpack .../varnish_4.1.3-1~jessie_amd64.deb ...
Unpacking varnish (4.1.3-1~jessie) ...
Processing triggers for systemd (229-4ubuntu12) ...
Processing triggers for ureadahead (0.100.0-19) ...
Processing triggers for man-db (2.7.5-1) ...
Setting up varnish (4.1.3-1~jessie) ...
Job for varnish.service failed because the control process exited with error code. See "systemctl status varnish.service" and "journalctl -xe" for details.
invoke-rc.d: initscript varnish, action "start" failed.
dpkg: error processing package varnish (--configure):
subprocess installed post-installation script returned error exit status 1
Errors were encountered while processing:
varnish
E: Sub-process /usr/bin/dpkg returned an error code (1)
我使用以下命令安装 varnish
sudo apt-get install varnish
答案1
您需要阅读命令的输出(以及您仔细发布的内容),您似乎错过了
varnish.service 的作业失败,因为控制进程以错误代码退出。请参阅“systemctl 状态 varnish.service“ 和 ”journalctl-xe”以了解详细信息。
上面这一行是解决这个问题的关键。特别是你应该运行以下命令
systemctl status varnish.service
可能会提供一些有用的信息(但也可能没有)
systemctl status varnish.service
这将提供有用的信息。
注意你可能应该运行
systemctl start varnish.service
然后运行错误消息中的命令。