RedHat Enterprise Linux 6.5使用Centos 6 的yum源

由于redhat6.5的yum功能是需要注册费用的,所以自带的yum并不可用,想要使用免费的yum,可以用Centos6的yum源,配置自己的yum源。具体步骤如下:

(我的机器是32位,所以以下都是基于32位的redhat6.5)

1.先到 http://mirrors.163.com/centos/6/os/i386/Packages/  下载以下软件包:

a.  python-iniparse-0.3.1-2.1.el6.noarch.rpm

b.  yum-3.2.29-40.el6.centos.noarch.rpm

c.  yum-metadata-parser-1.1.2-16.el6.i686.rpm

d.  yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

下载命令:

a. wget http://mirrors.163.com/centos/6.6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

b. wget http://mirrors.163.com/centos/6.6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm

c. wget http://mirrors.163.com/centos/6.6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm

d. wget http://mirrors.163.com/centos/6.6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

2、卸载RedHat自带的yum

rpm -qa | grep yum | xargs rpm -e --nodeps


3、安装下载的centos的yum包:

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.2-16.el6.i686.rpm

rpm -ivh   yum-3.2.29-40.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm


[注] :最后2个需要一起安装,否则会出现依赖性错误


4、到 wget http://mirrors.163.com/.help/CentOS6-Base-163.repo 的 centos帮助文档 中下载CentOS6-Base-163.repo文件,去到/etc/yum.repos.d中,有个

rhel-source.repo,先将其备份 为 rhel-source.repo.bak,然后将下载的CentOS6-Base-163.repo拷贝到相同目录下,并改名为 rhel-source.repo

现在开始编辑 rhel-source.repo文件,将里面的$releasever替换为6.6(源里面没有6.5的资源)(我的rhel版本是6.5的,可以通过cat /etc/issue或者cat /etc/redhat-release查看系统版本)

可以用如下命令实现替换

0,$s/$releasever/6.6/g

我的文件内容如下:

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client.  You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#


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

#released updates
[updates]
name=CentOS-6.5 - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6.5/updates/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&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-6.5 - Extras - 163.com
baseurl=http://mirrors.163.com/centos/6.5/extras/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6.5&arch=$basearch&repo=extras
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6


#additional packages that extend functionality of existing packages

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


5.yum clean all 清除原有缓存

如果有出先如下提示,则需要先 kill -92267(这个是进程ID,根据以下的提示实际kill进程),再执行 yum clean all

[root@localhost ~]# yum clean all
Loaded plugins: product-id, refresh-packagekit, security, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Existing lock /var/run/yum.pid: another copy is running as pid 2267.
Another app is currently holding the yum lock; waiting for it to exit...
  The other application is: PackageKit
   Memory :  48 M RSS (365 MB VSZ)
   Started: Sat Nov 23 01:28:11 2013 - 10:00 ago
   State  : Sleeping, pid:2267

6.yum makecache  获取yum列表,会出现如下提示:

Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Determining fastest mirrors
base                                                     | 3.7 kB     00:00
base/group_gz                                            | 212 kB     00:57
base/filelists_db                                        | 4.9 MB     06:30
base/primary_db                                          | 3.5 MB     00:24
base/other_db                                            | 2.1 MB     00:28
extras                                                   | 3.3 kB     00:00
extras/filelists_db                                      |  11 kB     00:00
extras/prestodelta                                       |  899 B     00:00
extras/primary_db                                        |  19 kB     00:00
extras/other_db                                          |  22 kB     00:00
updates                                                  | 3.4 kB     00:00
updates/filelists_db                                     | 2.8 MB     00:36
updates/prestodelta                                      | 390 kB     00:09
updates/primary_db                                       | 5.0 MB     02:24
updates/other_db                                         |  43 MB     49:59
Metadata Cache Created(表示获取已经成功)











  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值