RedHat系统的Yum安装

     Redhat Linux通常由于没有注册,导致yum程序无法使用,需要将其替换为centos的yum程序。

1. 下载Yum的安装包,由于体系结构的不同和包的更新,因此目录和文件名的版本号可能需要调整以下。

#wget http://centos.ustc.edu.cn/centos/5/os/{i386|x86_64}/CentOS/yum-3.2.22-39.el5.centos.noarch.rpm
#wget http://centos.ustc.edu.cn/centos/5/os/{i386|x86_64}/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.1.noarch.rpm
#wget http://centos.ustc.edu.cn/centos/5/os/{i386|x86_64}/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

2. 查出当前的yum程序,进行卸载

#rpm -qa|grep yum
# rpm -e yum-3.2.22-20.el5 --nodeps
# rpm -e yum-updatesd-0.9-2.el5 --nodeps
# rpm -e yum-security-1.1.16-13.el5 --nodeps
# rpm -e yum-metadata-parser-1.1.2-3.el5 --nodeps
# rpm -e yum-rhn-plugin-0.5.4-13.el5 --nodeps

3. 下载并导入KEY
# cd /etc/pki/rpm-gpg/
# wget http://mirrors.sohu.com/centos/RPM-GPG-KEY-CentOS-5
# rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY*

4. 安装yum安装包
rpm -ivh yum-3.2.22-39.el5.centos.noarch.rpm \
 yum-fastestmirror-1.1.16-21.el5.centos.1.noarch.rpm \
 yum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

5. 修改配置文件

Vi /etc/yum.repos.d/rhel-debuginfo.repo

[base]
name=Red Hat Enterprise Linux $releasever -Base
baseurl=http://mirrors.sohu.com/centos/5.5/os/$basearch/
gpgcheck=1

[update]
name=Red Hat Enterprise Linux $releasever -Updates
baseurl=http://mirrors.sohu.com/centos/5.5/updates/$basearch/
gpgcheck=1

[extras]
name=Red Hat Enterprise Linux $releasever -Extras
baseurl=http://mirrors.sohu.com/centos/5.5/extras/$basearch/
gpgcheck=1

[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://mirrors.sohu.com/centos/5.5/addons/$basearch/
gpgcheck=1

至此yum安装完成,可以 yum install 安装程序了

posted on 2011-05-05 11:15  IT老友  阅读(26171)  评论(5编辑  收藏  举报

导航