1. First look at the Yum packages installed by the Redhat 7.0 system itself:
Rpm-qa | grep Yum #列出所有已安装的yum包
2. Delete these packages:
Rpm-e *.rpm--nodeps #删除所有以前的yum包
3. Download the new Yum RPM package: (2016/12/8 the latest version of RPM, if 404 Not Found error, enter the URL yourself, replace the latest RPM package name)
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-3.4.3-132.el7.centos.0.1.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-utils-1.1.31-34.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-updateonboot-1.1.31-34.el7.noarch.rpm
wget http://mirrors.163.com/centos/7/os/x86_64/Packages/yum-plugin-fastestmirror-1.1.31-34.el7.noarch.rpm
4. Install the downloaded RPM package:
RPM-IVH yum-*
5. Configuration Centos-base.repo: (2016/12/8 latest Source URL configuration)
Vim/etc/yum.repos.d/centos-base.repo
[Base]
name=centos-7-base
baseurl=http://mirrors.sohu.com/centos/7/os/x86_64/
gpgcheck=1
# Released updates
[updates]
name=centos-7-updates
baseurl=http://mirrors.163.com/centos/7/updates/x86_ 64/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-7
#packages used/produced in the Build but not released
[addons]
name=centos-7-addons
baseurl=http://mirrors.163.com/centos/7/sclo/x86_64 /sclo/
gpgcheck=1
gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-7
#additional packages that may be useful
[extras]
name=centos-7-Extras
baseurl=http://mirrors.163.com/centos/7/extras/x86_64/
G Pgcheck=1
Gpgkey=http://mirrors.163.com/centos/rpm-gpg-key-centos-7
#additional packages that extend Functionality of existing packages
[Centosplus]
name=centos-7-Plus
Baseurl=http://mirrors.163.com/centos /7/centosplus/x86_64/
Gpgcheck=1
enabled=0
6.yum Source Configuration Complete:
Yum Clean All
7. Test if Yum is successful:
Yum Update python
Error: You have enabled checking of packages via GPG keys. This is a good thing. However, you don't have the any GPG public keys installed. You need to download the keys for packages you wish to install and install them. You can do this by running the command.
RPM--import Public.gpg.key
.........
After checking, it is key error, the solution is:
cd/etc/pki/rpm-gpg/
LS #列出所有密钥
Import the key ending with release
RPM--import Prm-gpg-key-redhat-legacy-release
8. After testing, Yum succeeds:
Yum Update python #顺利使用yum
Rhel 7.0 Configuration CentOS Yum Source (2016/12/8), Success!