RHEL6 uses CentOS yum Source
1. Uninstall the yum source that comes with RHEL6
rpm-qa|
grep
yum|
xargs
rpm-e--nodeps
2. Download the corresponding installation package
#wget
http:
//mirror
.centos.org
/centos-6/6
.5
/os/x86_64/Packages/python-iniparse-0
.3.1-2.1.el6.noarch.rpm
#wget
http:
//mirror
.centos.org
/centos-6/6
.5
/os/x86_64/Packages/yum-3
.2.29-40.el6.centos.noarch.rpm
#wget
http:
//mirror
.centos.org
/centos-6/6
.5
/os/x86_64/Packages/yum-plugin-fastestmirror-1
.1.30-14.el6.noarch.rpm
#wget
http:
//mirror
.centos.org
/centos-6/6
.5
/os/x86_64/Packages/yum-metadata-parser-1
.1.2-16.el6.x86_64.rpm
3. install the software package
#rpm-ivhpython-iniparse-0.3.1-2.1.el6.noarch.rpm
#rpm-ivhyum-metadata-parser-1.1.2-16.el6.x86_64.rpm
#rpm-ivhyum-3.2.29-40.el6.centos.noarch.rpmyum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm
4. configure a new yum Source
#cd/etc/yum.repos.d/
#wgethttp://mirrors.163.com/.help/CentOS6-Base-163.repo
# ViCentOS6-Base-163.repo # editing files
Replace all $ releasever in the file with the version number, that is, 6 is saved!
[base]
name=CentOS-6-Base-163.com
baseurl=http:
//mirrors
.163.com
/centos/6/os/
$basearch/
gpgcheck=1
gpgkey=http:
//mirror
.centos.org
/centos/RPM-GPG-KEY-CentOS-6
[updates]
name=CentOS-6-Updates-163.com
baseurl=http:
//mirrors
.163.com
/centos/6/updates/
$basearch/
gpgcheck=1
gpgkey=http:
//mirror
.centos.org
/centos/RPM-GPG-KEY-CentOS-6
[extras]
name=CentOS-6-Extras-163.com
baseurl=http:
//mirrors
.163.com
/centos/6/extras/
$basearch/
gpgcheck=1
gpgkey=http:
//mirror
.centos.org
/centos/RPM-GPG-KEY-CentOS-6
[centosplus]
name=CentOS-6-Plus-163.com
baseurl=http:
//mirrors
.163.com
/centos/6/centosplus/
$basearch/
gpgcheck=1
enabled=0
gpgkey=http:
//mirror
.centos.org
/centos/RPM-GPG-KEY-CentOS-6
[contrib]
name=CentOS-6-Contrib-163.com
baseurl=http:
//mirrors
.163.com
/centos/6/contrib/
$basearch/
gpgcheck=1
enabled=0
gpgkey=http:
//mirror
.centos.org
/centos/RPM-GPG-KEY-CentOS-6
5. The error message is as follows:
#yummakecache
TherewasaproblemimportingoneofthePythonmodules
requiredtorunyum.Theerrorleadingtothisproblemwas:
Nomodulenamedyum
Please
install
apackage
which
providesthismodule,or
verifythatthemoduleisinstalledcorrectly.
It
'spossiblethattheabovemoduledoesn'
tmatchthe
currentversionofPython,
which
is:
2.6.1(r261:67515,Oct82014,19:20:42)
[GCC4.4.620120305(RedHat4.4.6-4)]
Ifyoucannotsolvethisproblemyourself,pleasegoto
theyumfaqat:
The error message is related to the python version.
[root@rhel63~]
#whereispython
python:
/usr/bin/python2
.6
/usr/bin/python2
.6-config
/usr/bin/python
/usr/bin/python
.old
/usr/lib/python2
.6
/usr/lib64/python2
.6
/usr/include/python2
.6
/usr/local/python2
.6
/usr/share/man/man1/python
.1.gz
[root@rhel63~]
#whichyum
/usr/bin/yum
Set"
#! /Usr/bin/python2.6 "to" #! /Usr/bin/python2.6"