1. 程式人生 > 其它 >CentOS 的 YUM安裝時卡死解決方案

CentOS 的 YUM安裝時卡死解決方案

YUM是基於RPM的軟體包管理器
YUM is an RPM-based package manager

補充說明
Supplementary note

yum命令是在Fedora和RedHat以及SUSE中基於rpm的軟體包管理器,它可以使系統管理人員互動和自動化地更新與管理RPM軟體包,能夠從指定的伺服器自動下載RPM包並且安裝,可以自動處理依賴性關係,並且一次安裝所有依賴的軟體包,無須繁瑣地一次次下載、安裝。yum提供了查詢、安裝、刪除某一個、一組甚至全部軟體包的命令,而且命令簡潔而又好記。
The yum command is a rpm-based package manager in Fedora, RedHat and SUSE. It enables system administrators to interactively and automatically update and manage RPM packages. It can automatically download and install RPM packages from a specified server, and can be processed automatically Dependency relationship, and install all dependent software packages at one time, no need to download and install tediously again and again. Yum provides commands to find, install, delete a certain, a group or even all packages, and the commands are concise and easy to remember.
問題:
在使用yum安裝時,卡死並且無法Ctrl+c終止,需要將其殺死才能停止。
如下圖:
When using yum to install, it is stuck and cannot be terminated by Ctrl+c. You need to kill it to stop.

解決辦法:

刪除rpm資料檔案後再重建rpm資料檔案:

Rebuild the rpm data file after deleting the rpm data file:

刪除rpm資料檔案

Delete rpm data file

rm -f /var/lib/rpm/__db.00*

重建rpm資料檔案

Rebuild rpm data file

rpm -vv --rebuilddb

清空快取後再重新快取

Re-cache after clearing the cache

yum clean all 
yum makecache

然後刪除下列兩個檔案就可以了