第一种方法:

yum源来自chinalinuxpub.com,用的是centos包,
下载地址:
安装:
tar zxvf yum.tgz
cd yum
rpm -ivh *.rpm

rm -rf /etc/yum.repos.d/CentOS-Base.repo

vi /etc/yum.repos.d/as4-update.repo
加入:
#released updates
[update]
name=Red Hat Enterprise AS release 4 Updates
baseurl=http://ftp.chinalinuxpub.com/redhat/enterprise/updates/4AS/
gpgcheck=1
gpgkey=http://ftp.chinalinuxpub.com/redhat/enterprise/RPM-GPG-KEY-linuxpub

vi /etc/yum.repos.d/as4-base.repo

加入:
#released base
[base]
name=Red Hat Enterprise AS release 4 Updates
baseurl=http://ftp.chinalinuxpub.com/redhat/enterprise/os/i386/RedHat/ #在这个地方可以更改能连接上的网站
gpgcheck=1
gpgkey=http://ftp.chinalinuxpub.com/redhat/enterprise/RPM-GPG-KEY-linuxpub

然后就可以正常使用yum了.