redhat6.8配置yum源-飞外

一般安装好redhat后,不能注册的话,不能使用系统自带的yum源。但是我们可以自己配置yum源来解决这一问题。下面介绍下redhat配置163yum源。

1. 检查是否安装yum包

rpm -qa |grep yum

2. 删除自带的yum包

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

因为一些包之间可能会有依赖关系,所以我们需要加上参数 --nodeps 无视依赖关系。

3. yum包

Yum包地址http://mirrors.163.com/centos/

在这个网站里,你可以自己选择需要的文件,进入形如5/或者6/的文件,其他的无法。 (rpm 版本会更新)

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-73.el6.centos.noarch.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpmwget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm 

4. 解压yum包

rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm

rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm

rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm

5. 替换yum源

cd /etc/yum.repos.d/wget http://mirrors.163.com/.help/CentOS6-Base-163.repovi CentOS6-Base-163.repo

注意原来的yum源配置文件是rhel-source.repo。这里把CentOS6-Base-163.repo替换掉rhel-source.repo。

mv rhel-source.repo rhel-source.repo.bakmv CentOS6-Base-163.repo rhel-source.repo

6. 编辑替换后的rhel-source.repo。

#rhel-source.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.