一、yum的下载并安装
step1:查看原有的yum
[root@localhost ~]# rpm -qa | grep yum
step2:删除yum下的所有组件
[root@localhost ~]# rpm -qa | grep yum | xargs rpm -e --nodeps
step3:查询原有yum配置,并删除
[root@localhost ~]# whereis yum
yum: /etc/yum
[root@localhost ~]# rm -fr /etc/yum
step4:去网站下载yum源
网站地址:http://mirrors.163.com/centos/7/os/x86_64/Packages/
(1)wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-cron-3.4.3-168.el7.centos.noarch.rpm
(2)wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
(3)wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
(4)wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.el7.centos.noarch.rpm
rpm -ivh --force --nodeps yum-cron-3.4.3-168.el7.centos.noarch.rpm
rpm -ivh --force --nodeps yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
rpm -ivh --force --nodeps yum-3.4.3-168.el7.centos.noarch.rpm
rpm -ivh --force --nodeps yum-plugin-fastestmirror-1.1.31-54.el7_8.noarch.rpm
可查看一下是否安装yum
[root@localhost ~]# rpm -qa |grep yum
二、yum的配置
step6:进入 /etc/yum.repos.d文件夹下,下载CentOS7-Base-163.repo
[root@localhost ~]# cd /etc/yum.repos.d
mv CentOS-Base.repo CentOS-Base.repo_OLD
wget -nc http://mirrors.aliyun.com/repo/Centos-7.repo
mv Centos-7.repo CentOS-Base.repo
三 更新yum缓存--未测试
#清除
yum clean all
#更新列表
yum list
#缓存yum包信息到本地
yum makecache