查看安装的yum
[root@omr ~]# yum –version
3.2.29
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: rpm-4.8.0-37.el6.x86_64 at 2017-03-26 07:01
Built : Red Hat, Inc. http://bugzilla.redhat.com/bugzilla at 2013-09-12 10:55
Committed: Panu Matilainen pmatilai@redhat.com at 2013-09-12
Installed: subscription-manager-1.9.11-1.el6.x86_64 at 2017-03-26 07:03
Built : Red Hat, Inc. http://bugzilla.redhat.com/bugzilla at 2013-10-16 20:52
Committed: jesus m. rodriguez jesusr@redhat.com at 2013-10-16
Installed: yum-3.2.29-40.el6.noarch at 2017-03-26 07:01
Built : Red Hat, Inc. http://bugzilla.redhat.com/bugzilla at 2013-01-08 17:02
Committed: James Antill james.antill@redhat.com at 2013-01-08
卸载yum
[root@omr ~]# rpm -aq|grep yum|xargs rpm -e –nodeps
[root@omr yum_install]# yum
-bash: /usr/bin/yum: No such file or directory
下载安装所需rpm包
python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-urlgrabber-3.9.1-11.el6.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
yum-3.2.29-73.el6.centos.noarch.rpm
安装yum
[root@omr yum_install]# rpm -ivh python-iniparse-0.3.1-2.1.el6.noarch.rpm
warning: python-iniparse-0.3.1-2.1.el6.noarch.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
Preparing… ########################################### [100%]
package python-iniparse-0.3.1-2.1.el6.noarch is already installed
[root@omr yum_install]# rpm -ivh yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
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 ########################################### [100%]
这两个rpm包要同时安装
[root@omr yum_install]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
error: Failed dependencies:
python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-73.el6.centos.noarch
提示python-urlgrabber版本不兼容先卸载后安装
[root@omr yum_install]# rpm -qa | grep python-urlgrabber
python-urlgrabber-3.9.1-9.el6.noarch
[root@omr yum_install]# rpm -e python-urlgrabber-3.9.1-9.el6.noarch
[root@omr yum_install]# rpm -qa | grep python-urlgrabber
[root@omr yum_install]# rpm -ivh python-urlgrabber-3.9.1-11.el6.noarch.rpm
warning: python-urlgrabber-3.9.1-11.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing… ########################################### [100%]
1:python-urlgrabber ########################################### [100%]
[root@omr yum_install]# rpm -qa | grep python-urlgrabber
python-urlgrabber-3.9.1-11.el6.noarch
然后再次执行安装yum
[root@omr yum_install]# rpm -ivh yum-3.2.29-73.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-37.el6.noarch.rpm
warning: yum-3.2.29-73.el6.centos.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing… ########################################### [100%]
1:yum-plugin-fastestmirro########################################### [ 50%]
2:yum ########################################### [100%]
[root@omr yum_install]#
ps.中间50%是正常的
卸载订阅内容
[root@omr yum_install]# yum makecache
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Metadata Cache Created
依然提示需要订阅
[root@omr yum_install]# yum –version
3.2.29
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Installed: rpm-4.8.0-37.el6.x86_64 at 2017-03-26 07:01
Built : Red Hat, Inc. http://bugzilla.redhat.com/bugzilla at 2013-09-12 10:55
Committed: Panu Matilainen pmatilai@redhat.com at 2013-09-12
Installed: subscription-manager-1.9.11-1.el6.x86_64 at 2017-03-26 07:03
Built : Red Hat, Inc. http://bugzilla.redhat.com/bugzilla at 2013-10-16 20:52
Committed: jesus m. rodriguez jesusr@redhat.com at 2013-10-16
Installed: yum-3.2.29-73.el6.centos.noarch at 2017-03-26 09:47
Built : CentOS BuildSystem http://bugs.centos.org at 2016-05-11 20:37
Committed: Johnny Hughes johnny@centos.org at 2016-05-10
Installed: yum-plugin-fastestmirror-1.1.30-37.el6.noarch at 2017-03-26 09:47
Built : CentOS BuildSystem http://bugs.centos.org at 2016-05-10 21:04
Committed: Valentina Mukhamedzhanova vmukhame@redhat.com at 2016-02-10
发现还有一个subscription-manager
进行卸载
[root@omr yum_install]# rpm -qa | grep subscription-manager
subscription-manager-gui-1.9.11-1.el6.x86_64
subscription-manager-firstboot-1.9.11-1.el6.x86_64
subscription-manager-1.9.11-1.el6.x86_64
[root@omr yum_install]# rpm -e subscription-manager-gui-1.9.11-1.el6.x86_64 subscription-manager-firstboot-1.9.11-1.el6.x86_64 subscription-manager-1.9.11-1.el6.x86_64
再次查看
[root@omr yum_install]# yum –version
3.2.29
Installed: rpm-4.8.0-37.el6.x86_64 at 2017-03-26 07:01
Built : Red Hat, Inc. http://bugzilla.redhat.com/bugzilla at 2013-09-12 10:55
Committed: Panu Matilainen pmatilai@redhat.com at 2013-09-12
Installed: yum-3.2.29-73.el6.centos.noarch at 2017-03-26 09:47
Built : CentOS BuildSystem http://bugs.centos.org at 2016-05-11 20:37
Committed: Johnny Hughes johnny@centos.org at 2016-05-10
Installed: yum-plugin-fastestmirror-1.1.30-37.el6.noarch at 2017-03-26 09:47
Built : CentOS BuildSystem http://bugs.centos.org at 2016-05-10 21:04
Committed: Valentina Mukhamedzhanova vmukhame@redhat.com at 2016-02-10
进行yum源配置重命名原yum源安装新yum源
[root@omr yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
–2017-03-26 17:53:11– 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-03-26 17:53:11 (60.9 MB/s) – “CentOS6-Base-163.repo” saved [2006/2006]
配置163源
将文档中 $releasever 替换成6
建立缓存
[root@omr yum.repos.d]# yum clean all
[root@omr yum.repos.d]# yum makecache
重新安装rpm
[root@omr yum.repos.d]# yum update rpm
检查版本
[root@omr yum.repos.d]# yum –version
3.2.29
Installed: rpm-4.8.0-55.el6.x86_64 at 2017-03-26 09:59
Built : CentOS BuildSystem http://bugs.centos.org at 2016-05-10 23:49
Committed: Lubos Kardos lkardos@redhat.com at 2016-03-29
Installed: yum-3.2.29-73.el6.centos.noarch at 2017-03-26 09:47
Built : CentOS BuildSystem http://bugs.centos.org at 2016-05-11 20:37
Committed: Johnny Hughes johnny@centos.org at 2016-05-10
Installed: yum-plugin-fastestmirror-1.1.30-37.el6.noarch at 2017-03-26 09:47
Built : CentOS BuildSystem http://bugs.centos.org at 2016-05-10 21:04
Committed: Valentina Mukhamedzhanova vmukhame@redhat.com at 2016-02-10
此处为163源
# 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://amirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
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/
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&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=$releasever&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=$releasever&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=$releasever&arch=$basearch&repo=contrib
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6