Linux: Switch rhel yum to centos yum and rhelcentos
This system is not registered with RHN when installing software on Red Hat Enterprise Linux Server (RHEL) yum. RHN support will be disabled. red Hat Enterprise Linux Server (RHEL)'s yum service is paid. Because there is no payment, you cannot use yum to install software, for example, if RHEL wants to install LNMP, you must set yum according to this tutorial and install the LNMP one-key installation package after it can be used properly. The following error is prompted: this system is not registered to Red Hat subpartition Management. you can use sub‑manager to register. or the following error message: This system is not registered with RHN. RHN support will be disabled.
Solution:
Run: rpm-qa | grep yum | xargs rpm-e -- nodeps to uninstall yum
Cat/etc/issue & uname-a: Check the system version number and number of digits.
Find the corresponding system version number from the http://mirrors.kernel.org/centos/ or http://mirrors.163.com/centos/
If the system is 5. * 64-bit, open the http://mirrors.kernel.org/centos/5/ OS /x86_64/CentOS/
If the system is 5. * 32-bit, open the http://mirrors.kernel.org/centos/5/ OS /i386/CentOS/
If the system is 6. * 32-bit: http://mirrors.kernel.org/centos/6/ OS /i386/Packages/
If the system is 6. * 32-bit: http://mirrors.kernel.org/centos/6/ OS /i386/Packages/
Find the addresses of the three software packages, yum, yum-fastestmirror, and yum-metadata-parser. Then, run the following command to find the corresponding download file at the preceding URL! The following uses RHEL 5. * 64-bit as an example. The link in the following may change.
wget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-3.2.22-39.el5.centos.noarch.rpmwget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-fastestmirror-1.1.16-21.el5.centos.noarch.rpmwget http://mirrors.kernel.org/centos/5/os/x86_64/CentOS/yum-metadata-parser-1.1.2-3.el5.centos.x86_64.rpm
Download the three software packages and then execute:
Rpm-ivh yum -*
Execute again: (if it is 6. * version, change 5 in the following content to 6, and replace all the $ releasever in the following file with version 5 or 6 before execution .)
cat >/etc/yum.repos.d/CentOS-Base.repo<<eof[base]name=CentOS-$releasever - Basebaseurl=http://mirrors.kernel.org/centos/$releasever/os/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=osgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#released updates [updates]name=CentOS-$releasever - Updatesbaseurl=http://mirrors.kernel.org/centos/$releasever/updates/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updatesgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#packages used/produced in the build but not released[addons]name=CentOS-$releasever - Addonsbaseurl=http://mirrors.kernel.org/centos/$releasever/addons/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=addonsgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#additional packages that may be useful[extras]name=CentOS-$releasever - Extrasbaseurl=http://mirrors.kernel.org/centos/$releasever/extras/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extrasgpgcheck=1gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#additional packages that extend functionality of existing packages[centosplus]name=CentOS-$releasever - Plusbaseurl=http://mirrors.kernel.org/centos/$releasever/centosplus/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=centosplusgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5#contrib - packages by Centos Users[contrib]name=CentOS-$releasever - Contribbaseurl=http://mirrors.kernel.org/centos/$releasever/contrib/$basearch/#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=contribgpgcheck=1enabled=0gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5eof
Note:
1) if it is 7 and there is no addons, you can remove the configuration in the [addons] area.
2) the version number of the gpgkey must be the same as that of the downloaded version.
3) when using the above script, the variable $ releaserver represents the system version number, and $ basearch represents the arch version (for example, x86_64)