yum 报错处理

有时候,咱们可能进行一些非正常操做,致使服务器上的 yum 命令没法正常使用,如今,总结一下常见 yum 报错python

一、以下图的报错数据库

图片.png

出现该错误,看似莫名其妙,可是别急,解决办法仍是有的。bash

解决方案:服务器

该错误是rpm数据库损坏引发的,既然是rpm数据库损坏,那咱们重建rpm数据库不就OK了。ide

[root@yum-depot ~]# cd /var/lib/rpm
[root@yum-depot rpm]# ll
总用量 88996
-rw-r--r--. 1 root root  2215936 12月 19 09:59 Basenames
-rw-r--r--. 1 root root    8192 12月 19 09:59 Conflictname
-rw-r--r--  1 root root   286720 12月 19 10:56 __db.001
-rw-r--r--  1 root root   90112 12月 19 10:56 __db.002
-rw-r--r--  1 root root  1318912 12月 19 10:56 __db.003
-rw-r--r--. 1 root root   610304 12月 19 09:59 Dirnames
-rw-r--r--. 1 root root   16384 12月 19 09:59 Group
-rw-r--r--. 1 root root   16384 12月 19 09:59 Installtid
-rw-r--r--. 1 root root   32768 12月 19 09:59 Name
-rw-r--r--. 1 root root   16384 12月 18 19:17 Obsoletename
-rw-r--r--. 1 root root  84570112 12月 19 09:59 Packages
-rw-r--r--. 1 root root  1814528 12月 19 09:59 Providename
-rw-r--r--. 1 root root   163840 12月 19 09:59 Requirename
-rw-r--r--. 1 root root   49152 12月 19 09:59 Sha1header
-rw-r--r--. 1 root root   36864 12月 19 09:59 Sigmd5
-rw-r--r--. 1 root root    8192 12月 18 19:17 Triggername
[root@yum-depot rpm]# rm -rf __db.00*
[root@yum-depot rpm]# rpm --rebuilddb
[root@yum-depot rpm]# yum clean all
[root@yum-depot rpm]# yum makecache

二、以下图相似的报错工具

图片.png

出现该报错的缘由是咱们对系统自带的 python 进行升级致使的,咱们知道,yum 工具是由python语言写成的,因此,咱们在进行系统升级的时候,若是升级了python,就会出现这个问题,那么如何解决呢?ui

解决方案:blog

卸载咱们升级后的 python 和 yum图片

从Centos源镜像包中拷贝 python 和 rpm 包,而后在强制安装,安装完后可解决。md5

三、yum安装一些软件包时报错“Error: xz compression not available”

解决办法:

[root@yum-depot ~]# rm -fr /var/cache/yum/x86_64/6/epel/
[root@yum-depot ~]# rm -rf /etc/yum.repos.d/epel*
从新安装epel源和base源
[root@yum-depot ~]# wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@yum-depot ~]# wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@yum-depot ~]# yum repolist
相关文章
相关标签/搜索