centos7清理yum源

1. 删除起始的源
	cd /etc/yum.repos.d/ && rm -f ./* || echo "delete error"
2. 卸载yum
	rpm -qa | grep yum | xargs -I {} rpm -e --nodeps {}
3. 下载最新的yum程序的rpm包
	http://mirrors.163.com/centos/7/os/x86_64/Packages/
	 wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-168.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-54.el7_8.noarch.rpm
4. 安装yum程序
	rpm -ivh *.rpm 
5. 导入证书
	rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-7
6. 添加阿里源
	wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
7. 清理源
	yum clean all && yum makecache fast 

你可能感兴趣的:(Linux基础服务搭建,服务器,centos,linux)