yum源——This system is not registered to Red Hat Subscription Management

 

 

一、起因:This system is not registered with an entitlement server. You can use subscription-manager to register.

[root@localhost yum.repos.d]# yum install -y apr* autoconf automake bison bzip2 bzip2* compat* cpp curl curl-devel fontconfig fontconfig-devel freetype freetype* freetype-devel gcc gcc-c++ gd gettext gettext-devel glibc kernel kernel-headers keyutils keyutils-libs-devel krb5-devel libcom_err-devel libpng libpng-devel libjpeg* libsepol-devel libselinux-devel libstdc++-devel libtool* libgomp libxml2 libxml2-devel libXpm* libtiff libtiff* make mpfr ncurses* ntp openssl openssl-devel patch pcre-devel perl php-common php-gd policycoreutils telnet t1lib t1lib* nasm nasm* wget zlib-devel
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
              : manager
This system is not registered with an entitlement server. You can use subscription-manager to register.

 

二、查看并卸载RedHat7自带已安装的yum

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

 

三、使用国内CenOS7的yum包来代替使用

国内的镜像地址:http://mirrors.163.com/cenos/

 

 

 

 

 下载以下rpm最新版本(截止到2020年4月8日)

[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-163.el7.centos.noarch.rpm^C
[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm
[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
[root@localhost yum.repos.d]# wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-9.el7.noarch.rpm

安装所有的rpm包(最后2个rpm包要一起安装!)

[root@localhost yum.repos.d]# rpm -ivh yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
[root@localhost yum.repos.d]# rpm -ivh python-iniparse-0.4-9.el7.noarch.rpm
[root@localhost yum.repos.d]# rpm -ivh python-urlgrabber-3.10-9.el7.noarch.rpm
[root@localhost yum.repos.d]# rpm -ivh yum-3.4.3-163.el7.centos.noarch.rpm  yum-plugin-fastestmirror-1.1.31-52.el7.noarch.rpm

 

四、备份已有的repo文件

[root@localhost yum.repos.d]# pwd
[root@localhost yum.repos.d]# mv /etc/yum.repos.d/  /etc/yum.repos.d.backup

 

五、下载CentOS7相应的repo文件

[root@localhost yum.repos.d]#  wget http://mirrors.163.com/.help/CentOS7-Base-163.repo

#替换文件中的$releasever为版本号7
[root@rhel-server yum.repos.d]# vim CentOS7-Base-163.repo

#可以使用全文替换:
:1,$s/$releasever/7

 

六、清空并重建yum缓存

[root@localhost yum.repos.d]# yum clean all
[root@localhost yum.repos.d]# yum makecache

 

posted @ 2020-04-08 17:23  3月の狮子  阅读(962)  评论(0编辑  收藏  举报