天天看點

yum指令常用參數詳解

yum是一個用于管理rpm包的背景程式,用python寫成,可以非常友善的解決rpm的依賴關系。在建立好yum伺服器後,yum用戶端可以通過​​http​​、ftp方式獲得軟體包,并使用友善的指令直接管理、更新所有的rpm包,甚至包括kernel的更新。現在把常用的yum指令參數整理如下:

一、列舉封包件

列出資源庫中所有可以安裝或更新的rpm包

# yum list

列出資源庫中特定的可以安裝或更新以及已經安裝的rpm包

# yum list perl //列出名為perl 的包

# yum list perl* //列出perl 開頭的包

列出資源庫中所有可以更新的rpm包

# yum list updates

列出已經安裝的所有的rpm包

# yum list installed

列出已經安裝的但是不包含在資源庫中的rpm包

# yum list extras

注:extras是repos.d中定義的資源清單名稱

二、列舉資源資訊

列出資源庫中所有可以安裝或更新的rpm包的資訊

# yum info

列出資源庫中特定的可以安裝或更新以及已經安裝的rpm包的資訊

# yum info perl //列出perl 包資訊

# yum info perl* //列出perl 開頭的所有包的資訊

列出資源庫中所有可以更新的rpm包的資訊

# yum info updates

列出已經安裝的所有的rpm包的資訊

# yum info installed

列出已經安裝的但是不包含在資源庫中的rpm包的資訊

# yum info extras

三、搜尋

搜尋比對特定字元的rpm包

# yum search perl //在包名稱、包描述等中搜尋

搜尋有包含特定檔案名的rpm包

# yum provides realplay

四、管理包

安裝rpm包

# yum install perl //安裝perl 包

# yum install perl* //安裝perl 開頭的包

删除rpm包,包括與該包有倚賴性的包

# yum remove perl* //會删除perl-* 所有包

軟體組管理

# yum groupinstall “Chinese Support” //安裝指定的組

# yum groupupdate “Chinese Support” //安裝了的組成員軟體包更新

# yum grouplist “Chinese Support” //安裝了的組和可以安裝的組一覽顯示

# yum groupremove “Chinese Support” //删除指定的組

# yum groupinfo “Chinese Support” //指定組所包含的軟體包顯示

五、更新

檢查可更新的rpm包

# yum check-update

更新所有的rpm包

# yum update

更新指定的rpm包,如更新kernel和kernel source

# yum update kernel kernel-source

大規模的版本更新,與yum update不同的是,連舊的淘汰的包也更新

# yum upgrade

六、清空緩存

清除暫存中rpm封包件

# yum clean packages

清除暫存中rpm頭檔案

# yum clearn headers