查看当前系统版本
[root@dcmail2 ~]# lsb_release -a
LSB Version::core-3.0-ia32:core-3.0-noarch:graphics-3.0-ia32:graphics-3.0-noarch
Distributor ID:RedHatEnterpriseAS
Description:Red Hat Enterprise Linux AS release 4 (Nahant Update 4)
Release:4
Codename:NahantUpdate4
下载并安装YUM包
1.下载
wget http://yum.baseurl.org/download/2.0/yum-2.0.8-1.src.rpm
2.安装(由于是RPM源码包所以安装比较特殊)
rpmbuild --rebuild yum-2.0.8-1.src.rpm
3.进入到:/usr/src/redhat/RPMS/noarch/
rpm -ivh yum-2.0.8-1.noarch.rpm
4.配置文件/etc/yum.conf (注释部分为默认值,测试不可用,需要手动添加可用的源)
[root@dcmail2 ~]# cat /etc/yum.conf
[main]
cachedir=/var/cache/yum
debuglevel=2
logfile=/var/log/yum.log
pkgpolicy=newest
distroverpkg=redhat-release
tolerant=1
exactarch=1
[base]
name=Red Hat Linux $releasever - $basearch - Base
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/
baseurl=http://vault.centos.org/4.4/os/x86_64/
gpgcheck=1
[updates]
name=Red Hat Linux $releasever - Updates
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/
baseurl=http://vault.centos.org/4.4/updates/x86_64/
gpgcheck=1
过程中遇到的问题
Gathering header information file(s) from server(s)
Server: Red Hat Linux 4AS - i386 - Base
Server: Red Hat Linux 4AS - Updates
retrygrab() failed for:
http://vault.centos.org/4.4/updates/headers/header.info
Executing failover method
failover: out of servers to try
Error getting file http://vault.centos.org/4.4/updates/headers/header.info
[Errno 4] IOError: HTTP Error 404: Not Found
安装配置完毕后 yum list 报错,提示找不到header.info (之前百度上的大多数文档路径已过时,按照那个路径确实找不到,自己登录网站确定下header文件的位置更新下就行了)
只要是有4系的源,找到header路径 就可以添加上使用