红联Linux门户
Linux帮助

RHEL X86 64 6.0使用CentOS 6.0的yum源

发布时间:2014-12-08 15:57:24来源:linux网站作者:huguohuan

1.为了方便起见,先切换到root用户


2.先删除rhel6自带的yum

rpm -aq|grep yum|xargs rpm -e --nodeps


3.下载CentOS 6的yum

wget http://mirrors.163.com/centos/6.0/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm  
wget http://mirrors.163.com/centos/6.0/os/x86_64/Packages/yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm  
wget http://mirrors.163.com/centos/6.0/os/x86_64/Packages/yum-3.2.27-14.el6.centos.noarch.rpm  
wget http://mirrors.163.com/centos/6.0/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm


4.安装这几个rpm包,安装的时候可能有依赖问题,多试几次就可以了。

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm 
rpm -ivh yum-metadata-parser-1.1.2-14.1.el6.x86_64.rpm 
rpm -ivh yum-3.2.27-14.el6.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.26-11.el6.noarch.rpm


5.下载CentOS的repo源配置文件,我下载到的是CentOS 5的配置,需要做些修改才能用在CentOS6上面。我已经改好了,用的是国内163的源镜像。

[base] 
name=CentOS-6 - Base 
repo=os 
baseurl=http://mirrors.163.com/centos/6/os/$basearch/ 
gpgcheck=1 
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 
 
#released updates 
[update] 
name=CentOS-6 - Updates 
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ 
gpgcheck=1 
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 
 
#packages used/produced in the build but not released 
#[addons] 
#name=CentOS-6 - Addons 
#baseurl=http://mirrors.163.com/centos/5/addons/$basearch/ 
#gpgcheck=1 
#gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5 
 
#additional packages that may be useful 
[extras] 
name=CentOS-6 - Extras 
baseurl=http://mirrors.163.com/centos/6/extras/$basearch/ 
gpgcheck=1 
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 

#additional packages that extend functionality of existing packages 
[centosplus] 
name=CentOS-6 - Plus 
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/ 
gpgcheck=1 
enabled=1 
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 
 
#contrib - packages by Centos Users 
[contrib] 
name=CentOS-6 - Contrib 
baseurl=http://mirrors.163.com/centos/6/contrib/$basearch/ 
gpgcheck=1 
enabled=0 
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
 

6.然后把CentOS-Base.repo放到/etc/yum.repos.d/目录下面

mv ./CentOS-Base.rep /etc/yum.repos.d/


7.清除yum的缓存

yum clean all


8.现在应该就可以用了

试试:yum search nginx