Catalog
Check and delete the original yum source
Download the yum source for CentOS
Because red hat's Yum needs to be charged and registered before it can be used. So I want to update the yum source to CentOS. The red hat version used is 6.9, so the corresponding CentOS version should also be 6.9
-
Check and delete the original yum source
rpm -qa | grep yum rpm -qa|grep yum|xargs rpm -e --nodeps
-
Download the yum source for CentOS
Accessible from Ali cloud,NetEase Wait for the website to download the corresponding version of yum source.
After entering the above website, click version / OS / x86 ﹐ 64 / packages to see the software list. Then search yum and download the following three rpm packages.
Note: the version number in the filename may be different due to different system versions
Because some versions of the website do not provide the corresponding software package download, the 6.9 version of rpm package download is provided here.
https://pan.baidu.com/s/1pfkdZLpoVC6pisqjcJjsMg Extraction code: bjbi
There are four files in the package of Baidu online disk:
CentOS6-Base-163.repo python-iniparse-0.3.1-2.1.el6.noarch python-urlgrabber-3.9.1-11.el6.noarch yum-3.2.29-81.el6.centos.noarch yum-metadata-parser-1.1.2-16.el6.x86_64 yum-plugin-fastestmirror-1.1.30-40.el6.noarch
-
Install RPM package
rpm -ivh yum*.rpm rpm -qa | grep yum
-
yum configuration
Back up the original yum configuration directory
mv /etc/yum.repos.d /etc/yum.repos.d.bak
Create a new directory yum.repos.d, and download the repo file of the corresponding version of CentOS and put it in it
Create a new directory yum.repos.d in / etc /
mkdir yum.repos.d
-
Modify yum configuration
Open the previously downloaded repo file, and replace all $releasers with the corresponding version number.
Note: 6.9 can be replaced by 6 directly
Open vim, shift +: enter the following command to replace
%S / $releaser / Version / g
Here's the replacement
# 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://mirrorlist.centos.org/?release=6&arch=$basearch&repo=os gpgcheck=1 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6 #released updates [updates] name=CentOS-6 - Updates - 163.com baseurl=http://mirrors.163.com/centos/6/updates/$basearch/ #mirrorlist=http://mirrorlist.centos.org/?release=6&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=6&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=6&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=6&arch=$basearch&repo=contrib gpgcheck=1 enabled=0 gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-6
-
Clean up and rebuild cache
yum clean all yum makecache fast