All operations are under the root user and the system version is Linux7.0 x86_64:
First, delete the original Yum
# rpm-aq|grep Yum|xargs rpm-e--nodeps
Second, download Yum, pay attention to your Linux system version, what version is in the relevant version of the directory to download. But the small version of the directory is not in. If the version is 6.5, just enter the 6 directory, the version is 7.2, just into the 7 directory.
Open the browser, login http://mirrors.163.com/centos/7/os/x86_64/Packages/, find four files, as follows: (* symbol for the minor version, different versions)
1, yum-*.rpm
2, yum-metadata-parser-*.rpm
3, yum-plugin-fastestmirror-*.rpm
4, python-iniparse-*.rpm
Download using wget:
# wget http://mirrors.163.com/centos/7/os/i386/Packages/yum-3.2.29-60.el6.centos.noarch.rpm
# wget http://mirrors.163.com/centos/7/os/i386/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
# wget http://mirrors.163.com/centos/7/os/i386/Packages/yum-plugin-fastestmirror-1.1.30-30.el6.noarch.rpm
# wget http://mirrors.163.com/centos/7/os/i386/Packages/python-iniparse-0.3.1-2.1.el6.noarch.rpm
Third, after downloading, install Yum
Because of the interdependence of files, it is necessary to install the python-iniparse-*.rpm file, and then install the other three files, so that the error will not be
# RPM-IVH python-iniparse-0.3.1-2.1.el6.noarch.rpm
# RPM-IVH yum-*.rpm yum-metadata-parser-*.rpm yum-plugin-fastestmirror-*.rpm
Note: Rpm-ivh to install RPM--nodeps--force (plus--nodeps--force for compelling installation, regardless of dependency file)
After the installation, you can use the RM command to delete the RPM files in the current directory (it is useless to load).
Iv. Modification of source documents
1. Enter the directory under the system Yum Source:
#cd/ETC/YUM.REPOS.D
2. Download Yum Source:
#wget Http://mirrors.163.com/.help/CentOS7-Base-163.repo
3. Modify the repo Source: replace the $releasever in the file with 7 (7 refers to the Linux version)
#vi Centos6-base-163.repo
Note: After opening the file, press I to enter modify mode, press ESC when finished, and then press: Wq Save exit (: q! Yes No save exit)
4, renamed as Default repo
#mv Centos7-base-163.repo Centos7-base.repo (This step can be done without doing)
V. Run Makecache Generate cache
#yum Makecache
Run Yum clean all (equivalent to Yum cleanheaders; Yum cleanpackages);
#yum Clean All
Vii. Updating yum files
#yum Update
Article Source: http://blog.csdn.net/delphi1234/article/details/51546798
Re-install Yum under Linux7