报错如下:
http://mirrors.aliyun.com/centos/7Server/os/x86_64/repodata/repomd.xml: [Errno 14] HTTP Error 404 - Not Found
Trying other mirror
解决办法:
1.将CentOS-Base.repo里面的$releaseveer替换为7即可,可以用sed命令,如下:
sed -i ‘s/$releasever/7/’ CentOS-Base.repo
2.然后清除一下本地缓存
yum clean all
yum makecache #建立缓存
结果如下:![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/415f0711d85dda1ba9616e8ecb122e5f.png)
阿里云镜像源:(下载到/etc/yum.repos.d目录下)
CentOS 5
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-5.repo
CentOS 6
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-6.repo
CentOS 7
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo