redhat删除默认源,使用163源

说明:
redhat的yum在线更新是收费的,如果没有注册的话是不能使用的。可以将redhat自带的yum卸载重新rpm安装,再配置其他第三方源。第三方源包括:网易,epel,repoforge ,rpmfusion。后面试了下,不必要卸载原来的yum,可以直接跳到第4步,修改rhel-debuginfo.repo也可以使用。

实现:
1.删除redhat原有的yum。

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

 
2.下载yum源安装包,如果下载时找不到文件,就登录到:http://mirrors.163.com/centos/6/os/x86_64/上查找相应的文件下载。

# cd /usr/local/src
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-3.2.29-30.el6.centos.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
# wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm

我这里是RHEL 6 64位的,因此如下安装。RHEL 5,6可以参考附录1:CentOS 5,6 yum包(32位对应32位安装包,64位对应64位安装包)
 
3.进行安装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-30.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm  //注意最后两个包必需同时安装,否则会相互依赖

 
4.更新repo文件,配置为163网易源

# mv /etc/yum.repos.d/rhel-debuginfo.repo /etc/yum.repos.d/rhel-debuginfo.repo.repo.bak  //备份源文件
# wget  http://mirrors.163.com/.help/CentOS6-Base-163.repo
# vi CentOS6-Base-163.repo  //编辑文件,把文件里面的$releasever全部替换为版本号,本系统为cat /etc/issue Red Hat Enterprise Linux Server release 6.0,所以将$releasever全部替换为6后保存!

 
当然,手动输入以下内容也是可以的

# 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-6 - Base - 163.com
baseurl=http://mirrors.163.com/centos/6/os/$basearch/
#mirrorlist=http://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6

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

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

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

 
5.测试yum是否可用

# yum clean all   //清理yum缓存
# yum makecache   //将服务器上的软件包信息缓存到本地,以提高搜索安装软件的速度
# yum info vsftd  //测试yum是否可用

 
附录:
附录1:CentOS 5,6 yum包(32位对应32位安装包,64位对应64位安装包)
CentOS5
32位版的:
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-metadata-parser-1.1.2-4.el5.i386.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/i386/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
64位版的:
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/python-iniparse-0.2.3-6.el5.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-3.2.22-40.el5.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-4.el5.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpm
CentOS6
32位版的:
wget http://mirrors.ustc.edu.cn/centos/6/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/i386/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.i686.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
64位版的:
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-3.2.29-40.el6.centos.noarch.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
wget http://mirrors.ustc.edu.cn/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

发表评论

邮箱地址不会被公开。 必填项已用*标注