我正在尝试安装 nginx 但是收到此错误。
ahmed@ahmed-Inspiron-5537:~$ sudo apt-get install nginx
[sudo] password for ahmed:
Reading package lists... Done
Building dependency tree
Reading state information... Done
nginx is already the newest version (1.10.3-1ubuntu3).
The following packages were automatically installed and are no longer required:
linux-headers-4.10.0-19 linux-headers-4.10.0-19-generic
linux-image-4.10.0-19-generic linux-image-extra-4.10.0-19-generic
Use 'sudo apt autoremove' to remove them.
0 upgraded, 0 newly installed, 0 to remove and 2 not upgraded.
2 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up nginx-core (1.10.3-1ubuntu3) ...
Job for nginx.service failed because the control process exited with error code.
See "systemctl status nginx.service" and "journalctl -xe" for details.
invoke-rc.d: initscript nginx, action "start" failed.
● nginx.service - A high performance web server and a reverse proxy server
Loaded: loaded (/lib/systemd/system/nginx.service; enabled; vendor preset: enabled)
Active: failed (Result: exit-code) since Fri 2017-06-09 15:49:00 +04; 10ms ago
Docs: man:nginx(8)
Process: 13214 ExecStart=/usr/sbin/nginx -g daemon on; master_process on; (code=exited, status=1/FAILURE)
Process: 13202 ExecStartPre=/usr/sbin/nginx -t -q -g daemon on; master_process on; (code=exited, status=0/SUCCESS)
CPU: 26ms
يون 09 15:48:58 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:48:59 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …e)
يون 09 15:49:00 ahmed-Inspiron-5537 nginx[13214]: nginx: [emerg] …()
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: nginx.service: Co…=1
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: Failed to start A…r.
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: nginx.service: Un…e.
يون 09 15:49:00 ahmed-Inspiron-5537 systemd[1]: nginx.service: Fa…'.
Hint: Some lines were ellipsized, use -l to show in full.
dpkg: error processing package nginx-core (--configure):
subprocess installed post-installation script returned error exit status 1
dpkg: dependency problems prevent configuration of nginx:
nginx depends on nginx-core (<< 1.10.3-1ubuntu3.1~) | nginx-full (<< 1.10.3-1ubuntu3.1~) | nginx-light (<< 1.10.3-1ubuntu3.1~) | nginx-extras (<< 1.10.3-1ubuntu3.1~); however:
Package nginx-core is not configured yet.
Package nginx-full is not installed.
Package nginx-light is not installed.
Package nginx-extras is not installed.
nginx depends on nginx-core (>= 1.10.3-1ubuntu3) | nginx-full (>= 1.10.3-1ubuntu3) | nginx-light (>= 1.10.3-1ubuntu3) | nginx-extras (>= 1.10.3-1ubuntu3); however:
Package nginx-core is not configured yet.
Package nginx-full is not installed.
Package nginx-light is not installed.
Package nginx-extras is not installed.
dpkg: error processing package nginx (--configure):
dependency problems - leaving unconfigured
No apport report written because the error message indicates its a followup error from a previous failure.
Errors were encountered while processing:
nginx-core
nginx
E: Sub-process /usr/bin/dpkg returned an error code (1)
答案1
您也可以通过执行以下命令来尝试:
获取已安装的所有 Nginx 包的列表
dpkg -l | grep nginx
通过执行以下命令删除 nginx 的所有软件包:
apt-get --purge autoremove nginx-*
或者
apt-get --purge autoremove <packages listed in ouput of 1>
上述命令将删除所有 Nginx 依赖项。此外,检查/var/lib/nginx
和/etc/nginx
是否被删除。如果没有被删除,请通过执行以下命令删除目录:
rm -rf /var/lib/nginx /etc/nginx
答案2
ahmed@ahmed-Inspiron-5537:~$ sudo apt-get install nginx
[sudo] ahmed 的密码:
正在读取软件包列表...完成正在
构建依赖关系树
正在读取状态信息...完成
nginx已经是最新版本(1.10.3-1ubuntu3)。
以下软件包已自动安装,不再需要:
blah blah
它还说:
2 未完全安装或删除。
所以你应该尝试:
sudo apt purge nginx
进而:
sudo apt install nginx
通过这样做,您可以完全卸载 nginx,然后重新安装它。
如果有效的话请告诉我:),
Wessel