Radhat 5 6 7 配置 yum

redhat 5 6 7 配置yum服务的原理是一样的,本文以redhat5为例配置yum服务。

1、查看当前操作系统的radhat 版本号与32/64位操作系统。

[root@localhost centos5]# more /etc/redhat-release 
Red Hat Enterprise Linux Server release 5.8 (Tikanga)
[root@localhost centos5]# uname -a
Linux localhost.localdomain 2.6.18-308.el5 #1 SMP Fri Jan 27 17:17:51 EST 2012 x86_64 x86_64 x86_64 GNU/Linux

2、删除radhat自带的yum服务

[root@localhost centos5]# rpm -qa|grep yum |xargs rpm -e --nodeps

3、从镜像网站下载相应的yum 安装包并安装(安装包个数因操作系统版本号不同会有存在差异)

[root@localhost centos5]# wget yum-3.2.22-40.el5.centos.noarch.rpm
[root@localhost centos5]# wget yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
[root@localhost centos5]# wget yum-metadata-parser-1.1.2-4.el5.x86_64.rpm                                
[root@localhost centos5]# rpm -ivh yum*.rpm

4、配置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=os
baseurl=http://mirrors.163.com/centos/5/os/x86_64/
gpgcheck=1
gpgkey=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=updates
baseurl=http://mirrors.163.com/centos/5/updates/x86_64/
gpgcheck=1
gpgkey=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=extras
baseurl=http://mirrors.163.com/centos/5/extras/x86_64/
gpgcheck=1
gpgkey=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=centosplus
baseurl=http://mirrors.163.com/centos/5/centosplus/x86_64/
gpgcheck=1
enabled=0
gpgkey=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=contrib
baseurl=http://mirrors.163.com/centos/5/contrib/x86_64/
gpgcheck=1
enabled=0
gpgkey=http://mirrors.163.com/centos/5/os/x86_64/RPM-GPG-KEY-CentOS-5

5、清除缓存并下载新的镜像缓存

[root@localhost centos5]# yum clean all
[root@localhost centos5]# yum makecache

6、测试(查看当前subversion版本与检查服务器subversion版本)

[root@localhost yum.repos.d]# rpm -qa|grep subversion
subversion-1.6.11-7.el5_6.4
subversion-1.6.11-7.el5_6.4
[root@localhost yum.repos.d]# yum check-update subversion
Loaded plugins: fastestmirror, katello, product-id, subscription-manager
Updating certificate-based repositories.
Unable to read consumer identity
Loading mirror speeds from cached hostfile

subversion.i386                      1.6.11-12.el5_10                         base     
subversion.x86_64                    1.6.11-12.el5_10                         base     
Obsoleting Packages
centos-release.x86_64                10:5-11.el5.centos                       base     
redhat-release.x86_64                5Server-5.8.0.3                          installed
firefox.i386                         31.3.0-4.el5.centos                      updates  
    firefox.i386                     3.6.26-1.el5_7                           installed
firefox.x86_64                       31.3.0-4.el5.centos                      updates  
    firefox.x86_64                   3.6.26-1.el5_7                           installed


7、安装yum注意问题

根据Linux 的版本号安装相应的CentOS并引用CentOS版本号对应的CenOS-Base.repo文件,

(1)、如果安装了CentOS 5的yun,却引用CentOS6的源yum makecache时就会报错。

(2)、如果操作系统是Radhat 5,却安装 CentOS6 yum会导致安装时需要手动安装与升级大量的依赖包。


8、附:CentOS中国镜像网址

Asia	China	Zhejiang University	http://mirrors.zju.edu.cn/centos/		
Asia	China	Alibaba Cloud Computing	http://mirrors.aliyun.com/centos/		
Asia	China	Beijing Institute of Technology	http://mirror.bit.edu.cn/centos/		
Asia	China	BitComm Ltd.	http://mirrors.pubyun.com/centos/		
Asia	China	CDS China	http://mirrors.yun-idc.com/centos/	ftp://mirrors.yun-idc.com/centos/	rsync://mirrors.yun-idc.com/centos/
Asia	China	China University of Geosciences	http://mirrors.cug.edu.cn/centos/		
Asia	China	Dalian Neusoft University of Information	http://mirrors.neusoft.edu.cn/centos/	ftp://mirrors.neusoft.edu.cn/centos/	
Asia	China	Huazhong University of Science and Technology	http://mirrors.hust.edu.cn/centos/		rsync://mirrors.hust.edu.cn/centos/
Asia	China	NetEase	http://mirrors.163.com/centos/		
Asia	China	Northeastern University, Shenyang Liaoni	http://mirror.neu.edu.cn/centos/		
Asia	China	Northwest A&F University	http://mirrors.nwsuaf.edu.cn/centos/		
Asia	China	Qiming College of Huazhong University of Science and Technology	http://mirrors.hustunique.com/centos/	rsync://mirrors.hustunique.com/centos/
Asia	China	Shanghai Jiao Tong University	http://ftp.sjtu.edu.cn/centos/	ftp://ftp.sjtu.edu.cn/centos/	
Asia	China	Sohu Inc, Beijing P.R. China	http://mirrors.sohu.com/centos/		
Asia	China	University of Science and Tech of China	http://centos.ustc.edu.cn/centos/		
Asia	China - Hong Kong	Asia Web Services Ltd.	http://mirror.vpshosting.com.hk/pub/linux/centos/ ftp://mirror.vpshosting.com.hk/pub/linux/centos/

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值