使用yum时报错 This system is not registered to Red Hat Subscription Management
错误原因:使用redhat的yum源是需要注册付费的。
1、卸载RedHat自带的yum包
查看已安装的yum
rpm -qa|grep yum
#卸载已安装的yum
rpm -qa | grep yum | xargs rpm -e --nodeps
#再次查看已安装的yum
rpm -qa|grep yum
2.使用国内新的centos的yum包替换redhat自带的
地址如下:
http://mirrors.163.com/centos/
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-81.el6.centos.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-11.el6.noarch.rpm
wget http://mirrors.163.com/centos/6/os/x86_64/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
接着就是分别安装几个包:
[root@upright package]# 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@upright package]# 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@upright package]# 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%]
#这2个rpm要一起装!!!
[root@rhel-server download]#rpm -ivh yum-3.2.29-81.el6.centos.noarch.rpm yum-plugin-fastestmirror-1.1.30-40.el6.noarch.rp
当出现报错:
python-urlgrabber >= 3.9.1-10 is needed by yum-3.2.29-81.el6.centos.noarch
发现错误,python-urlgrabber版本必须大于等于3.9.1-10
查看
[root@upright package]# rpm -qa|grep python-url
python-urlgrabber-3.9.1-9.el6.noarch
卸载
[root@upright package]# rpm -e python-urlgrabber-3.9.1-9.el6.noarch
重新安装
[root@upright package]# rpm -ivh yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm yum-3.2.29-81.el6.centos.noarch.rpm
warning: yum-plugin-fastestmirror-1.1.30-41.el6.noarch.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
Preparing... ########################################### [100%]
1:yum ########################################### [ 50%]
2:yum-plugin-fastestmirro########################################### [100%]
3.下载163的repo文件
[root@upright yum.repos.d]# wget http://mirrors.163.com/.help/CentOS6-Base-163.repo
--2019-04-10 02:24:58-- http://mirrors.163.com/.help/CentOS6-Base-163.repo
Resolving mirrors.163.com... 59.111.0.251
Connecting to mirrors.163.com|59.111.0.251|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 2006 (2.0K) [application/octet-stream]
Saving to: a€?CentOS6-Base-163.repoa€?
100%[================================================>] 2,006 --.-K/s in 0s
2019-04-10 02:24:59 (234 MB/s) - a€?CentOS6-Base-163.repoa€? saved [2006/2006]
[root@upright yum.repos.d]# ll
total 20
drwxr-xr-x. 2 root root 4096 Apr 10 01:33 bk
-rw-r--r--. 1 root root 1856 Apr 10 02:27 CentOS6-Base-163.repo
drwxr-xr-x. 2 root root 4096 Apr 10 02:01 package
-rw-r--r--. 1 root root 358 Apr 10 02:28 redhat.repo
-rw-r--r--. 1 root root 406 Apr 10 01:46 redhat.repo.bk
替换文件中的$releasever为版本号6
[root@rhel-server yum.repos.d]# vim CentOS6-Base-163.repo
使用全文替换:
:1,$s/$releasever/6
运行以下命令生成缓存
yum clean all
yum makecache
[root@upright yum.repos.d]# yum clean all
Loaded plugins: fastestmirror, product-id, subscription-manager
This system is not registered to Red Hat Subscription Management. You can use subscription-manager to register.
Cleaning repos: base extras updates
Cleaning up Everything
[root@upright yum.repos.d]# 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.
Determining fastest mirrors
base | 3.7 kB 00:00
base/group_gz | 242 kB 00:00
base/filelists_db | 6.4 MB 00:01
base/primary_db | 4.7 MB 00:01
base/other_db | 2.8 MB 00:00
extras | 3.4 kB 00:00
extras/filelists_db | 24 kB 00:00
extras/prestodelta | 2.2 kB 00:00
extras/primary_db | 29 kB 00:00
extras/other_db | 14 kB 00:00
updates | 3.4 kB 00:00
updates/filelists_db | 2.7 MB 00:01
updates/prestodelta | 138 kB 00:00
updates/primary_db | 3.7 MB 00:00
updates/other_db | 193 kB 00:00
Metadata Cache Created