CentOS 8 yum安装软件时,提示无法从AppStream下载
[root@C8-3 ~]# yum -y install httpd mariadb-server mariadb php php-mysql Repository AppStream is listed more than once in the configurationRepository extras is listed more than once in the configurationRepository PowerTools is listed more than once in the configurationRepository centosplus is listed more than once in the configurationRepository fasttrack is listed more than once in the configurationCentOS-8 - AppStream 0.0B/s | 0B 00:08Failed to download metadata for repo 'AppStream'Error: Failed to download metadata for repo 'AppStream'
检查网通不通,然后确定DNS解析是否正确。
[root@C8-3 ~]# ping baidu.comPING baidu.com (220.181.38.148) 56(84) bytes of data.64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=1 ttl=128 time=12.1 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=2 ttl=128 time=12.2 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=3 ttl=128 time=11.7 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=4 ttl=128 time=13.5 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=5 ttl=128 time=12.2 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=6 ttl=128 time=12.1 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=7 ttl=128 time=13.9 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=8 ttl=128 time=11.4 ms64 bytes from 220.181.38.148 (220.181.38.148): icmp_seq=9 ttl=128 time=13.9 ms ^C --- baidu.com ping statistics ---9 packets transmitted, 9 received, 0% packet loss, time 31ms rtt min/avg/max/mdev = 11.394/12.554/13.949/0.899 ms
有可能是所在网络环境在出口封了相应端口,需用其他方式,比如VPN解决。
我们无法使用CentOS原生yum源就是因为网络问题,你懂的。
为了快,更换国内yum源,推荐腾讯yum。实测成功。
1.使用腾云yum源: https://mirrors.tencent.com/help/centos.html
关键步骤:
2:先清理缓存,使用命令:
yum clean all
3:在下载这个CentOS-Base.repo文件同级别目录(目录地址:/etc/yum.repos.d),修改CentOS-AppStream.repo,命令如下:
[AppStream]
name=Qcloud centos AppStream - $basearch
baseurl=http://mirrors.cloud.tencent.com/centos/$releasever/AppStream/$basearch/os/
enabled=0
gpgcheck=1
gpgkey=http://mirrors.cloud.tencent.com/centos/RPM-GPG-KEY-CentOS-Official
之前的删除也可以,注释也可以;
4:重新清理缓存,命令:yum clean all && yum makecache