如何在
RedHat 5.4
上使用免费的
YUM
源
以前工作中一直使用
centos
系统,突然今天新装了
RedHat 5.4
系统,想用
VIM
工具可是新装系统大家都知道没有安装此工具,大家这时肯定都会想到使用
YUM
安装下就可以了,可是
RedHat
自带的
YUM
源,是在收费的情况下才能使用的。于是由于咱是小农阶级没办法
GOOGLE
下,原来这样的情况不是我一个遇到看来已经有很多的前辈了,于是我随便点开了几个链接。查看别人的劳动成果,看完后让我有点晕。方法太多试了好多最后终于搞定,也不容易呀。
由于
RedHat
是自带的
yum
源是收费的,所以我们自然而然就想到了用他的社区版
Centos
的
yum
源。所以首先我们要卸载
RedHat
自带的
yum
的
RPM
包。
第一
步:
查看系统上安装的
yum
包
rpm -qa | grep yum
卸载安装的
yum
包
rpm -e �Cnodeps xxxxxx.rpm
第二步:
首先确定系统架构。
如果是
i386
的话则需要到
http://mirrors.163.com/centos/5/os/i386/CentOS/
找到对应的软件包
如果是
x86_64
的话则需要到
http://mirrors.163.com/centos/5/os/x86_64/CentOS/
找到对应的软件包
需要如下包:
m2crypto-0.16-8.el5.i386.rpm
python-elementtree-1.2.6-5.i386.rpm
python-iniparse-0.2.3-4.el5.noarch.rpm
python-sqlite-1.1.7-1.2.1.i386.rpm
python-urlgrabber-3.1.0-6.el5.noarch.rpm
yum-3.2.22-39.el5.centos.noarch.rpm
yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm
安装(升级)软件包
在软件包的存放目录里
rpm -ivh m2crypto-0.16-8.el5.i386.rpm python-elementtree-1.2.6-5.i386.rpm python-iniparse-0.2.3-4.el5.noarch.rpm python-sqlite-1.1.7-1.2.1.i386.rpm python-urlgrabber-3.1.0-6.el5.noarch.rpm yum-3.2.22-39.el5.centos.noarch.rpm yum-fastestmirror-1.1.16 21.el5.centos.noarch.rpm yum-metadata-parser-1.1.2 3.el5.centos.i386.rpm
rpm -import http://mirrors.163.com/centos/RPM-GPG-KEY-CentOS-5
使用网易的
YUM
源
cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS-Base-163.repo
修改
CentOS-Base-163.repo
文件
在所有
mirrorlist
前面加上
#
,把所有
$releasever
替换成
5
,保存。
修改内容如下
# 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-$releasever - Base - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Updates - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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 but not released
[addons]
name=CentOS-$releasever - Addons - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Extras - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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 extend functionality of existing packages
[centosplus]
name=CentOS-$releasever - Plus - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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-$releasever - Contrib - 163.com
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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
上面红色部分为修改部分
清理并重新生成
YUM
缓存
Yum clean metadata
Yum makecache
第三步:
此时的
yum
就正常工作了,我们可以用命令查看下
Yum list all
此时你时否看到你期待已久的画面。