在CentOs 7上使用yum没有可用的软件包httpd

时间:2018-08-01 12:05:47

标签: apache centos yum

当我尝试:

  

yum install httpd

我得到了错误:

Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.cloud.aliyuncs.com
 * extras: mirrors.cloud.aliyuncs.com
 * updates: mirrors.cloud.aliyuncs.com
No package httpd available.
Error: Nothing to do

enter image description here

1 个答案:

答案 0 :(得分:0)

httpd软件包可以从默认的CentOS存储库“基本”和“更新”(对于较新的版本)中安装。

# repoquery -i httpd | grep -i repo
Repository  : updates

请确保您具有存储库文件/etc/yum.repos.d/CentOS-Base.repo或手动创建,至少具有以下内容:

[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
gpgcheck=0
enabled=1

[updates]
name=CentOS-$releasever - Updates
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates&infra=$infra
gpgcheck=0
enabled=1

然后做:

# yum clean all && yum update -y && yum install httpd -y