在 CentOS 7 上重新安装 httpd 时出错,如何解决?

在 CentOS 7 上重新安装 httpd 时出错,如何解决?

在 CentOS 7 服务器上,我在尝试重新安装 httpd 时遇到错误。 如何解决此错误并使 httpd 重新启动并运行?

这是我尝试安装 httpd 时出现的第一个错误:

[root@server-ip-address conf]# yum install httpd
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.chkhosting.com
 * epel: mirror.nexcess.net
 * extras: ftpmirror.your.org
 * updates: mirror.team-cymru.org
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-18.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-18.el7.centos for package: httpd-2.4.6-18.el7.centos.x86_64
--> Finished Dependency Resolution
Error: Package: httpd-2.4.6-18.el7.centos.x86_64 (updates)
       Requires: httpd-tools = 2.4.6-18.el7.centos
       Installed: 1:httpd-tools-2.4.6-18.el7.centos.vm.1.x86_64 (@virtualmin)
           httpd-tools = 1:2.4.6-18.el7.centos.vm.1
       Available: httpd-tools-2.4.6-17.el7.centos.1.x86_64 (base)
           httpd-tools = 2.4.6-17.el7.centos.1
       Available: httpd-tools-2.4.6-18.el7.centos.x86_64 (updates)
           httpd-tools = 2.4.6-18.el7.centos
 You could try using --skip-broken to work around the problem
 You could try running: rpm -Va --nofiles --nodigest

所以我按照建议并尝试添加--skip-broken如下:

[root@server-ip-address conf]# yum install httpd --skip-broken
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.chkhosting.com
 * epel: mirror.nexcess.net
 * extras: ftpmirror.your.org
 * updates: centos.mbni.med.umich.edu
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-18.el7.centos will be installed
--> Processing Dependency: httpd-tools = 2.4.6-18.el7.centos for package: httpd-2.4.6-18.el7.centos.x86_64
Packages skipped because of dependency problems:
    httpd-2.4.6-18.el7.centos.x86_64 from updates

然后我尝试启动该服务并收到以下错误:

[root@server-ip-address conf]# systemctl start httpd.service
Failed to issue method call: Unit httpd.service failed to load: No such file or directory.

答案1

您的 版本有冲突httpd-tools,显然来自官方 CentOS 存储库以外的来源。先删除它:

 # rpm -e httpd-tools

如果它给你任何关于它的静态信息,请添加--force和/或,--nodeps直到它服从为止。

当您随后安装时httpd,还应该安装httpd-tools.

答案2

屏蔽服务的主要原因是为了防止意外启动或启用服务。

例如,firewalld 可以被屏蔽systemctl mask firewalld

启动firewalld服务时,您可能会收到错误消息

Failed to issue method call: Unit firewalld.service is masked.

要解决此问题,请使用 取消屏蔽防火墙systemctl unmask firewalld

相关内容