轉自:http://blog.csdn.net/huangbiao86/article/details/6646471shell
Yum配置文件位於/etc/yum.conf和/etc/yum.repos.d/CentOS-Base.repo目錄下緩存
使用yum時注意:必須使用root身份來執行yum;yum配置文件內的鏡像站點必須能與本身進行網絡鏈接;鏡像站點越近,帶寬越大越好,方便下載。網絡
[root@localhost ~]# yum [options] COMMAND 軟件架構
List of Commands:ide
install:Install a package or packages on your systemui
update:Update a package or packages on your systemthis
remove:移出某個軟件,後跟軟件名稱spa
search:Search package details for the given string 搜索某個軟件或重要關鍵字.net
list:List a package or groups of packages列出yum所管理的軟件名稱與版本,相似於rpm –qadebug
info:Display details about a package or group of packages,相似於rpm –qai
clean:Remove cached data 下載文件被放置在/var/cache/yum中,能夠使用clean清除。
check-update:Check for available package updates
Groupinfo:Display details about a package group
groupinstall Install the packages in a group on your system
grouplist:List available package groups
groupremove:Remove the packages in a group from your system
groupupdate:升級整個軟件羣組
help:Display a helpful usage message
Deplist:List a package's dependencies 列出軟件包的依賴關係,在使用本地源軟件包進行安裝時,能夠查看依賴關係
Downgrade:downgrade a package
Erase:Remove a package or packages from your system
localinstall:Install a local RPM安裝本地的rpm軟件包
makecache:Generate the metadata cache 生成數據緩存
provides:Find what package provides the given value 找到包提供的給定值
reinstall:reinstall a package 重裝軟件包
repolist:Display the configured software repositories
resolvedep:Determine which package provides the given dependency
shell:Run an interactive yum shell
upgrade:Update packages taking obsoletes into account
-y:answer yes for all questions當yum詢問用戶意見時,主動回答yes不需由鍵盤輸入
-installroot=[path]:set install root安裝在其餘的路徑,而再也不當前目錄樹的架構中
-h --help:show this help message and exit
-t --tolerant:be tolerant of errors
-C:run entirely from cache, don't update cache
-c:[config file]config file location
-R [minutes] maximum command wait time
-d [debug level] debugging output level
-showduplicates show duplicates, in repos, in list/search commands
-e [error level] error output level
-q, --quiet quiet operation
-v, --verbose verbose operation
-version show Yum version and exit
-enablerepo=[repo] enable one or more repositories (wildcards allowed)
-disablerepo=[repo] disable one or more repositories (wildcards allowed)
-x[package], --exclude=[package]exclude package(s) by name or glob
-disableexcludes=[repo]disable exclude from main, for a repo or for everything
-obsoletes:enable obsoletes processing during updates
-noplugins:disable Yum plugins
-nogpgcheck:disable gpg signature checking
-disableplugin=[plugin] disable plugins by name
-enableplugin=[plugin] enable plugins by name
-skip-broken:skip packages with depsolving problems
-color=COLOR: control whether color is used
[root@localhost ~]# yum search gcc 查找主機上是否有gcc的相關軟件,若是有,就會陳列出來。
[root@localhost ~]# yum info gcc 列出已安裝的yum所管理的軟件名稱與版本
……………………………………………………………………
Name:gcc
Arch:i386
Version: 4.1.2
Release: 48.el5
Size:9.6 M
Repo:installed
Summary:各種編譯器(C、C++、Objective-C、Java, ...)
URL:http://gcc.gnu.org
License:GPL
Description:The gcc package contains the GNU Compiler Collection version 4.1.You'll need this package in order to compile c code
……………………………………………………………………
顯示該軟件版本名稱,數據大小,軟件出處等信息。須要注意summary和description的信息
能夠依據yum search 軟件名查找此軟件的信息,yum list軟件名 列出此軟件的版本和名稱,決定是否安裝此軟件。
安裝以前使用rpm –q 軟件名,查看此軟件是否安裝,如沒有安裝,使用yum install 軟件名 進行安裝
使用yum能夠主動處理好依賴關係,下載好的軟件通常都放置在/var/cache/yum中,能夠清除以節省磁盤空間。
[root@localhost ~]# yum clean packages #清除下載的軟件包
[root@localhost ~]# yum -y update #手動系統更新