Redhat6.6替换Centos Yum源
1.删除当前系统自带的yum
[root@reddhat6_155_201 ~]# rpm -qa |grep yum
yum-rhn-plugin-0.9.1-50.el6.noarch
yum-utils-1.1.30-30.el6.noarch
PackageKit-yum-plugin-0.5.8-23.el6.x86_64
yum-3.2.29-60.el6.noarch
yum-metadata-parser-1.1.2-16.el6.x86_64
PackageKit-yum-0.5.8-23.el6.x86_64
yum-plugin-security-1.1.30-30.el6.noarch
[root@reddhat6_155_201 ~]# rpm -qa|grep yum|xargs rpm -e --nodeps
2.下载安装Cenots Yum源依赖的软件
[root@reddhat6_155_201 ~]# mkdir package
[root@reddhat6_155_201 ~]# cd package
[root@reddhat6_155_201 package]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-81.el6.centos.noarch.rpm
[root@reddhat6_155_201 package]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@reddhat6_155_201 package]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
[root@reddhat6_155_201 package]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@reddhat6_155_201 package]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
#以上rpm下载可能会出现404,可以直接去http://mirrors.163.com/centos/6/os/x86_64/Packages/下查看具体的版本及下载地址
3.安装依赖的RPM包
[root@reddhat6_155_201 package]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@reddhat6_155_201 package]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@reddhat6_155_201 package]# rpm -ivh --force python-urlgrabber-3.9.1-11.el6.noarch.rpm #注意该RPM包安装方式的区别
[root@reddhat6_155_201 package]# rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
4.下载阿里Yum源并使用
[root@reddhat6_155_201 package]# cd /etc/yum.repos.d/ && rm -f *.repo [root@reddhat6_155_201 yum.repos.d]# 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 [root@reddhat6_155_201 yum.repos.d]# sed -i 's/$releasever/6/g' CentOS-Base.repo [root@reddhat6_155_201 yum.repos.d]# sed -i 's/$basearch/x86_64/g' CentOS-Base.repo
[root@reddhat6_155_201 yum.repos.d]# sed -i 's/$basearch/x86_64/g' epel-6.repo
[root@reddhat6_155_201 yum.repos.d]# yum clean all && yum makecache fast
5.去除mail提示
echo "unset MAILCHECK">> /etc/profile && source /etc/profile && cat /dev/null > /var/spool/mail/root
"一劳永逸" 的话,有是有的,而 "一劳永逸" 的事却极少