red hat4 安装yum的方法

下载包 : wget http://yum.baseurl.org/download/2.0/yum-2.0.8-1.src.rpm
当然也可以选择别的版本:http://yum.baseurl.org/download/2.0/ 进入目录进行安装 :
rpmbuild --rebuild yum-2.0.8-1.src.rpm
cd /usr/src/redhat/RPMS/noarch/
rpm -ivh yum-2.0.8-1.noarch.rpm如果报错 使用:rpm -ivh –nodeps –replacefiles –force *.rpm
配置yum更新地址
vi /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/
name=Red Hat Linux $releasever - $basearch - Base
baseurl= http://centos.ustc.edu.cn/centos/4/os/i386/
#[updates]
#name=Red Hat Linux $releasever - Updates
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/updates/$releasever/
name=Red Hat Linux $releasever - Updates
baseurl= http://mirror.centos.org/centos/4/updates/i386/

[base] #name=Red Hat Linux $releasever - $basearch - Base
#baseurl=http://mirror.dulug.duke.edu/pub/yum-repository/redhat/$releasever/$basearch/
name=Red Hat Linux $releasever - $basearch - Base
baseurl= http://centos.ustc.edu.cn/centos/4/os/i386/
更新yum: yum update
等待更新完成就可以使用yum了。

你可能感兴趣的:(liunx)