yum命令:安装撤销、定位软件包

撤销安装的(软件包+依赖)主要有两步
用http做例子:

[root@MiWiFi-R4A-srv ~]# yum -y install httpd
......
Install  1 Package (+4 Dependent packages)   ##1个软件包+4个依赖包。
......
Complete!

①查看yum命令的安装记录(查看操作ID):

[root@MiWiFi-R4A-srv ~]# yum history
Loaded plugins: fastestmirror
ID     | Login user               | Date and time    | Action(s)      | Altered(改变的)
-------------------------------------------------------------------------------
     2 | root <root>              | 2020-03-15 02:54 | Install        |    5   ##这条就是安装http的记录。
     1 | System <unset>           | 2020-03-14 05:38 | Install        |  301
history list

②撤销ID为2的软件包及依赖的安装:

[root@MiWiFi-R4A-srv ~]# yum -y history undo 2(undo:解除,解除安装的意思。)
Loaded plugins: fastestmirror
Undoing transaction 2, from Sun Mar 15 02:54:48 2020
    Dep-Install apr-1.4.8-5.el7.x86_64                 @base
    Dep-Install apr-util-1.5.2-6.el7.x86_64            @base
    Install     httpd-2.4.6-90.el7.centos.x86_64       @base
    Dep-Install httpd-tools-2.4.6-90.el7.centos.x86_64 @base
    Dep-Install mailcap-2.1.41-2.el7.noarch            @base
Resolving Dependencies
......
Removed:
  apr.x86_64 0:1.4.8-5.el7  apr-util.x86_64 0:1.5.2-6.el7    httpd.x86_64 0:2.4.6-90.el7.centos
  httpd-tools.x86_64 0:2.4.6-90.el7.centos   mailcap.noarch 0:2.1.41-2.el7
##撤销了五个包。
Complete!

定位软件包,有两个办法,search命令和provides命令。例如查找fdisk命令的软件包:
search命令比较常用,如下:

[root@MiWiFi-R4A-srv ~]# yum search fdisk
N/S matched: fdisk 
gdisk.x86_64 : An fdisk-like partitioning tool for GPT disks

[root@MiWiFi-R4A-srv ~]# yum info gdisk.x86_64
Name        : gdisk
Arch        : x86_64
Version     : 0.8.10
Release     : 3.el7
Size        : 190 k
Repo        : base/7/x86_64
Summary     : An fdisk-like partitioning tool for GPT disks
URL         : http://www.rodsbooks.com/gdisk/
License     : GPLv2
Description : An fdisk-like partitioning tool for GPT disks. GPT fdisk features a
            : command-line interface, fairly direct manipulation of partition table
            : structures, recovery tools to help you deal with corrupt partition
            : tables, and the ability to convert MBR disks to GPT format.
##search命令的范围就是软件面板,主要搜索的是Name和Description(软件包说明)。
##没有installed,显然不是这个包。

provides命令搜索的范围比较小,但有点特别:

[root@MiWiFi-R4A-srv ~]# yum provides fdisk
util-linux-2.23.2-61.el7.i686 : A collection of basic system utilities
Repo        : base
Matched from:
Filename    : /usr/sbin/fdisk

util-linux-2.23.2-61.el7.x86_64 : A collection of basic system utilities
Repo        : base
Matched from:
Filename    : /usr/sbin/fdisk
##这个范围就是Filename,可以理解为安装目录或者软件包命令再或者可执行文件也行。主要看你怎样理解的Linux命令。
##比如我们执行fdisk /dev/sda1命令,你可以这样[root@MiWiFi-R4A-srv ~]# /usr/sbin/fdisk /dev/sda1或者这
##样[root@MiWiFi-R4A-srv ~]# fdisk /dev/sda1都能执行。

搜索的时候用上通配符,搜索结果可能会更精确。

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值