小插曲:
阿里云官方yum源:https://yq.aliyun.com/articles/675241?spm=a2c4e.11155472.0.0.75eb40c8e9drNV
检查是否安装yum包,以及有哪些yum包
[root@localhost~]# rpm -qa |grep yum
更改yum源为阿里云yum源:
1.备份源文件:
mv /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.backup
2.下载阿里云yum源安装文件:
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
查看CentOS-Base.repo文件后发现,文件中出现$releasever(centos版本为7)
编辑配置文件(所有的$releasever均替换为7):
[root@localhost ~]# cd /etc/yum.repos.d
[root@localhost yum.repos.d]# sed -i 's/$releasever/7/g' CentOS-Base.repo
3.清除原有yum缓存 yum clean all
4.生成缓存 yum makecache