-

Redhat配置国内163的yum源

Linux

YUM是Redhat Linux在线安装更新及软件的工具,但是这是RHEL的收费功能。由于CentOS是从Redhat演化而来的免费Linux版本,因此可以利用CentOS的国内163的yum更新源来实现YUM功能。配置方法如下:

1.删除redhat 原有的yum
[cc lang=”bash”][root@linux ~]# rpm -aq|grep yum|xargs rpm -e –nodeps[/cc]

2.下载yum 安装文件
/////////////////////////x86_64/////////////////////////////////////
[cc lang=”bash”][root@linux ~]# wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
[root@linux ~]# wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
[root@linux ~]# wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@linux ~]# wget -c http://mirrors.163.com/centos/6.4/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm[/cc]
/////////////////////////i386//////////////////////////////////////
http://mirrors.163.com/centos/6.5/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
http://mirrors.163.com/centos/6.5/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
http://mirrors.163.com/centos/6.5/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
http://mirrors.163.com/centos/6.5/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

3.安装yum 软件包
[cc lang=”bash”][root@linux ~]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
[root@linux ~]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@linux ~]# rpm -ivh yum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm #两个一起安装先后顺序不要乱(中间50%正常)[/cc]

4、更改yum源 #我们使用网易的CentOS镜像源
(1)清空yum仓库
[cc lang=”bash”][root@linux ~]# cd /etc/yum.repos.d/
[root@linux yum.repos.d]# rm -rf *[/cc]
(2)设置源
[cc lang=”bash”][root@linux yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
[root@linux yum.repos.d]# vi CentOS6-Base-163.repo[/cc]
编辑文件,把文件里面所有的$releasever全部替换为你得版本号,即6.4 最后保存!或者直接把下面的内存拷贝到CentOS6-Base-163.repo文件中即可(已经修改好)
[cc lang=”vim”]#################################################################

# CentOS-Base.repo
#
# The mirrorsystem uses the connecting IP address of the client and the
# update status ofeach mirror to pick mirrors that are updated to and
# geographicallyclose to the client. You should use thisfor CentOS updates
# unless you aremanually picking other mirrors.
#
# If the mirrorlist=does not work for you, as a fall back you can try the
# remarked outbaseurl= line instead.
#
[base]
name=CentOS-6.4 -Base – 163.com
baseurl=http://mirrors.163.com/centos/6.4/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#released updates

[updates]
name=CentOS-6.4 -Updates – 163.com
baseurl=http://mirrors.163.com/centos/6.4/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additionalpackages that may be useful

[extras]
name=CentOS-6.4 -Extras – 163.com
baseurl=http://mirrors.163.com/centos/6.4/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#additionalpackages that extend functionality of existing packages

[centosplus]
name=CentOS-6.4 -Plus – 163.com
baseurl=http://mirrors.163.com/centos/6.4/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=centosplus
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
#contrib -packages by Centos Users

[contrib]
name=CentOS-6.4 -Contrib – 163.com
baseurl=http://mirrors.163.com/centos/6.4/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.4&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6[/cc]

5、清理yum缓存
[cc lang=”bash”][root@linux ~]# yum clean all
[root@linux ~]# yum makecache #将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
[root@linux ~]# yum installvim* #测试域名是否可用[/cc]
至此,Redhat6可以使用CentOS的yum源在线安装软件了!

6.使用 # yum update或 # yum upgrade 升级系统
[cc lang=”bash”][root@linux ~]# yum update #升级所有包,改变软件设置和系统设置,系统版本内核都升级
[root@linux ~]# yum -y upgrade #升级所有包,不改变软件设置和系统设置,系统版本升级,内核不改变[/cc]

来源:Redhat配置国内163的yum源

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注