[Linux]常用命令之【YUM】
阿新 • • 發佈:2021-07-13
YUM的簡介
- 什麼是yum源?
Yum(全稱為 Yellow dog Updater, Modified)是一個在Fedora、RedHat/RHEL、SUSE以及CentOS等Linux發行版中的/repo/【Shell】前端【軟體包管理器】。
yum源 := yum倉庫 := yum管理下的軟體源/軟體倉庫
怎麼生動地理解這一點呢?
yum 類同於 CENTOS作業系統的 軟體管理器;Web前端開發的 npm 包(依賴)管理軟體;Java後端開發的 maven 包(依賴)管理軟體。
值得注意的是,CENTOS 8新增了 DNF
包管理器,以取代之前OS版本的 YUM。
2 YUM的常用命令
檢視幫助資訊
檢視幫助資訊[方式1] --> man yum
man yum
檢視幫助資訊[方式2] --> yum --help
yum --help [root@node116 repo]# yum --help Loaded plugins: fastestmirror, langpacks Usage: yum [options] COMMAND List of Commands: check Check for problems in the rpmdb check-update Check for available package updates clean Remove cached data deplist List a package's dependencies distribution-synchronization Synchronize installed packages to the latest available versions downgrade downgrade a package erase Remove a package or packages from your system fs Acts on the filesystem data of the host, mainly for removing docs/lanuages for minimal hosts. fssnapshot Creates filesystem snapshots, or lists/deletes current snapshots. groups Display, or use, the groups information help Display a helpful usage message history Display, or use, the transaction history info Display details about a package or group of packages install Install a package or packages on your system langavailable Check available languages langinfo List languages information langinstall Install appropriate language packs for a language langlist List installed languages langremove Remove installed language packs for a language list List a package or groups of packages load-transaction load a saved transaction from filename makecache Generate the metadata cache provides Find what package provides the given value reinstall reinstall a package repo-pkgs Treat a repo. as a group of packages, so we can install/remove all of them repolist Display the configured software repositories search Search package details for the given string shell Run an interactive yum shell swap Simple way to swap packages, instead of using shell update Update a package or packages on your system update-minimal Works like upgrade, but goes to the 'newest' package match which fixes a problem that affects your system updateinfo Acts on repository update information upgrade Update packages taking obsoletes into account version Display a version for the machine and/or available repos. Options: -h, --help show this help message and exit -t, --tolerant be tolerant of errors -C, --cacheonly run entirely from system cache, don't update cache -c [config file], --config=[config file] config file location -R [minutes], --randomwait=[minutes] maximum command wait time -d [debug level], --debuglevel=[debug level] debugging output level --showduplicates show duplicates, in repos, in list/search commands -e [error level], --errorlevel=[error level] error output level --rpmverbosity=[debug level name] debugging output level for rpm -q, --quiet quiet operation -v, --verbose verbose operation -y, --assumeyes answer yes for all questions --assumeno answer no for all questions --version show Yum version and exit --installroot=[path] set install root --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 --disableincludes=[repo] disable includepkgs 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 --releasever=RELEASEVER set value of $releasever in yum config and repo files --downloadonly don't update, just download --downloaddir=DLDIR specifies an alternate directory to store packages --setopt=SETOPTS set arbitrary config and repo options --bugfix Include bugfix relevant packages, in updates --security Include security relevant packages, in updates --advisory=ADVS, --advisories=ADVS Include packages needed to fix the given advisory, in updates --bzs=BZS Include packages needed to fix the given BZ, in updates --cves=CVES Include packages needed to fix the given CVE, in updates --sec-severity=SEVS, --secseverity=SEVS Include security relevant packages matching the severity, in updates Plugin Options:
檢視 當前主機配置的yum源(軟體倉庫)列表
yum repolist
yum repolist enabled
# 列出你當前系統【已啟用】的yum repo
重建 yum 軟體源的快取
在更新yum源或者出現配置yum源之後,通常都會使用yum makecache 生成快取。
把伺服器的rpm軟體包資訊提前下載到本地主機快取起來,用來提高搜尋安裝軟體的速度
以後用install時就在快取中搜索,提高了速度。
yum makecache
yum makecache fast
yum makecache all
更新 yum 源
yum update -y --skip-broken
清除 yum 軟體源的快取
yum 會把下載的軟體包和header儲存在cache中而不自動刪除。如果覺得佔用磁碟空間,可以使用yum clean指令清除快取。
yum clean all
搜尋軟體包
yum search 軟體包
yum -C search "關鍵詞"
安裝軟體包
yum install 軟體包
yum -y install httpd
yum localinstall /path/*.rpm
# 通過yum管理器,安裝本地rpm包
解除安裝/移除軟體包
yum remove 軟體包名
X 參考文獻
- [Linux]CentOS7搭建/配置:YUM倉庫/源[本地源/Web源(Apache HTTP(D))/自建源倉庫] - CSDN 【推薦】
- yum makecache fast 和yum clean all - CSDN
本文連結: https://www.cnblogs.com/johnnyzen
關於博文:評論和私信會在第一時間回覆,或直接私信我。
版權宣告:本部落格所有文章除特別宣告外,均採用 BY-NC-SA 許可協議。轉載請註明出處!
聲援博主:若本文對您有幫助,可點選右下角【推薦】一下。您的鼓勵、【讚賞】(左側讚賞支付碼)是博主技術寫作的重要動力!