Redhat替换Centos Yum源

删除当前系统自带的yum

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

下载Cenots Yum源软件

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm

安装

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 
rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm 
rpm -ivh --force python-urlgrabber-3.9.1-11.el6.noarch.rpm
rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm

替换

cd /etc/yum.repos.d/ &&  rm -f *.repo
wget -O /etc/yum.repos.d/CentOS-Base.repo    http://mirrors.aliyun.com/repo/Centos-6.repo && wget -P /etc/yum.repos.d/ http://mirrors.aliyun.com/repo/epel-6.repo
sed -i 's/$releasever/6/g'  CentOS-Base.repo
sed -i 's/$basearch/x86_64/g' CentOS-Base.repo
sed -i 's/$basearch/x86_64/g' epel-6.repo
yum clean all && yum makecache fast

猜你喜欢

转载自blog.csdn.net/woailp___2005/article/details/109284424