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
相關文章
相關標籤/搜索