1、yum
更新于:2024年1月5日
yum命令
目录
[toc]
1、查询
案例:列出所有可用软件包 yum list
这会列出系统中所有可用的软件包,包括已安装和未安装的。
yum list
说明:
#说明:通过yum list输出可以看出,某个软件包是否已安装在机器上:
前面有@代表已安装,无此符号的话就代表没安装;
案例:列出所有可用的软件包及其版本信息 yum list available
这会列出系统中所有可用的软件包及其版本信息,包括已安装和未安装的。
yum list available
- 案例:查看可用的rpm包
# 查看可用的rpm包
yum --disablerepo="*" --enablerepo="elrepo-kernel" list available
案例:查询本地机器已安装的软件包 yum list installed
yum list installed
案例:找出某个特定软件包的详细信息 yum list <package_name>
yum list <package_name>
[root@docker ~]#yum list lrzsz
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* elrepo: hkg.mirror.rackspace.com
* epel: mirror.nju.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
已安装的软件包
lrzsz.x86_64 0.12.20-36.el7 @base
案例:查看某个包的描述信息 yum info <包名>
[root@docker ~]#yum info lrzsz
已加载插件:fastestmirror, langpacks
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* elrepo: hkg.mirror.rackspace.com
* epel: mirror.nju.edu.cn
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
已安装的软件包
名称 :lrzsz
架构 :x86_64
版本 :0.12.20
发布 :36.el7
大小 :181 k
源 :installed
来自源:base
简介 : The lrz and lsz modem communications programs
网址 :http://www.ohse.de/uwe/software/lrzsz.html
协议 : GPLv2+
描述 : Lrzsz (consisting of lrz and lsz) is a cosmetically modified
: zmodem/ymodem/xmodem package built from the public-domain version of
: the rzsz package. Lrzsz was created to provide a working GNU
: copylefted Zmodem solution for Linux systems.
[root@docker ~]#
案例:列出所有可用软件包中包含特定关键字的软件包 yum list *<keyword>*
yum list *<keyword>*
这会列出包含特定关键字的所有可用软件包。替换 <keyword>
为你要搜索的关键字。
案例:查询包依赖和被依赖(已解决)
1、依赖哪些软件包
rpm -qR postfix # 查postfix 依赖哪些包,R参数的意思就是requires就是依赖哪些软件包
或者
yum deplist postfix # 查postfix 依赖哪些包
2、被哪些包依赖
rpm -e --test rpcbind # 通过--test进行测试删除,查看是否有依赖关系,如果有会阻止删除
案例测试:查询包依赖和被依赖
1、我想知道libseccomp
软件包被哪些包依赖?
[root@master1 ~]#rpm -qa | grep libseccomp
libseccomp-2.3.1-4.el7.x86_64
[root@master1 ~]#rpm -e --test libseccomp
error: Failed dependencies:
libseccomp.so.2()(64bit) is needed by (installed) chrony-3.4-1.el7.x86_64
可以看到,libseccomp只有被chrony
对其有依赖。
2、我想知道chrony
依赖的包有哪些?
[root@master1 ~]#rpm -qa|grep chrony
chrony-3.4-1.el7.x86_64
# 方法1:
[root@master1 ~]#rpm -qR chrony
/bin/bash
/bin/sh
/bin/sh
/bin/sh
/bin/sh
/bin/sh
config(chrony) = 3.4-1.el7
libc.so.6()(64bit)
libc.so.6(GLIBC_2.12)(64bit)
libc.so.6(GLIBC_2.14)(64bit)
libc.so.6(GLIBC_2.15)(64bit)
libc.so.6(GLIBC_2.17)(64bit)
libc.so.6(GLIBC_2.2.5)(64bit)
libc.so.6(GLIBC_2.3)(64bit)
libc.so.6(GLIBC_2.3.4)(64bit)
libc.so.6(GLIBC_2.4)(64bit)
libcap.so.2()(64bit)
libedit.so.0()(64bit)
libfreebl3.so()(64bit)
libfreebl3.so(NSSRAWHASH_3.12.3)(64bit)
libm.so.6()(64bit)
libm.so.6(GLIBC_2.2.5)(64bit)
libpthread.so.0()(64bit)
libpthread.so.0(GLIBC_2.2.5)(64bit)
libseccomp.so.2()(64bit)
rpmlib(CompressedFileNames) <= 3.0.4-1
rpmlib(FileDigests) <= 4.6.0-1
rpmlib(PayloadFilesHavePrefix) <= 4.0-1
rtld(GNU_HASH)
shadow-utils
systemd
systemd
systemd
rpmlib(PayloadIsXz) <= 5.2-1
方法2:
[root@master1 ~]#yum deplist chrony
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirrors.aliyun.com
* extras: mirrors.aliyun.com
* updates: mirrors.aliyun.com
package: chrony.x86_64 3.4-1.el7
dependency: /bin/bash
provider: bash.x86_64 4.2.46-35.el7_9
dependency: /bin/sh
provider: bash.x86_64 4.2.46-35.el7_9
dependency: libc.so.6(GLIBC_2.17)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
dependency: libcap.so.2()(64bit)
provider: libcap.x86_64 2.22-11.el7
dependency: libedit.so.0()(64bit)
provider: libedit.x86_64 3.0-12.20121213cvs.el7
dependency: libfreebl3.so()(64bit)
provider: nss-softokn-freebl.x86_64 3.79.0-4.el7_9
dependency: libfreebl3.so(NSSRAWHASH_3.12.3)(64bit)
provider: nss-softokn-freebl.x86_64 3.79.0-4.el7_9
dependency: libm.so.6()(64bit)
provider: glibc.x86_64 2.17-326.el7_9
dependency: libm.so.6(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
dependency: libpthread.so.0()(64bit)
provider: glibc.x86_64 2.17-326.el7_9
dependency: libpthread.so.0(GLIBC_2.2.5)(64bit)
provider: glibc.x86_64 2.17-326.el7_9
dependency: libseccomp.so.2()(64bit)
provider: libseccomp.x86_64 2.3.1-4.el7
dependency: rtld(GNU_HASH)
provider: glibc.x86_64 2.17-326.el7_9
provider: glibc.i686 2.17-326.el7_9
dependency: shadow-utils
provider: shadow-utils.x86_64 2:4.6-5.el7
dependency: systemd
provider: systemd.x86_64 219-78.el7_9.7
案例:处理损坏的包依赖关系
有时在安装多个软件包时,某个包的软件依赖关系可能会被另一个包的安装覆盖掉。这叫作损坏的包依赖关系(broken dependency)。
1.yum clean all
如果系统出现了这个问题,先试试下面的命令:
yum clean all
然后试着用yum命令的update选项。有时,只要清理了放错位置的文件就可以了。