Yum命令解析

Yum配置文件位于/etc/yum.conf和/etc/yum.repos.d/CentOS-Base.repo目錄下

使用yum時(shí)注意:必須使用root身份來(lái)執(zhí)行yum;yum配置文件內(nèi)的鏡像站點(diǎn)必須能與自己進(jìn)行網(wǎng)絡(luò)連接;鏡像站點(diǎn)越近,帶寬越大越好,方便下載。

[root@localhost ~]# yum [options] COMMAND 軟件

List of Commands:

install:Install a package or packages on your system

update:Update a package or packages on your system

remove:移出某個(gè)軟件,后跟軟件名稱

search:Search package details for the given string 搜索某個(gè)軟件或重要關(guān)鍵字

list:List a package or groups of packages列出yum所管理的軟件名稱與版本,類似于rpm –qa

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:升級(jí)整個(gè)軟件群組

help:Display a helpful usage message

Deplist:List a package's dependencies 列出軟件包的依賴關(guān)系,在使用本地源軟件包進(jìn)行安裝時(shí),可以查看依賴關(guān)系

Downgrade:downgrade a package

Erase:Remove a package or packages from your system

localinstall:Install a local RPM安裝本地的rpm軟件包

makecache:Generate the metadata cache 生成數(shù)據(jù)緩存

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當(dāng)yum詢問(wèn)用戶意見時(shí),主動(dòng)回答yes不需由鍵盤輸入

-installroot=[path]:set install root安裝在其他的路徑,而不再當(dāng)前目錄樹的架構(gòu)中

-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 查找主機(jī)上是否有g(shù)cc的相關(guān)軟件,如果有,就會(huì)陳列出來(lái)。

[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

……………………………………………………………………

顯示該軟件版本名稱,數(shù)據(jù)大小,軟件出處等信息。需要注意summary和description的信息

可以依據(jù)yum search 軟件名查找此軟件的信息,yum list軟件名 列出此軟件的版本和名稱,決定是否安裝此軟件。

安裝之前使用rpm –q 軟件名,查看此軟件是否安裝,如沒(méi)有安裝,使用yum install 軟件名 進(jìn)行安裝

使用yum可以主動(dòng)處理好依賴關(guān)系,下載好的軟件一般都放置在/var/cache/yum中,可以清除以節(jié)省磁盤空間。

  • [root@localhost ~]# yum clean packages #清除下載的軟件包

  • [root@localhost ~]# yum -y update #手動(dòng)系統(tǒng)更新

?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
【社區(qū)內(nèi)容提示】社區(qū)部分內(nèi)容疑似由AI輔助生成,瀏覽時(shí)請(qǐng)結(jié)合常識(shí)與多方信息審慎甄別。
平臺(tái)聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點(diǎn),簡(jiǎn)書系信息發(fā)布平臺(tái),僅提供信息存儲(chǔ)服務(wù)。

相關(guān)閱讀更多精彩內(nèi)容

友情鏈接更多精彩內(nèi)容