文章出處:http://blog.csdn.net/rachel_luo/article/details/8692744
yum (Yellowdog Updater Modified)是一個集與查找,安裝,更新和刪除程序的Linux軟件。它運行在RPM包兼容的Linux發行版本上,如:RedHat,
Fedora, SUSE, CentOS, Mandriva。
1.another app is currently holding the yum lock;waiting for it to exit...
則輸入:#rm -f /var/run/yum.pid ,然後就可以使用yum了。
2.yum 安裝軟件時,報錯:No package XXX available.
[root@localhost ~]# yum -y install redisLoaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* addons: mirrors.163.com
* base: mirrors.163.com
* extras: mirrors.163.com
* updates: mirrors.163.com
Setting up Install Process
No package redis available.
Nothing to do
解決方法:
1).先去更新一下yum倉庫:
#yum -y update
2).如果還是不行,可能是你安裝的時候包名不夠詳細,可以通過yum的查找參數來列出對應軟件的相關包名,拿vim的安裝爲例:
# yum search vimLoaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.hosting90.cz
* extras: mirror.hosting90.cz
* updates: mirror.hosting90.cz
===================== Matched: vim ===================
vim-X11.x86_64 : The VIM version of the vi editor for the X Window System.
vim-common.x86_64 : The common files needed by any version of the VIM editor.
vim-enhanced.x86_64 : A version of the VIM editor which includes recent
: enhancements.
vim-minimal.x86_64 : A minimal version of the VIM editor.
找到包名後,執行以下命令即可:
#yum -y install vim-enhanced.x86_64以上命令就能執行成功了。
其他程序也同樣可以先進行yum查找,再通過匹配詳細包名來進行安裝,就不會出現上述錯誤了。
具體原因:使用yum搜索某些rpm包,找不到包是因爲CentOS是RedHat企業版編譯過來的,去掉了所有關於版權問題的東西。安裝EPEL後可以很好的解決這個問題。EPEL(Extra Packages for Enterprise Linux )即企業版Linux的擴展包,提供了很多可共Centos使用的組件,安裝完這個以後基本常用的rpm都可以找到。
下載與安裝EPEL的rpm文件包
1.下載:
#wget http://mirrors.ustc.edu.cn/fedora/epel/5/i386/epel-release-5-4.noarch.rpm
2.安裝:
#rpm -ivh epel-release-5-4.noarch.rpm
安裝完畢後,可以使用yum安裝軟件。
注意:
1. epel的版本要與centos的版本相對應,否則安裝失敗,即centos5版本要對應epel5版本。
2. rpm安裝完後,rpm -ql epel*,確提示未安裝,此時要導入rpm的簽名信息
#rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 (root身份執行)
本來用得好好的yum命令,突然不能用了,報出:Segmentation fault (段錯誤)。
通過一番查找,原因終於找到:是有人在服務器上安裝了新版本的zlib包,正巧我執行過”#yum clean all”命令。
解決辦法:
#vi /etc/ld.so.conf,註釋掉對應的行:/usr/local/zlib/lib
#ldconfig
#yum update
yum完全恢復正常。
說明:yum使用的是老版本的 zlib 庫。如果有用戶再一次清除了 yum 緩存,那麼再使用yum安裝軟件時依然會報段錯誤。
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
Could not retrieve mirrorlist http://mirrorlist.centos.org/?release=6&arch=x86_64&repo=os error was
14: PYCURL ERROR 6 - "Couldn't resolve host 'mirrorlist.centos.org'"
Error: Cannot find a valid baseurl for repo: base
原因是:DNS未配置好;解決方案:重新配置DNS;
#vi /etc/resolv.conf
編輯文件內容爲:
search localdomain
nameserver 202.101.172.35
nameserver 202.101.172.47
保存並退出;
#service network restart
重啓網卡。