CentOS7安装yum(2019-03-14)

查询原有的yum

[root@orcl ~]# rpm -qa |grep yum 

删除原有的yum 

[root@orcl ~]# rpm -aq|grep yum|xargs rpm -e –nodeps 

[root@orcl ~]# rpm -qa |grep yum 

[root@orcl ~]#

查询原有yum配置 

[root@orcl ~]# whereis yum 

yum: /etc/yum 

[root@orcl ~]# rm -fr /etc/yum

rpm -aq|grep yum|xargs rpm -e --nodeps

下载yum安装文件 (若没有此包,可以去阿里镜像或网易镜像找到包名一样的下下来即可)

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-161.el7.centos.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm

wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm

进行安装yum

rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm

rpm -ivh yum-3.4.3-161.el7.centos.noarch.rpm yum-plugin-fastestmirror-1.1.31-50.el7.noarch.rpm

注意最后两个包必需同时安装,否则会相互依赖

更新repo文件

进入 /etc/yum.repos.d文件夹下,

wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

删除原来的配置文件 rm -rf CentOS-Base.repo

修改新配置文件名 mv CentOS7-Base-163.repo CentOS7-Base.repo

安装结束

你可能感兴趣的:(CentOS7安装yum(2019-03-14))