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

 

posted @ 2019-08-31 17:14  百衲本  阅读(2050)  评论(0编辑  收藏  举报
cnblogs_post_body { color: black; font: 0.875em/1.5em "微软雅黑" , "PTSans" , "Arial" ,sans-serif; font-size: 15px; } cnblogs_post_body h1 { text-align:center; background: #333366; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 23px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } cnblogs_post_body h2 { text-align:center; background: #006699; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 20px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } cnblogs_post_body h3 { background: #2B6695; border-radius: 6px 6px 6px 6px; box-shadow: 0 0 0 1px #5F5A4B, 1px 1px 6px 1px rgba(10, 10, 0, 0.5); color: #FFFFFF; font-family: "微软雅黑" , "宋体" , "黑体" ,Arial; font-size: 18px; font-weight: bold; height: 25px; line-height: 25px; margin: 18px 0 !important; padding: 8px 0 5px 5px; text-shadow: 2px 2px 3px #222222; } 回到顶部 博客侧边栏 回到顶部 页首代码 回到顶部 页脚代码