1、背景说明
刀片服务器GEN9无法通过引导方式安装CentOS,只能进行RHEL的安装。而RHEL上的yum源只能注册账户才能使用,故需要进行yum源替换
2、步骤
1、删除rhel自带的yum源
rpm -qa|grep yum|xargs rpm -e --nodeps
rpm -qa |grep yum
2、下载新的yum安装包
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-3.2.29-69.el6.centos.noarch.rpm####
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
注意:很多网上提供的镜像源中所涉及的
yum-3.2.29-69.el6.centos.noarch.rpm此安装包已经没有了
mirrors中提供的包为
yum-3.2.29-81.el6.centos.noarch.rpm
如果对次yum安装包进行下载安装的话,它会依赖于一些Python的包,
python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-81.el6.centos.noarch
python版本需要为2.7以上,并不是自带的版本
所以这里我单独去下载了一个就版本,实测是可以的
我使用的版本为:yum-3.2.29-30.el6.noarch.rpm
3、安装yum包,有依赖关系,三个一起安装
rpm -ivh yum-3.2.29-30.el6.noarch.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rpm
warning: yum-3.2.29-30.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID fd431d51: NOKEY
warning: yum-metadata-parser-1.1.2-16.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:yum-metadata-parser ########################################### [ 33%]
2:yum ########################################### [ 67%]
3:yum-plugin-fastestmirro########################################### [100%]
4、将rhel自带的yum仓库文件移走
yum.repos.d]# mkdir bak
yum.repos.d]# mv mirrors-rpmforge* bak/
yum.repos.d]# mv rh* bak/
yum.repos.d]# ls
bak epel.repo packagekit-media.repo
CentOS6-Base-163.repo epel-testing.repo rpmforge.repo
yum.repos.d]# mv packagekit-media.repo bak/
5、更改163的yum源
yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
--2017-04-11 02:23:41-- http://mirrors.163.com/.help/CentOS6-Base-163.repo
Resolving mirrors.163.com... 123.58.173.185, 123.58.173.186
Connecting to mirrors.163.com|123.58.173.185|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2006 (2.0K) [application/octet-stream]
Saving to: “CentOS6-Base-163.repo”
100%[================================================>] 2,006 --.-K/s in 0s
2017-04-11 02:23:41 (219 MB/s) - “CentOS6-Base-163.repo” saved [2006/2006]
替换$releaserver全部替换为版本号
yum.repos.d]# sed -i 's#$releasever#6#g' CentOS6-Base-163.repo
6、yum仓库确认
yum.repos.d]# yum repolist
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Loading mirror speeds from cached hostfile
repo id repo name status
base CentOS-6 - Base - 163.com 6,706
extras CentOS-6 - Extras - 163.com 64
updates CentOS-6 - Updates - 163.com 32
repolist: 6,802
更多YUM相关教程见以下内容:
RHEL7 本地yum源配置 http://www.linuxidc.com/Linux/2017-01/139140.htm
CentOS 7 使用阿里云的yum源、PIP源 http://www.linuxidc.com/Linux/2017-01/13966.htm
CentOS及Red Hat Linux安装yum源 http://www.linuxidc.com/Linux/2017-02/140205.htm
CentOS 7更改yum源与更新系统 http://www.linuxidc.com/Linux/2017-01/140067.htm
RedHat7.0配置本地yum源 http://www.linuxidc.com/Linux/2017-01/139148.htm
RedHat Linux 7安装CentOS 7 yum源 http://www.linuxidc.com/Linux/2017-04/142444.htm
软件包管理之前端管理工具yum http://www.linuxidc.com/Linux/2017-02/140270.htm
CentOS 7 使用阿里云的yum源、PIP源 http://www.linuxidc.com/Linux/2017-01/13966.htm
本文永久更新链接地址:http://www.linuxidc.com/Linux/2017-04/142746.htm