Redhat5.8 替换yum源

Redhat5.8替换yum源

老版本支持起来,还是挺麻烦的,何况是32位,/(ㄒoㄒ)/~~,把过程分享出来,供参考。

1、卸载RedHat自带yum:

#rpm-qa|grepyum|xargsrpm-e--nodeps

注:

a、xargs是一条Unix和类Unix操作系统的常用命令。它的作用是将参数列表转换成小块分段传递给其他命令,以避免参数列表过长的问题

b、--nodeps强制卸载,不管依赖性

2、下载yum相关软件

http://vault.centos.org/5.8/os/i386/CentOS/下载

yum-3.2.22-39.el5.centos.noarch.rpmyum-fastestmirror-1.1.16-21.el5.centos.noarch.rpmyum-metadata-parser-1.1.2-3.el5.centos.i386.rpm

3、安装

rpm-ivhyum*

注意一起安装,否则会报错,相互依赖的错误

4、备份配置文件,删除原有文件

cp-rf/etc/yum.repos.d//etc/yum.repos.d_bak

cd/etc/yum.repos.d/

rm*

5、下载163镜像源

wgethttp://mirrors.163.com/.help/CentOS5-Base-163.repo

到/etc/yum.repos.d/

修改为以下内容:

[base]

name=CentOS-$releasever-Base-163.com

baseurl=http://vault.centos.org/5.8/os/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#releasedupdates

[updates]

name=CentOS-$releasever-Updates-163.com

baseurl=http://vault.centos.org/5.8/updates/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#packagesused/producedinthebuildbutnotreleased

[addons]

name=CentOS-$releasever-Addons-163.com

baseurl=http://vault.centos.org/5.8/addons/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addons

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additionalpackagesthatmaybeuseful

[extras]

name=CentOS-$releasever-Extras-163.com

baseurl=http://vault.centos.org/5.8/extras/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras

gpgcheck=1

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#additionalpackagesthatextendfunctionalityofexistingpackages

[centosplus]

name=CentOS-$releasever-Plus-163.com

baseurl=http://vault.centos.org/5.8/centosplus/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplus

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

#contrib-packagesbyCentosUsers

[contrib]

name=CentOS-$releasever-Contrib-163.com

baseurl=http://vault.centos.org/5.8/contrib/$basearch/

#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contrib

gpgcheck=1

enabled=0

gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

因为163的源已经不支持5.x版本了,用yum下载会报大量404,所以切换到了vault.centos.org。

7、运行

yumcleanall

yummakecache

8、总结

其实这么折腾,安装软件是方便了,但很多软件都比较老,还需要手动安装,升级。

相关推荐