[二] rehl 6.4 更换 yum源为163的源

1,查看当前版本

[root@yl yum.repos.d]# rpm -q yum

2,卸载当前yum

[root@yl yum.repos.d]# rpm -aq|grep yum|xargs rpm -e --nodeps

3,下载yum,根据自己的系统是32位或64位来决定安装什么版本

[root@yl yum.repos.d]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpm 

[root@yl yum.repos.d]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm  

[root@yl yum.repos.d]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm 

[root@yl yum.repos.d]# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

4,安装 yum

[root@yl yum.repos.d]rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

[root@yl yum.repos.d]rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm  

[root@yl yum.repos.d]rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm

后两个要一起安装

5,更新repo

(1)进入yum配置文件目录:cd /etc/yum.repos.d/

(2)备份配置文件:mv CentOS-Base.repo CentOS-Base.repo.bak

(3)下载网易的配置:wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

下载下来的文件名为 CentOS6-Base-163.repo

(4)重命名:mv CentOS6-Base-163.repo CentOS-Base.repo

我的配置

[base]
name=CentOS-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/x86_64/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-6 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/x86_64/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-6 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6/extras/x86_64/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[centosplus]
name=CentOS-6 - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
[contrib]
name=CentOS-6 - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/6/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

网上有的配置里会出现$releasever$basearch这两个变量,一定要先确认这两个环境变量是否存在,(echo一下)

如果不存在,就老老实实的用数字6和i386配,否则会出现

http://mirror.centos.org/centos/%24releasever/os/i386/repodata/repomd.xml: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404"

这种错误(%24就是$符号嘛,)

如果你原来的就是用环境变量配的,很简单,vim下

:%s/$releasever/6/g

:%s/$basearch/i386/g

就都替换掉了(根据自己的RHEL配,我用的发行版是RHEL 6.4)

6,最后一步

[root@yl yum.repos.d]# yum clean all 
[root@yl yum.repos.d]# yum makecache





评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值