RedHat系統的Yum安裝
Redhat Linux通常由於沒有注冊,導致yum程序無法使用,需要將其替換為centos的yum程序。
1. 下載Yum的安裝包,由於體系結構的不同和包的更新,因此目錄和文件名的版本號可能需要調整以下。
#wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
#wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
#wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.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-40.el5.centos.noarch.rpm \
yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm \
yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
5. 修改配置文件
mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.bak
vi /etc/yum.repos.d/rhel-debuginfo.repo
[base]
name=Red Hat Enterprise Linux $releasever -Base
baseurl=http://mirrors.163.com/centos/5/os/$basearch/
gpgcheck=1
[update]
name=Red Hat Enterprise Linux $releasever -Updates
baseurl=http://mirrors.163.com/centos/5/updates/$basearch/
gpgcheck=1
[extras]
name=Red Hat Enterprise Linux $releasever -Extras
baseurl=http://mirrors.163.com/centos/5/extras/$basearch/
gpgcheck=1
[addons]
name=Red Hat Enterprise Linux $releasever -Addons
baseurl=http://mirrors.163.com/centos/5/addons/$basearch/
gpgcheck=1
6、清理yum源
yum clean all
7、yum install vim #測試一下可不可以用
至此yum安裝完成,可以 yum install 安裝程序了