[Linux]常用命令之【YUM】
1 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的常用命令
2.1 查看帮助信息
查看帮助信息[方式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:
2.2 查看 当前主机配置的yum源(软件仓库)列表
yum repolist
yum repolist enabled
# 列出你当前系统【已启用】的yum repo
2.3 重建 yum 软件源的缓存
在更新yum源或者出现配置yum源之后,通常都会使用yum makecache 生成缓存。
把服务器的rpm软件包信息提前下载到本地主机缓存起来,用来提高搜索安装软件的速度
以后用install时就在缓存中搜索,提高了速度。
yum makecache
yum makecache fast
yum makecache all
2.4 更新 yum 源
yum update -y --skip-broken
2.5 清除 yum 软件源的缓存
yum 会把下载的软件包和header存储在cache中而不自动删除。如果觉得占用磁盘空间,可以使用yum clean指令清除缓存。
yum clean all
2.6 搜索软件包
查看指定软件包的详细信息
[root@govern ~]# yum info libcurl
已加载插件:fastestmirror
Loading mirror speeds from cached hostfile
* c6-media:
file:///media/CentOS/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/CentOS/repodata/repomd.xml
尝试其他镜像。
file:///media/cdrecorder/repodata/repomd.xml: [Errno 14] Could not open/read file:///media/cdrecorder/repodata/repomd.xml
尝试其他镜像。
c6-media | 4.0 kB 00:00 ...
已安装的软件包
Name : libcurl
Arch : x86_64
Version : 7.19.7
Release : 52.el6
Size : 339 k
Repo : installed
From repo : anaconda-CentOS-201605220104.x86_64
Summary : A library for getting files from web servers
URL : http://curl.haxx.se/
License : MIT
Description : This package provides a way for applications to use FTP, HTTP, Gopher and
: other servers for getting files.
可安装的软件包
Name : libcurl
Arch : i686
Version : 7.19.7
Release : 52.el6
Size : 176 k
Repo : c6-media
Summary : A library for getting files from web servers
URL : http://curl.haxx.se/
License : MIT
Description : This package provides a way for applications to use FTP, HTTP, Gopher and
: other servers for getting files.
搜索软件包
yum search 软件包
yum -C search "关键词"
查看包的多个版本
yum list [package] --showduplicates
搜索指定软件的包依赖信息
[root@govern ~]# yum deplist curl
已加载插件:fastestmirror
查找依赖:
Loading mirror speeds from cached hostfile
* c6-media:
软件包:curl.x86_64 7.19.7-52.el6
依赖: libssh2.so.1()(64bit)
provider: libssh2.x86_64 1.4.2-2.el6_7.1
依赖: libz.so.1()(64bit)
provider: zlib.x86_64 1.2.3-29.el6
依赖: libkrb5.so.3()(64bit)
provider: krb5-libs.x86_64 1.10.3-57.el6
依赖: libldap-2.4.so.2()(64bit)
provider: openldap.x86_64 2.4.40-12.el6
依赖: libpthread.so.0()(64bit)
provider: glibc.x86_64 2.12-1.192.el6
依赖: libgssapi_krb5.so.2()(64bit)
provider: krb5-libs.x86_64 1.10.3-57.el6
依赖: libpthread.so.0(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.12-1.192.el6
依赖: libcurl.so.4()(64bit)
provider: libcurl.x86_64 7.19.7-52.el6
依赖: libnssutil3.so()(64bit)
provider: nss-util.x86_64 3.21.0-2.el6
依赖: libk5crypto.so.3()(64bit)
provider: krb5-libs.x86_64 1.10.3-57.el6
依赖: libplc4.so()(64bit)
provider: nspr.x86_64 4.11.0-1.el6
依赖: librt.so.1(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.12-1.192.el6
依赖: libplds4.so()(64bit)
provider: nspr.x86_64 4.11.0-1.el6
依赖: libdl.so.2()(64bit)
provider: glibc.x86_64 2.12-1.192.el6
依赖: libnss3.so()(64bit)
provider: nss.x86_64 3.21.0-8.el6
依赖: libc.so.6(GLIBC_2.7)(64bit)
provider: glibc.x86_64 2.12-1.192.el6
依赖: libcom_err.so.2()(64bit)
provider: libcom_err.x86_64 1.41.12-22.el6
依赖: librt.so.1()(64bit)
provider: glibc.x86_64 2.12-1.192.el6
依赖: libssl3.so()(64bit)
provider: nss.x86_64 3.21.0-8.el6
依赖: libsmime3.so()(64bit)
provider: nss.x86_64 3.21.0-8.el6
依赖: libnspr4.so()(64bit)
provider: nspr.x86_64 4.11.0-1.el6
依赖: libidn.so.11()(64bit)
provider: libidn.x86_64 1.18-2.el6
依赖: rtld(GNU_HASH)
provider: glibc.i686 2.12-1.192.el6
provider: glibc.x86_64 2.12-1.192.el6
依赖: libcurl = 7.19.7-52.el6
provider: libcurl.x86_64 7.19.7-52.el6
provider: libcurl.i686 7.19.7-52.el6
2.7 安装 软件包
yum install 软件包
yum -y install httpd
yum install --downloadonly --downloaddir=[download_dir] [package]
通过此命令来只下载包,但不安装包
yum localinstall /path/*.rpm
# 通过yum管理器,安装本地rpm包
2.8 卸载/移除 软件包
yum remove 软件包名
Y 公网YUM源
CENTOS 官方主页
https://www.centos.org/CENTOS 邮件列表
https://wiki.centos.org/zh/GettingHelp/ListInfoCENTOS 论坛
https://forums.centos.org/CENTOS 文档
https://docs.centos.org/CENTOS Wiki
https://wiki.centos.org/zh/CENTOS 镜像列表
https://www.centos.org/download/mirrors/
阿里云 yum源/镜像站
base
updates
extras
centosplus
contrib
清华 yum源/镜像站
base
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/os/$basearch/
updates
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/updates/$basearch/
extras
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/extras/$basearch/
centosplus
https://mirrors.tuna.tsinghua.edu.cn/centos/$releasever/centosplus/$basearch/
中国科技大学 yum源/镜像站
https://mirrors.ustc.edu.cn/centos/
163 yum源/镜像站
https://mirrors.163.com/centos/
银河麒麟 V10 高级版 OS(基于CENTOS)的YUM源
X 参考文献
- [Linux]CentOS7搭建/配置:YUM仓库/源[本地源/Web源(Apache HTTP(D))/自建源仓库] - 博客园/千千寰宇 【推荐】
- [Linux]CentOS查看RPM包依赖问题 - 博客园/千千寰宇
- yum makecache fast 和yum clean all - CSDN
- http://mirrors.aliyun.com/centos
[Linux]常用命令之【YUM】的更多相关文章
- linux常用命令:yum 命令
用于添加/删除/更新RPM包,自动解决包的依赖问题以及系统更新升级. 1.命令格式: yum [参数] [软件名]2.命令功能: 功能: yum提供了查找.安装.删除某一个.一组甚至全 ...
- Linux常用命令之Yum
Linux Yum命令详解Yum全称Yellow dog Updater,Modified,是一个在Fedora和RedHat以及SUSE中提供的基于RPM包的软件包管理工具,能够从指定的服务器自动下 ...
- linux——常用命令与脚本
linux常用命令 --文件管理pwd --查看当前目录cd --切换当前目录ls --列出当前目录下的所有文件touch --创建文件mkdir --建立目录rmdir --删除空目录rm --删除 ...
- linux 常用命令大全
linux 常用命令大全 系统信息 arch 显示机器的处理器架构(1) uname -m 显示机器的处理器架构(2) uname -r 显示正在使用的内核版本 dmidecode -q 显示硬件系统 ...
- linux常用命令 、查看日志、web排查
linux常用命令 ps aux|grep xxx (比如 ps aux|grep tomcat ps aux|grep tomcat-portalvip ps aux|grep nginx 等) r ...
- Linux常用命令大全(非常全!!!)
Linux常用命令大全(非常全!!!) 最近都在和Linux打交道,感觉还不错.我觉得Linux相比windows比较麻烦的就是很多东西都要用命令来控制,当然,这也是很多人喜欢linux的原因,比较短 ...
- linux 常用命令 和 nginx(反响代理、负载均衡)安装和配置
(1)linux常用命令 [1]在光标前输入内容:i [2]删除输入方式下所输入的文本:Ctrl+u [3]文件保存退出:wq [4]文件不保存退出:q [5]文件强制退出:q! [6]常规删除文件 ...
- Linux常用命令——软件包管理
Linux常用命令--软件包管理 Linux 模块依赖查询网址http://www.rpmfind.net/ ISO挂载 将所需ISO文件添加到虚拟机 建立挂载文件夹mkdir /mnt/cdrom ...
- Linux常用命令——网络命令
Linux常用命令——网络命令 Linux ifconfig 描述:查看设置网络IP 安装命令:yum -y install net-tools 语法:ifconfig 示例:ifconfig et ...
- 【转载】Linux常用命令
Linux常用命令大全(非常全!!!) 转载出处:https://www.cnblogs.com/yjd_hycf_space/p/7730690.html 系统信息 arch 显示机器的处理器架构( ...
随机推荐
- 智利SUBTEL更新WiFi 6技术法规!
2022年9月6日,智利电信监管机构(SUBTEL) 发布了第2844号豁免决议,更新了1985号豁免决议,即短程设备的固定技术标准. 主要更新如下: • 2.4 GHz频段已在医疗设备目录中删除,现 ...
- outlook2013 关闭后不能接收邮件了解决方法
本人装的是2013版的outlook亲测有用,其他版本的本人没试过. 下载KeepOutlookRunning.rar 链接:https://pan.baidu.com/s/1hcNorKDLbpzV ...
- nodejs的框架koa
koa:应用程序是一个包含一组中间件函数的对象,它是按照类似堆栈的方式组织和执行的 应用程序: 1.导入 const Koa = require('koa'); 2.创建koa的app实例 const ...
- 2003031120—廖威—Python数据分析第七周作业—MySQL的安装以及使用
项目 内容 课程班级博客链接 https://edu.cnblogs.com/campus/pexy/20sj 这个作业要求链接 https://edu.cnblogs.com/campus/ ...
- Vue修改
今天做的是一个Vue的修改操作: Vue主要是用来做视图来显示数据的,理解起来的话可能比较困难,学了好几天了,才刚摸到一点头绪,还是需要努力
- pandas(随时更新)
pandas处理一个表中的一列数据被另一个表中的另一列数据替换: df1=pd.DataFrame({'id':[1,2,3],'name':['Andy1','Jacky1','Bruce1']}) ...
- linux 学习之awk
awk 笔记 awk可以截取列 如 ll | awk '{print $3}' 获取第三列内容 参数 -F 指定分隔符 如 ls | wak -F "." '{print $1}' ...
- jmeter 变量的使用
jmeter添加变量 一.添加用户自定义变量 添加用户自定义变量 作用:常用数据参数化.当变量发生变化时,不需要逐个脚本修改,只需要修改用户自定义中的变量就可以了. 变量使用如下图 二.函数助手定义变 ...
- [C++] epoll server实例
// IO多路复用,事件驱动+非阻塞,实现一个线程完成对多个fd的监控和响应,提升CPU利用率 // epoll优点: // 1.select需要每次调用select时拷贝fd,epoll_ctl拷贝 ...
- CSS3之伸缩布局
一 主轴方向 在伸缩布局中, 默认伸缩项是从左至右的排版的 主轴的排版的方向默认就是row, 默认就是从左至右 1.默认情况下主轴是水平方向的, 但是也可以修改为垂直方向.只要看到flex-direc ...