rhel6.x 利用centos yum源

来源:互联网 发布:电视怎么切换网络电视 编辑:程序博客网 时间:2024/05/18 22:12
前期工作
rpm --import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-6
安装那个163GPG,也可增加其他资源库,自己选择一个离自己地理位置近点
rpm -qa gpg-pubkey*
检查GPG Key
gpg-pubkey-c105b9de-4e0fd3a3
如果要删除Key,使用以下命令:
 rpm -egpg-pubkey-c105b9de-4e0fd3a3


rhel6.2 X86_64 系统
第一步,修改 /etc/yum.repos.d/ *.repo 文件,我这里是rhel-source.repo。
rhel-source.repo内容为
[rhel-source]
name=Red Hat Enterprise Linux $releasever - $basearch -Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/enterprise/$releasever/en/os/SRPMS/
enabled=0
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release

[rhel-source-beta]
name=Red Hat Enterprise Linux $releasever Beta - $basearch -Source
baseurl=ftp://ftp.redhat.com/pub/redhat/linux/beta/$releasever/en/os/SRPMS/
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

第二步,打开对应的centos版本163源 的repo文件,这里 Red Hat Enterprise Linux 6.2对应CentOS6。下载弟子为http://mirrors.163.com/.help/CentOS6-Base-163.repo将这个文件内容全部复制,粘贴在rhel-source.repo后面(不要覆盖原来的内容)
并将“name=CentOS- “全部替换为“name=Red Hat Enterprise Linux"
将“- 163.com”全部替换为“ ”
保存rhel-source.repo文件

第三步,ll
[root@aivyoyo ~]#yum cleanall 清除缓存及旧的包
[root@aivyoyo ~]# yum installhttpd 测试是否能更新软件




附上CentOS-Base.repo文件的内容,懒得下的,而且版本对的,可以直接复制
# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the clientand the
# update status of each mirror to pick mirrors that are updated toand
# geographically close to the client.  You shoulduse this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you cantry the
# remarked out baseurl= line instead.
#
#

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that extend functionality of existingpackages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/centosplus/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


参考:http://viong.blog.51cto.com/844766/278402
原创粉丝点击