centos7 of redhat7 How to uninstall native yum and install domestic yum sources

  • 2020-06-19 12:19:15
  • OfStack

The update package of redhat only takes effect for registered users, so we manually changed the update package of CentOS. CentOS is almost the same as redhat, so there is no need to worry about whether the package can be installed or whether there are problems after installation.

1. Check whether the yum package is installed


rpm -qa |grep yum

2. Delete the yum package that comes with redhat


rpm -qa|grep yum|xargs rpm -e --nodeps Do not check the dependency, just delete rpm Package) 

3. Download yum 163 installation package


wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-iniparse-0.4-9.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/python-urlgrabber-3.10-8.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-150.el7.centos.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-metadata-parser-1.1.4-10.el7.x86_64.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-40.el7.noarch.rpm

4. Install yum


rpm -ivh *.rpm

There are issues with dependent packages, and you may have problems with python package installation conflicts. Therefore, the following two parameters can be added to force installation:

force forces the installation even if it overwrites files belonging to other packages If the installation of this RPM package depends on other packages, force the installation even if no other package is installed.

5. Change the address of yum library. Here we use our own yum library, such as netease's CentOS mirror source


cd /etc/yum.repos.d/
wget http://mirrors.163.com/.help/CentOS6-Base-163.repo

6. Replace $releasever in CentOS6-ES37en-163.repo with 7, and the 6 keyword with 7

7. Settings take effect


yum clean all # Clean up the yum Cache to make the Settings take effect 
yum makecache # Cache the package information on the server locally , To speed up the search for installed software 

Related articles: