最近在用RHEL5.5做ISCSI的客户端挂载iscsi盘,但不断出现问题。想更新iscsi-initiator-utils这个包,但又没注册RHN,没办法了,只好换到CentOS源去更新了,我这里选择163的源。
更新源当然要用root用户登录了
GO!去/etc/yum.repos.d/目录
#cd /etc/yum.repos.d/
停用原有的RHEL5.5的RPM源
#mv rhel-debuginfo.repo rhel-debuginfo.repo.bak
如果有其它的源,一律加个.bak
编辑新的163源repo文件
#vi CentOS-Base-163.repo
内容如下:
# CentOS-Base.repo
#
# The mirror system uses the connecting IPaddress of the client and the
# update status of each mirror to pickmirrors that are updated to and
# geographically close to the client.You should use this for CentOS updates
# unless you are manually picking othermirrors.
#
# If the mirrorlist= does not work for you,as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-5 - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=os
baseurl=http://mirrors.163.com/centos/5/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#released updates
[updates]
name=CentOS-5 - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=updates
baseurl=http://mirrors.163.com/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#packages used/produced in the build butnot released
[addons]
name=CentOS-5 - Addons - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=addons
baseurl=http://mirrors.163.com/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that may be useful
[extras]
name=CentOS-5 - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=extras
baseurl=http://mirrors.163.com/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#additional packages that extendfunctionality of existing packages
[centosplus]
name=CentOS-5 - Plus - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=centosplus
baseurl=http://mirrors.163.com/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=5&arch=$basearch&repo=contrib
baseurl=http://mirrors.163.com/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5
网上有些文章会让你去下载wget http://mirrors.163.com/.help/CentOS5-Base-163.repo这个文件,直接有上面的内容了。但可能是人品问题了,下载的文件其中$releasever这个变量死活读不出来,所以把这个变量全部改成了“5”(这是系统的版本,双引号不用),然后把所有mirrorlist这句都注释了,就是上面这个文件的内容了。
再执行命令:
更改CentOS的163源
#yum clean metadata
#yum makecache
再导入163的key文件
#rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
到这里就完成了163源的修改了
在这里,你要更新什么包,安装什么包,直接yum就可以了
#yum install iscsi-initiator-utils
但要注意,如果执行了yum update 和 yum upgrade,那你的RHEL可能就真的变成CentOS了,反正我没试。