1,下载最新的yum-3.2.28.tar.gz并解压
#wget http://yum.baseurl.org/download/3.2/yum-3.2.28.tar.gz
#tar xvf yum-3.2.28.tar.gz
2,进入目录,运行安装
#cd yum-3.2.28
#./yummain.py install yum
如果提示错误: CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/
是缺少配置文件。在etc目录下面新建yum.conf文件,然后再次运行 yummain.py install yum,顺利完成安装。
3,最后更新系统
#yum check-update
#yum update
#yum clean all
所报错误
----------------------------------------------------------------------------------------------------------------------
yummain.py install yum 不能运行的原因 yummain.py not found、
[[email protected] ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-urlgrabber-3.9.1-8.el6.noarch.rpm
[[email protected] ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/python-pycurl-7.19.0-8.el6.x86_64.rpm
[[email protected] ~] wget http://tel.mirrors.163.com/centos/6/os/x86_64/Packages/yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
[[email protected] ~] 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: [[email protected] 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: [[email protected] 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配置文件
[[email protected] ~] touch /etc/yum.conf
注:如果不创建yum.conf的话,下面运行./yummain.py install yum的话会报以下错误:
[[email protected] yum-3.4.3]# ./yummain.py CRITICAL:yum.cli:Config Error: Error accessing file for config file:///etc/yum.conf
下载yum源码包并安装
[[email protected] ~] wget http://yum.baseurl.org/download/3.4/yum-3.4.3.tar.gz
解压源码包[[email protected] ~] tar zxvf yum-3.4.3.tar.gz
编译安装yum[[email protected] ~] cd yum-3.4.3
[[email protected] 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已经安装成功了。