Red Hat 6.7 配置使用centos的yum源

闲来无事,安装了redhat 6.7,安装后发现redhat的yum源需要注册,不注册的话无法更新和使用yum install安装软件,没办法,只能用把其替换成centos的源了。
1.卸载yum包:

$su            "切换到root
#rpm -qa|grep yum|xargs rpm -e --nodeps

2.下载163上centos6的yum包:

#wget mirrors.163.com/centos/6/os/i386/Packages/yum-3.2.29-69.el6.centos.noarch.rpm   
#wget mirrors.163.com/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm  
#wget mirrors.163.com/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm  
#wget mirrors.163.com/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm 
#wget mirrors.163.com/centos/6/os/i386/Packages/python-urllib3-1.10.2-1.el6.noarch.rpm   

注意:上面的软件包都是32位系统使用的,如果你的操作系统是64位的,请去网易开源库下载相应的软件包:下载地址

3.安装rpm软件包:

#rpm -ivh yum-3.2.29-69.el6.centos.noarch.rpm yum-metadata-parser-1.1.2-16.el6.i686.rpm python-iniparse-0.3.1-2.1.el6.noarch.rpm yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm python-urllib3-1.10.2-1.el6.noarch.rpm --force --nodeps

这些包相互依赖,所以一起安装,--force --nodeps是因为python-urllib3包的签名无效,强制并忽略依赖安装。
4.修改yum源配置文件:

#mv /etc/yum.repos.d/rhel-source.repo /etc/yum.repos.d/rhel-source.repo.bk "备份原来的配置文件
#wget http://mirrors.163.com/.help/CentOS6-Base-163.repo /etc/yum.repos.d/
#mv /etc/yum.repos.d/CentOS6-Base-163.repo /etc/yum.repos.d/rhel-source.repo
#vi /etc/yum.repos.d/rhel-source.repo

将rhel-source.repo文件中所有的baseurl=http://mirrors.163.com/centos/后面的$releasever替换为6.8其他的保持不变;或者你可以不wget CentOS6-Base-163.repo文件,直接在/etc/yum.repos.d/目录下直接创建一份rhel-source.repo文件,即

#cd /etc/yum.repos.d/
#vi rhel-source.repo

文件内容如下:

[base]
name=CentOS-$releasever - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#released updates 
[updates]
name=CentOS-$releasever - Updates - 163.com
baseurl=http://mirrors.163.com/centos/6/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#additional packages that may be useful
[extras]
name=CentOS-$releasever - Extras - 163.com
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-$releasever - Plus - 163.com
baseurl=http://mirrors.163.com/centos/6/centosplus/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

#contrib - packages by Centos Users
[contrib]
name=CentOS-$releasever - Contrib - 163.com
baseurl=http://mirrors.163.com/centos/$releasever/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

保存rhel-source.repo文件后:

#yum make clean all
#yum makecache

然后运行下#yum update,大功告成。

参考文章:http://blog.csdn.net/wangchangshuai0010/article/details/50547828
http://www.360doc.com/content/12/0716/18/5907545_224580529.shtml

你可能感兴趣的:(yum,red,hat)