[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-8.el6.noarch.rpm
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-pycurl-7.19.0-8.el6.x86_64.rpm
[root@akinlau ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[root@akinlau ~] rpm -ivh python-urlgrabber-3.9.1-8.el6.noarch.rpm python-pycurl-7.19.0-8.el6.x86_64.rpm yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
如果不安装python-urlgrabber,python-pycurl,yum-metadata-parser这3个包的话,在下面运行./yummain.py install yum的话会报以下错误:
报错如下
如果上述rpm连接失效,请到这里去一个一个的找:http://rpm.pbone.net/
报错1: [root@akinlau yum-3.4.3]# ./yummain.py Traceback (most recent call last): File “./yummain.py”, line 28, in <module> from yum import Errors File “/root/nagios/yum-3.4.3/yum/__init__.py”, line 52, in <module> import config File “/root/nagios/yum-3.4.3/yum/config.py”, line 30, in <module> from parser import ConfigPreProcessor, varReplace File “/root/nagios/yum-3.4.3/yum/parser.py”, line 4, in <module> import urlgrabber ImportError: No module named urlgrabber
报错2: [root@akinlau yum-3.4.3]# ./yummain.py Traceback (most recent call last): File “./yummain.py”, line 28, in <module> from yum import Errors File “/root/nagios/yum-3.4.3/yum/__init__.py”, line 55, in <module> import rpmsack File “/root/nagios/yum-3.4.3/yum/rpmsack.py”, line 38, in <module> import yum.depsolve File “/root/nagios/yum-3.4.3/yum/depsolve.py”, line 30, in <module> from transactioninfo import TransactionMember File “/root/nagios/yum-3.4.3/yum/transactioninfo.py”, line 32, in <module> from sqlitesack import YumAvailablePackageSqlite File “/root/nagios/yum-3.4.3/yum/sqlitesack.py”, line 26, in <module> import yumRepo File “/root/nagios/yum-3.4.3/yum/yumRepo.py”, line 33, in <module> import sqlitecachec ImportError: No module named sqlitecachec
创建yum配置文件
[root@akinlau ~] touch /etc/yum.conf
注:如果不创建yum.conf的话,下面运行./yummain.py install yum的话会报以下错误:
[root@akinlau yum-3.4.3]# ./yummain.py CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/yum.conf
下载yum源码包并安装
[root@akinlau ~] wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
解压源码包[root@akinlau ~] tar zxvf yum-3.4.3.tar.gz
编译安装yum[root@akinlau ~] cd yum-3.4.3
[root@akinlau yum-3.4.3] ./yummain.py install yum
base | 3.7 kB 00:00
base/primary_db | 4.5 MB 00:07
extras | 3.5 kB 00:00
extras/primary_db | 23 kB 00:03
出现以上提示就证明yum已经安装成功了。
本文转自:风转云溪 之 yummain.py install yum 不能运行的原因 yummain.py not found博文