Yum相关

Posted by wsxq2 on 2018-11-07
TAGS:  yumTODO

本文最后一次编辑时间:2021-08-07 17:33:20 +0800

遇到过的问题

yum 命令

yum provides

In general, you can search for what package provides a command using the yum provides command:

1
sudo yum provides '*bin/nslookup'

事实上,只要知道该包的某个文件的路径即可:

1
yum provides */X11/extensions/Xrandr.h

详情参见Nslookup: command not found error on RHEL/CentOS 7

yum history

使用回滚彻底删除安装的依赖包:

1
2
yum history list <package>
yum history undo <ID>

关于 RPM 文件

事实上,对于 RPM 文件,除了可以直接使用rpm -i命令进行安装,还可以使用yum install命令安装。使用 yum 的好处是能自动处理依赖关系。例如:

1
2
3
4
root@wsxq21:~/shadowsocks-libev/rpm/RPMS/x86_64# rpm -i *.rpm
错误:依赖检测失败:
        zsh 被 shadowsocks-libev-zsh-completion-3.3.0-1.21.gite3c6c80.el7.x86_64 需要
root@wsxq21:~/shadowsocks-libev/rpm/RPMS/x86_64#

而使用 yum 则不然:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
root@wsxq21:~/shadowsocks-libev/rpm/RPMS/x86_64# yum install *.rpm
已加载插件:fastestmirror
正在检查 libshadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm: libshadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64
libshadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm 将被安装
正在检查 libshadowsocks-libev-devel-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm: libshadowsocks-libev-devel-3.3.0-1.21.gite3c6c80.el7.x86_64
libshadowsocks-libev-devel-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm 将被安装
正在检查 shadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm: shadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64
shadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm 将被安装
正在检查 shadowsocks-libev-debuginfo-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm: shadowsocks-libev-debuginfo-3.3.0-1.21.gite3c6c80.el7.x86_64
shadowsocks-libev-debuginfo-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm 将被安装
正在检查 shadowsocks-libev-zsh-completion-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm: shadowsocks-libev-zsh-completion-3.3.0-1.21.gite3c6c80.el7.x86_64
shadowsocks-libev-zsh-completion-3.3.0-1.21.gite3c6c80.el7.x86_64.rpm 将被安装
正在解决依赖关系
--> 正在检查事务
---> 软件包 libshadowsocks-libev.x86_64.0.3.3.0-1.21.gite3c6c80.el7 将被 安装
---> 软件包 libshadowsocks-libev-devel.x86_64.0.3.3.0-1.21.gite3c6c80.el7 将被 安装
---> 软件包 shadowsocks-libev.x86_64.0.3.3.0-1.21.gite3c6c80.el7 将被 安装
---> 软件包 shadowsocks-libev-debuginfo.x86_64.0.3.3.0-1.21.gite3c6c80.el7 将被 安装
---> 软件包 shadowsocks-libev-zsh-completion.x86_64.0.3.3.0-1.21.gite3c6c80.el7 将被 安装
--> 正在处理依赖关系 zsh,它被软件包 shadowsocks-libev-zsh-completion-3.3.0-1.21.gite3c6c80.el7.x86_64 需要
Loading mirror speeds from cached hostfile
 * base: repos.lax.quadranet.com
 * elrepo-kernel: repos.lax-noc.com
 * epel: d2lzkl7pfhq30w.cloudfront.net
 * extras: repos.lax.quadranet.com
 * updates: repos.lax.quadranet.com
--> 正在检查事务
---> 软件包 zsh.x86_64.0.5.0.2-31.el7 将被 安装
--> 解决依赖关系完成

依赖关系解决

==============================================================================================================================================================================================
 Package                                      架构               版本                                    源                                                                              大小
==============================================================================================================================================================================================
正在安装:
 libshadowsocks-libev                         x86_64             3.3.0-1.21.gite3c6c80.el7               /libshadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64                         212 k
 libshadowsocks-libev-devel                   x86_64             3.3.0-1.21.gite3c6c80.el7               /libshadowsocks-libev-devel-3.3.0-1.21.gite3c6c80.el7.x86_64                   4.4 k
 shadowsocks-libev                            x86_64             3.3.0-1.21.gite3c6c80.el7               /shadowsocks-libev-3.3.0-1.21.gite3c6c80.el7.x86_64                            846 k
 shadowsocks-libev-debuginfo                  x86_64             3.3.0-1.21.gite3c6c80.el7               /shadowsocks-libev-debuginfo-3.3.0-1.21.gite3c6c80.el7.x86_64                  4.0 M
 shadowsocks-libev-zsh-completion             x86_64             3.3.0-1.21.gite3c6c80.el7               /shadowsocks-libev-zsh-completion-3.3.0-1.21.gite3c6c80.el7.x86_64             5.7 k
为依赖而安装:
 zsh                                          x86_64             5.0.2-31.el7                            base                                                                           2.4 M

事务概要
==============================================================================================================================================================================================
安装  5 软件包 (+1 依赖软件包)

总计:7.4 M
总下载量:2.4 M
安装大小:11 M
Is this ok [y/d/N]:

可供 CentOS 使用的软件库

参见 zh/AdditionalResources/Repositories - CentOS Wiki

由于使用其它软件库可能导致系统不稳定(比如atomic),因此官方建议正常情况下不要使用其它库:

1
2
sed -i 's/enabled *= *1/enabled=0/' /etc/yum.repos.d/epel.repo
sed -i 's/enabled *= *1/enabled=0/' /etc/yum.repos.d/atomic.repo

epel

安装方法;

1
yum install epel-release

atomic

安装方法;

1
wget -O - http://updates.atomicorp.com/installers/atomic |sh

链接

下面总结了本文中使用的所有链接: