给RHEL5.2 X86系统设置Centos的yum更新源

1、删除系统原有的RHN的yum包

 

rpm -e  yum-rhn-plugin-0.5.3-6.el5

rm  -f  /etc/yum.repos.d/rhel-debuginfo.repo

 

2、下载相关的centos包

 

 

wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/5/os/i386/CentOS/centos-release-5-6.el5.centos.1.i386.rpm

wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/5/os/i386/CentOS/centos-release-notes-5.6-0.i386.rpm

wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/5/os/i386/CentOS/createrepo-0.4.11-3.el5.noarch.rpm

wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/5/os/i386/CentOS/yum-3.2.22-33.el5.centos.noarch.rpm

wget http://ftp.nara.wide.ad.jp/pub/Linux/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm

rpm -ivh centos-release-notes-5.6-0.i386.rpm

rpm -ivh --force centos-release-5-6.el5.centos.1.i386.rpm

rpm -ivh createrepo-0.4.11-3.el5.noarch.rpm

rpm -ivh yum-fastestmirror-1.1.16-14.el5.centos.1.noarch.rpm

rpm -Uvh yum-3.2.22-33.el5.centos.noarch.rpm

 

3、更改CentOS-Base.repo内容,内容如下:

 

 

[base]
name=CentOS-5 - Base
baseurl=http://centos.ustc.edu.cn/centos/5/os/i386/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#released updates
[update]
name=CentOS-5 - Updates
baseurl=http://centos.ustc.edu.cn/centos/5/updates/i386/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#packages used/produced in the build but not released
[addons]
name=CentOS-5 - Addons
baseurl=http://centos.ustc.edu.cn/centos/5/addons/i386/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that may be useful
[extras]
name=CentOS-5 - Extras
baseurl=http://centos.ustc.edu.cn/centos/5/extras/i386/
gpgcheck=1
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#additional packages that extend functionality of existing packages
[centosplus]
name=CentOS-5 - Plus
baseurl=http://centos.ustc.edu.cn/centos/5/centosplus/i386/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

#contrib - packages by Centos Users
[contrib]
name=CentOS-5 - Contrib
baseurl=http://centos.ustc.edu.cn/centos/5/contrib/i386/
gpgcheck=1
enabled=0
gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

 

4、现在可以执行yum相关的命令了。

  yum  list

 

5、此时,如果在安装一个包时,出现下面这个错误,是由于GPG没有导入造成:

Image00098_thumb[2]

 

6、针对这个问题,可以将上述的Centos-Base.repo中的gpgkey=http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5导入到gpg库中,使用命令导入:

rpm  --import  http://centos.ustc.edu.cn/centos/RPM-GPG-KEY-CentOS-5

 

此时,可以查看导入GPG的RPM-GPG-KEY-CentOS-5文件:

  ls  /etc/pki/rpm-gpg/

Image00100_thumb[1]

 

7、此时再执行上面的yum安装时,就会一切OK了,如下图:

Image00099_thumb[4]

 

8、现在已经完全可以安装centos的yum源包了。^_^

你可能感兴趣的:(centos,yum,休闲,RHEL5.2,X86系统)