关闭

RHEL5.5下配置Centos的yum源(转)

标签: centoslinuxxenfilevimubuntu
178人阅读 评论(0) 收藏 举报

因为ubuntu装xen出了各种问题,还好大师兄给我出主意现在服务器上的红帽试试,试成功啦,所以现在在自己机器上又重装了一个rhel5.5
这篇文章就是为了解决红帽没有注册导致yum不能更新的问题。搞定yum以后,下一步就是要装xen啦。不知道自带的那个能不能装上。。。
bless。。。
-------------------------昏割线----------------------------
###第一种方法,网上找的
1.确保RHEL5中已经安装了yum

[root@lvs-master  ~]# rpm -qa |grep  yum
yum-metadata-parser-1.1.2-3.el5
yum-updatesd-0.9-2.el5
yum-3.2.22-26.el5
yum-security-1.1.16-13.el5
yum-rhn-plugin-0.5.4-15.el5

2.修改源配置文件  #vim  /etc/yum.repos.d/CentOS-Base.repo

[base]
name=CentOS-5-Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever5&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
baseurl=http://ftp.sjtu.edu.cn/centos/5/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#released  updates
[update]
name=CentOS-5-Updates
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=updates
baseurl=http://ftp.sjtu.edu.cn/centos/5/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#packages  used/produced in the build but not  released
[addons]
name=CentOS-5-Addons
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=addons

baseurl=http://ftp.sjtu.edu.cn/centos/5/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#additional  packages that may be  useful
[extras]
name=CentOS-5-Extras
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=extras

baseurl=http://ftp.sjtu.edu.cn/centos/5/extras/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#additional  packages that extend functionality of existing  packages
[centosplus]
name=CentOS-5-Plus
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=centosplus
baseurl=http://ftp.sjtu.edu.cn/centos/5/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#contrib - packages by Centos  Users
[contrib]
name=CentOS-5-Contrib
#mirrorlist=http://mirrorlist.centos.org/?release=4&arch=$basearch&repo=contrib
baseurl=http://ftp.sjtu.edu.cn/centos/5/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-centos5

#  vi dag.repo
[dag]
name=Dag RPM Repository for  RHEL5
baseurl=http://ftp.riken.jp/Linux/dag/redhat/el5/en/$basearch/dag/
enabled=1
gpgcheck=1
gpgkey=http://ftp.riken.jp/Linux/dag/packages/RPM-GPG-KEY.dag.txt

3. 导入key
 #rpm --import  http://ftp.sjtu.edu.cn/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5
#rpm --import http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
(注:这是两个key,导入一个就行了。我用第一个key  import的时候yum可以update但好像不能install,搜了一下说可能是key不对,换了一个就是第二个,也没试好行不行。。。最后还是用了小青做好的,再下面第二中方法写着,非常好用。)

4. 运行,测试
 #yum update

5.#yum clean  all

-------------------------昏割线----------------------------
###第二种方法,小青做的,默默的感谢小青同学对我学习上的帮助

修改源配置文件 #vim  /etc/yum.repos.d/rhel-debuginfo.repo
###
[rhel-debuginfo]
name=Red Hat  Enterprise Linux $releasever - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release
[rhel-debuginfo-beta]
name=Red  Hat Enterprise Linux $releasever Beta - $basearch - Debug
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/$basearch/Debuginfo/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-beta,file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[base]
name=Red  Hat Enterprise Linux $releasever -Base
baseurl=http://ftp.twaren.net/Linux/CentOS/5/os/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5
[update]
name=Red  Hat Enterprise Linux $releasever -Updates
baseurl=http://ftp.twaren.net/Linux/CentOS/5/updates/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5
[extras]
name=Red  Hat Enterprise Linux $releasever -Extras
baseurl=http://ftp.twaren.net/Linux/CentOS/5/extras/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5
[addons]
name=Red  Hat Enterprise Linux $releasever -Addons
baseurl=http://ftp.twaren.net/Linux/CentOS/5/addons/$basearch/
gpgcheck=1
gpgkey=http://ftp.twaren.net/Linux/CentOS/RPM-GPG-KEY-CentOS-5
###

然后
#yum  update
#yum clean all

搞定啦!
小青真厉害~~赞一个~~
0
0

查看评论
* 以上用户言论只代表其个人观点,不代表CSDN网站的观点或立场
    个人资料
    • 访问:60608次
    • 积分:1033
    • 等级:
    • 排名:千里之外
    • 原创:36篇
    • 转载:45篇
    • 译文:0篇
    • 评论:11条
    最新评论