1、查看当前操作系统的radhat 版本号与32/64位操作系统。[root@localhost centos5]# more /etc/redhat-release Red Hat Enterprise Linux Server release 5.8 (Tikanga)[root@localhost centos5]# uname -aLinux localhost.localdomain 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux2、删除radhat自带的yum服务[root@localhost centos5]# rpm -qa|grep yum |xargs rpm -e --nodeps3、下载相应的yum 安装包并安装(安装包个数因操作系统版本号不同会有存在差异)[root@localhost centos5]# wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm[root@localhost centos5]# wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm[root@localhost centos5]# wget http://mirrors.163.com/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm [root@localhost centos5]# rpm -ivh yum*.rpm4、配置yum源(推荐使用的是163的镜像)[root@localhost centos5]# vi /etc/yum.repos.d/CenOS-Base.repo添加以下内容:# CentOS-Base.repo## The mirror system uses the connecting IP address of the client and the# update status of each mirror to pick mirrors that are updated to and# geographically close to the client. You should use this for CentOS updates# unless you are manually picking other mirrors.## If the mirrorlist= does not work for you, as a fall back you can try the # remarked out baseurl= line instead.##[base]name=CentOS-$releasever - Base#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osbaseurl=http://mirrors.163.com/centos/5/os/x86_64/gpgcheck=1gpgkey=http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#released updates [updates]name=CentOS-$releasever - Updates#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesbaseurl=http://mirrors.163.com/centos/5/updates/x86_64/gpgcheck=1gpgkey=http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-$releasever - Extras#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasbaseurl=http://mirrors.163.com/centos/5/extras/x86_64/gpgcheck=1gpgkey=http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plus#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusbaseurl=http://mirrors.163.com/centos/5/centosplus/x86_64/gpgcheck=1enabled=0gpgkey=http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contrib#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribbaseurl=http://mirrors.163.com/centos/5/contrib/x86_64/gpgcheck=1enabled=0gpgkey=http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-55、清除缓存并下载新的镜像缓存[root@localhost centos5]# yum clean all[root@localhost centos5]# yum makecache6、测试(查看当前subversion版本与检查服务器subversion版本)[root@localhost yum.repos.d]# rpm -qa|grep subversionsubversion-1.6.11-7.el5_6.4subversion-1.6.11-7.el5_6.4[root@localhost yum.repos.d]# yum check-update subversionLoaded plugins: fastestmirror, katello, product-id, subscription-managerUpdating certificate-based repositories.Unable to read consumer identityLoading mirror speeds from cached hostfilesubversion.i386 1.6.11-12.el5_10 base subversion.x86_64 1.6.11-12.el5_10 base Obsoleting Packagescentos-release.x86_64 10:5-11.el5.centos base redhat-release.x86_64 5Server-5.8.0.3 installedfirefox.i386 31.3.0-4.el5.centos updates firefox.i386 3.6.26-1.el5_7 installedfirefox.x86_64 31.3.0-4.el5.centos updates firefox.x86_64 3.6.26-1.el5_7 installed7、安装yum注意问题根据Linux 的版本号安装相应的CentOS并引用CentOS版本号对应的CenOS-Base.repo文件,(1)、如果安装了CentOS 5的yun,却引用CentOS6的源yum makecache时就会报错。(2)、如果操作系统是Radhat 5,却安装 CentOS6 yum会导致安装时需要手动安装与升级大量的依赖包。8、附:CentOS中国镜像网址AsiaChinaZhejiang Universityhttp://mirrors.zju.edu.cn/centos/AsiaChinaAlibaba Cloud Computinghttp://mirrors.aliyun.com/centos/AsiaChinaBeijing Institute of Technologyhttp://mirror.bit.edu.cn/centos/AsiaChinaBitComm Ltd.http://mirrors.pubyun.com/centos/AsiaChinaCDS Chinahttp://mirrors.yun-idc.com/centos/ftp://mirrors.yun-idc.com/centos/rsync://mirrors.yun-idc.com/centos/AsiaChinaChina University of Geoscienceshttp://mirrors.cug.edu.cn/centos/AsiaChinaDalian Neusoft University of Informationhttp://mirrors.neusoft.edu.cn/centos/ftp://mirrors.neusoft.edu.cn/centos/AsiaChinaHuazhong University of Science and Technologyhttp://mirrors.hust.edu.cn/centos/rsync://mirrors.hust.edu.cn/centos/AsiaChinaNetEasehttp://mirrors.163.com/centos/AsiaChinaNortheastern University, Shenyang Liaonihttp://mirror.neu.edu.cn/centos/AsiaChinaNorthwest A&F Universityhttp://mirrors.nwsuaf.edu.cn/centos/AsiaChinaQiming College of Huazhong University of Science and Technologyhttp://mirrors.hustunique.com/centos/rsync://mirrors.hustunique.com/centos/AsiaChinaShanghai Jiao Tong Universityhttp://ftp.sjtu.edu.cn/centos/ftp://ftp.sjtu.edu.cn/centos/AsiaChinaSohu Inc, Beijing P.R. Chinahttp://mirrors.sohu.com/centos/AsiaChinaUniversity of Science and Tech of Chinahttp://centos.ustc.edu.cn/centos/AsiaChina - Hong KongAsia Web Services Ltd.http://mirror.vpshosting.com.hk/pub/linux/centos/ ftp://mirror.vpshosting.com.hk/pub/linux/centos/
(以上内容不代表本站观点。) --------------------------------- |