yumコマンド備忘録

# yumコマンドの備忘録

Red Hat Linuxの勉強をしていて、備忘としてyumコマンドを残しておきます。

###### 1. `yum list <name-pattern>`　インストール済もしくはインストール可能なパッケージを表示する

```
[vagrant@rhel8 scratch]$ yum list ansible
Failed to set locale, defaulting to C.UTF-8
2020-06-23 21:42:41,755 [ERROR] yum:5584:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated
Last metadata expiration check: 0:24:17 ago on Tue Jun 23 21:18:25 2020.
Available Packages
ansible.noarch                                                                           2.9.10-1.el8                                                                           epel
```

###### 2. `yum group list`　インストール済もしくはインストール可能なグループを表示する

```
[vagrant@rhel8 scratch]$ yum group list
Failed to set locale, defaulting to C.UTF-8
2020-06-23 21:44:51,462 [ERROR] yum:5587:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated
Last metadata expiration check: 0:26:26 ago on Tue Jun 23 21:18:25 2020.
Available Environment Groups:
   Server with GUI
   Server
   Minimal Install
   Workstation
   KDE Plasma Workspaces
   Custom Operating System
   Virtualization Host
Available Groups:
   Legacy UNIX Compatibility
   Smart Card Support
   RPM Development Tools
   Development Tools
   Headless Management
   Container Management
   .NET Core Development
   System Tools
   Scientific Support
   Security Tools
   Graphical Administration Tools
   Network Servers
   Fedora Packager
   Xfce
```

###### 3. `yum search <keyword>`　キーワードを含むパッケージを検索する

```
[vagrant@rhel8 scratch]$ yum search ansible
Failed to set locale, defaulting to C.UTF-8
2020-06-23 21:45:59,123 [ERROR] yum:5590:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated
Last metadata expiration check: 0:27:34 ago on Tue Jun 23 21:18:25 2020.
======================================================================================= Name Exactly Matched: ansible ========================================================================================
ansible.noarch : SSH-based configuration management, deployment, and task execution system
====================================================================================== Name & Summary Matched: ansible =======================================================================================
ansible-doc.noarch : Documentation for Ansible
=========================================================================================== Name Matched: ansible ============================================================================================
ansible-freeipa.noarch : Roles and playbooks to deploy FreeIPA servers, replicas and clients
========================================================================================== Summary Matched: ansible ==========================================================================================
standard-test-roles.noarch : Standard Test Interface Ansible roles
ara.noarch : Records Ansible playbooks and makes them easier to understand and troubleshoot
python3-ara.noarch : Records Ansible playbooks and makes them easier to understand and troubleshoot
```

###### 4. `yum info <package>`　パッケージの詳細を表示する

```
[vagrant@rhel8 scratch]$ yum info ansible
Failed to set locale, defaulting to C.UTF-8
2020-06-23 21:46:28,002 [ERROR] yum:5594:MainThread @logutil.py:194 - [Errno 13] Permission denied: '/var/log/rhsm/rhsm.log' - Further logging output will be written to stderr
Not root, Subscription Management repositories not updated
Last metadata expiration check: 0:28:03 ago on Tue Jun 23 21:18:25 2020.
Available Packages
Name         : ansible
Version      : 2.9.10
Release      : 1.el8
Architecture : noarch
Size         : 17 M
Source       : ansible-2.9.10-1.el8.src.rpm
Repository   : epel
Summary      : SSH-based configuration management, deployment, and task execution system
URL          : http://ansible.com
License      : GPLv3+
Description  : Ansible is a radically simple model-driven configuration management,
             : multi-node deployment, and remote task execution system. Ansible works
             : over SSH and does not require any software or daemons to be installed
             : on remote nodes. Extension modules can be written in any language and
             : are transferred to managed machines automatically.
```

###### 5. `sudo yum install <package>`　パッケージをインストールする

```
[vagrant@rhel8 scratch]$ sudo yum install ansible
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Last metadata expiration check: 0:22:26 ago on Tue Jun 23 21:25:35 2020.
Dependencies resolved.
==============================================================================================================================================================================================================
 Package                                           Architecture                          Version                                        Repository                                                       Size
==============================================================================================================================================================================================================
Installing:
 ansible                                           noarch                                2.9.10-1.el8                                   epel                                                             17 M
Installing dependencies:
 libsodium                                         x86_64                                1.0.18-2.el8                                   epel                                                            162 k
 python3-babel                                     noarch                                2.5.1-5.el8                                    rhel-8-for-x86_64-appstream-rpms                                4.8 M
 python3-bcrypt                                    x86_64                                3.1.6-2.el8.1                                  epel                                                             44 k
 python3-jinja2                                    noarch                                2.10.1-2.el8_0                                 rhel-8-for-x86_64-appstream-rpms                                538 k
 python3-jmespath                                  noarch                                0.9.0-11.el8                                   rhel-8-for-x86_64-appstream-rpms                                 45 k
 python3-markupsafe                                x86_64                                0.23-19.el8                                    rhel-8-for-x86_64-appstream-rpms                                 39 k
 python3-pyasn1                                    noarch                                0.3.7-6.el8                                    rhel-8-for-x86_64-appstream-rpms                                126 k
 python3-pynacl                                    x86_64                                1.3.0-5.el8                                    epel                                                            100 k
 python3-pytz                                      noarch                                2017.2-9.el8                                   rhel-8-for-x86_64-appstream-rpms                                 54 k
 python3-pyyaml                                    x86_64                                3.12-12.el8                                    rhel-8-for-x86_64-baseos-rpms                                   193 k
 sshpass                                           x86_64                                1.06-9.el8                                     epel                                                             27 k
Installing weak dependencies:
 python3-paramiko                                  noarch                                2.4.3-1.el8                                    epel                                                            289 k

Transaction Summary
==============================================================================================================================================================================================================
Install  13 Packages

Total download size: 24 M
Installed size: 124 M
Is this ok [y/N]: y
Downloading Packages:
(1/13): python3-bcrypt-3.1.6-2.el8.1.x86_64.rpm                                                                                                                                57 kB/s |  44 kB     00:00    
(2/13): libsodium-1.0.18-2.el8.x86_64.rpm                                                                                                                                     118 kB/s | 162 kB     00:01    
(3/13): ansible-2.9.10-1.el8.noarch.rpm                                                                                                                                       7.9 MB/s |  17 MB     00:02    
(4/13): python3-pynacl-1.3.0-5.el8.x86_64.rpm                                                                                                                                 121 kB/s | 100 kB     00:00    
(5/13): python3-pyyaml-3.12-12.el8.x86_64.rpm                                                                                                                                 522 kB/s | 193 kB     00:00    
(6/13): python3-paramiko-2.4.3-1.el8.noarch.rpm                                                                                                                               153 kB/s | 289 kB     00:01    
(7/13): python3-jmespath-0.9.0-11.el8.noarch.rpm                                                                                                                              251 kB/s |  45 kB     00:00    
(8/13): sshpass-1.06-9.el8.x86_64.rpm                                                                                                                                          46 kB/s |  27 kB     00:00    
(9/13): python3-pyasn1-0.3.7-6.el8.noarch.rpm                                                                                                                                 577 kB/s | 126 kB     00:00    
(10/13): python3-pytz-2017.2-9.el8.noarch.rpm                                                                                                                                 163 kB/s |  54 kB     00:00    
(11/13): python3-markupsafe-0.23-19.el8.x86_64.rpm                                                                                                                            113 kB/s |  39 kB     00:00    
(12/13): python3-jinja2-2.10.1-2.el8_0.noarch.rpm                                                                                                                             2.1 MB/s | 538 kB     00:00    
(13/13): python3-babel-2.5.1-5.el8.noarch.rpm                                                                                                                                 6.7 MB/s | 4.8 MB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                         5.0 MB/s |  24 MB     00:04     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                      1/1 
  Installing       : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                                1/13 
  Installing       : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                               2/13 
  Installing       : python3-pyasn1-0.3.7-6.el8.noarch                                                                                                                                                   3/13 
  Installing       : python3-pytz-2017.2-9.el8.noarch                                                                                                                                                    4/13 
  Installing       : python3-babel-2.5.1-5.el8.noarch                                                                                                                                                    5/13 
  Installing       : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                                6/13 
  Installing       : python3-pyyaml-3.12-12.el8.x86_64                                                                                                                                                   7/13 
  Installing       : sshpass-1.06-9.el8.x86_64                                                                                                                                                           8/13 
  Installing       : python3-bcrypt-3.1.6-2.el8.1.x86_64                                                                                                                                                 9/13 
  Installing       : libsodium-1.0.18-2.el8.x86_64                                                                                                                                                      10/13 
  Installing       : python3-pynacl-1.3.0-5.el8.x86_64                                                                                                                                                  11/13 
  Installing       : python3-paramiko-2.4.3-1.el8.noarch                                                                                                                                                12/13 
  Installing       : ansible-2.9.10-1.el8.noarch                                                                                                                                                        13/13 
  Running scriptlet: ansible-2.9.10-1.el8.noarch                                                                                                                                                        13/13 
  Verifying        : ansible-2.9.10-1.el8.noarch                                                                                                                                                         1/13 
  Verifying        : libsodium-1.0.18-2.el8.x86_64                                                                                                                                                       2/13 
  Verifying        : python3-bcrypt-3.1.6-2.el8.1.x86_64                                                                                                                                                 3/13 
  Verifying        : python3-paramiko-2.4.3-1.el8.noarch                                                                                                                                                 4/13 
  Verifying        : python3-pynacl-1.3.0-5.el8.x86_64                                                                                                                                                   5/13 
  Verifying        : sshpass-1.06-9.el8.x86_64                                                                                                                                                           6/13 
  Verifying        : python3-pyyaml-3.12-12.el8.x86_64                                                                                                                                                   7/13 
  Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                                8/13 
  Verifying        : python3-pytz-2017.2-9.el8.noarch                                                                                                                                                    9/13 
  Verifying        : python3-pyasn1-0.3.7-6.el8.noarch                                                                                                                                                  10/13 
  Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                              11/13 
  Verifying        : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                               12/13 
  Verifying        : python3-babel-2.5.1-5.el8.noarch                                                                                                                                                   13/13 
Installed products updated.

Installed:
  ansible-2.9.10-1.el8.noarch              libsodium-1.0.18-2.el8.x86_64             python3-babel-2.5.1-5.el8.noarch        python3-bcrypt-3.1.6-2.el8.1.x86_64     python3-jinja2-2.10.1-2.el8_0.noarch    
  python3-jmespath-0.9.0-11.el8.noarch     python3-markupsafe-0.23-19.el8.x86_64     python3-paramiko-2.4.3-1.el8.noarch     python3-pyasn1-0.3.7-6.el8.noarch       python3-pynacl-1.3.0-5.el8.x86_64       
  python3-pytz-2017.2-9.el8.noarch         python3-pyyaml-3.12-12.el8.x86_64         sshpass-1.06-9.el8.x86_64              

Complete!
```

`Complete!`が表示されたらインストール完了

###### 6. `yum group install <groupname>`　パッケージグループをインストールする

```
[vagrant@rhel8 scratch]$ sudo yum group install "RPM Development Tools"
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Last metadata expiration check: 0:24:38 ago on Tue Jun 23 21:25:35 2020.
Dependencies resolved.
==============================================================================================================================================================================================================
 Package                                       Architecture                           Version                                          Repository                                                        Size
==============================================================================================================================================================================================================
Installing group/module packages:
 rpm-build                                     x86_64                                 4.14.2-37.el8                                    rhel-8-for-x86_64-appstream-rpms                                 171 k
 rpmdevtools                                   noarch                                 8.10-7.el8                                       rhel-8-for-x86_64-appstream-rpms                                  87 k
Installing dependencies:
 elfutils                                      x86_64                                 0.178-7.el8                                      rhel-8-for-x86_64-baseos-rpms                                    540 k
 gc                                            x86_64                                 7.6.4-3.el8                                      rhel-8-for-x86_64-appstream-rpms                                 109 k
 gdb-headless                                  x86_64                                 8.2-11.el8                                       rhel-8-for-x86_64-appstream-rpms                                 3.7 M
 guile                                         x86_64                                 5:2.0.14-7.el8                                   rhel-8-for-x86_64-appstream-rpms                                 3.5 M
 libatomic_ops                                 x86_64                                 7.6.2-3.el8                                      rhel-8-for-x86_64-appstream-rpms                                  38 k
 libbabeltrace                                 x86_64                                 1.5.4-2.el8                                      rhel-8-for-x86_64-appstream-rpms                                 201 k
 libipt                                        x86_64                                 1.6.1-8.el8                                      rhel-8-for-x86_64-appstream-rpms                                  50 k
 libtool-ltdl                                  x86_64                                 2.4.6-25.el8                                     rhel-8-for-x86_64-baseos-rpms                                     58 k
 zstd                                          x86_64                                 1.4.2-2.el8                                      rhel-8-for-x86_64-appstream-rpms                                 385 k
Installing Groups:
 RPM Development Tools                                                                                                                                                                                       

Transaction Summary
==============================================================================================================================================================================================================
Install  11 Packages

Total download size: 8.8 M
Installed size: 29 M
Is this ok [y/N]: y
Downloading Packages:
(1/11): libtool-ltdl-2.4.6-25.el8.x86_64.rpm                                                                                                                                  103 kB/s |  58 kB     00:00    
(2/11): rpmdevtools-8.10-7.el8.noarch.rpm                                                                                                                                     146 kB/s |  87 kB     00:00    
(3/11): elfutils-0.178-7.el8.x86_64.rpm                                                                                                                                       818 kB/s | 540 kB     00:00    
(4/11): libatomic_ops-7.6.2-3.el8.x86_64.rpm                                                                                                                                  225 kB/s |  38 kB     00:00    
(5/11): libbabeltrace-1.5.4-2.el8.x86_64.rpm                                                                                                                                  917 kB/s | 201 kB     00:00    
(6/11): gc-7.6.4-3.el8.x86_64.rpm                                                                                                                                             616 kB/s | 109 kB     00:00    
(7/11): libipt-1.6.1-8.el8.x86_64.rpm                                                                                                                                         292 kB/s |  50 kB     00:00    
(8/11): zstd-1.4.2-2.el8.x86_64.rpm                                                                                                                                           1.4 MB/s | 385 kB     00:00    
(9/11): rpm-build-4.14.2-37.el8.x86_64.rpm                                                                                                                                    890 kB/s | 171 kB     00:00    
(10/11): guile-2.0.14-7.el8.x86_64.rpm                                                                                                                                        5.5 MB/s | 3.5 MB     00:00    
(11/11): gdb-headless-8.2-11.el8.x86_64.rpm                                                                                                                                   6.0 MB/s | 3.7 MB     00:00    
--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Total                                                                                                                                                                         5.1 MB/s | 8.8 MB     00:01     
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                      1/1 
  Installing       : zstd-1.4.2-2.el8.x86_64                                                                                                                                                             1/11 
  Installing       : libipt-1.6.1-8.el8.x86_64                                                                                                                                                           2/11 
  Installing       : libbabeltrace-1.5.4-2.el8.x86_64                                                                                                                                                    3/11 
  Running scriptlet: libbabeltrace-1.5.4-2.el8.x86_64                                                                                                                                                    3/11 
  Installing       : libatomic_ops-7.6.2-3.el8.x86_64                                                                                                                                                    4/11 
  Installing       : gc-7.6.4-3.el8.x86_64                                                                                                                                                               5/11 
  Installing       : elfutils-0.178-7.el8.x86_64                                                                                                                                                         6/11 
  Installing       : libtool-ltdl-2.4.6-25.el8.x86_64                                                                                                                                                    7/11 
  Running scriptlet: libtool-ltdl-2.4.6-25.el8.x86_64                                                                                                                                                    7/11 
  Installing       : guile-5:2.0.14-7.el8.x86_64                                                                                                                                                         8/11 
  Running scriptlet: guile-5:2.0.14-7.el8.x86_64                                                                                                                                                         8/11 
  Installing       : gdb-headless-8.2-11.el8.x86_64                                                                                                                                                      9/11 
  Installing       : rpm-build-4.14.2-37.el8.x86_64                                                                                                                                                     10/11 
  Installing       : rpmdevtools-8.10-7.el8.noarch                                                                                                                                                      11/11 
  Running scriptlet: guile-5:2.0.14-7.el8.x86_64                                                                                                                                                        11/11 
  Running scriptlet: rpmdevtools-8.10-7.el8.noarch                                                                                                                                                      11/11 
  Verifying        : libtool-ltdl-2.4.6-25.el8.x86_64                                                                                                                                                    1/11 
  Verifying        : elfutils-0.178-7.el8.x86_64                                                                                                                                                         2/11 
  Verifying        : rpmdevtools-8.10-7.el8.noarch                                                                                                                                                       3/11 
  Verifying        : libatomic_ops-7.6.2-3.el8.x86_64                                                                                                                                                    4/11 
  Verifying        : libbabeltrace-1.5.4-2.el8.x86_64                                                                                                                                                    5/11 
  Verifying        : gc-7.6.4-3.el8.x86_64                                                                                                                                                               6/11 
  Verifying        : guile-5:2.0.14-7.el8.x86_64                                                                                                                                                         7/11 
  Verifying        : libipt-1.6.1-8.el8.x86_64                                                                                                                                                           8/11 
  Verifying        : zstd-1.4.2-2.el8.x86_64                                                                                                                                                             9/11 
  Verifying        : rpm-build-4.14.2-37.el8.x86_64                                                                                                                                                     10/11 
  Verifying        : gdb-headless-8.2-11.el8.x86_64                                                                                                                                                     11/11 
Installed products updated.

Installed:
  elfutils-0.178-7.el8.x86_64   gc-7.6.4-3.el8.x86_64              gdb-headless-8.2-11.el8.x86_64   guile-5:2.0.14-7.el8.x86_64     libatomic_ops-7.6.2-3.el8.x86_64   libbabeltrace-1.5.4-2.el8.x86_64  
  libipt-1.6.1-8.el8.x86_64     libtool-ltdl-2.4.6-25.el8.x86_64   rpm-build-4.14.2-37.el8.x86_64   rpmdevtools-8.10-7.el8.noarch   zstd-1.4.2-2.el8.x86_64           

Complete!
```

`Complete!`が表示されたらインストール完了

###### 7. `sudo yum update` 全てのパッケージをアップデートする。個別のパッケージをアップデートしたい場合は、再度にパッケージ名を入れる。

今回の例はアップデートがない状態

```
[vagrant@rhel8 scratch]$ sudo yum update
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Last metadata expiration check: 0:26:08 ago on Tue Jun 23 21:25:35 2020.
Dependencies resolved.
Nothing to do.
Complete!
```

`Complete!`が表示されたらインストール完了


###### 8. `sudo yum history`　パッケージのインストール、アップデート、削除の履歴を表示する

```
[vagrant@rhel8 scratch]$ sudo yum history
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    24 | group install RPM Develo | 2020-06-23 21:50 | Install        |   12   
    23 | install ansible          | 2020-06-23 21:48 | Install        |   13   
    22 | install nginx            | 2020-06-23 21:39 | Install        |   15  <
    21 | remove nginx             | 2020-06-23 21:28 | Removed        |   15 > 
    20 | remove ansible           | 2020-06-23 21:27 | Removed        |   13   
    19 | install nginx            | 2020-06-23 21:24 | Install        |   15   
    18 | install ansible          | 2020-06-23 21:19 | Install        |   13   
    17 |                          | 2020-06-23 21:10 | Upgrade        |    1   
    16 |                          | 2020-06-14 09:57 | I, U           |   25   
    15 |                          | 2020-06-05 12:59 | Upgrade        |    6   
    14 |                          | 2020-05-27 13:33 | Install        |    1   
    13 | install -y kernel-devel  | 2020-05-27 13:23 | Install        |  115   
    12 | -y update                | 2020-05-27 13:17 | I, O, U        |   25   
    11 | install -y epel-release  | 2020-05-27 13:17 | Upgrade        |    1   
    10 | install docker -y        | 2020-05-27 13:16 | Install        |   17   
     9 | install -y cockpit       | 2020-05-27 13:16 | Install        |   42   
     8 | --assumeyes install mloc | 2020-05-21 10:03 | Install        |    1   
     7 | --assumeyes install have | 2020-05-21 10:03 | Install        |    1   
     6 | --quiet --assumeyes inst | 2020-05-21 10:00 | Install        |    3   
     5 | --assumeyes install kern | 2020-05-21 09:59 | Install        |    1   
     4 | --assumeyes reinstall li | 2020-05-21 09:57 | R              |    2   
     3 | --assumeyes install sudo | 2020-05-21 09:56 | Install        |   97   
     2 | --assumeyes install epel | 2020-05-21 09:56 | Install        |    1   
     1 |                          | 2020-05-21 09:48 | Install        |  412 EE
```


###### 9. `sudo yum history undo <ID>`　`yum history`で表示されるID番号を元に戻す

今回の例では、一つ前のID：２３のAnsibleのインストールを戻している

```
[vagrant@rhel8 scratch]$ sudo yum history undo 23
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
Last metadata expiration check: 0:28:37 ago on Tue Jun 23 21:25:35 2020.
Undoing transaction 23, from Tue Jun 23 21:48:09 2020
    Install ansible-2.9.10-1.el8.noarch           @epel
    Install libsodium-1.0.18-2.el8.x86_64         @epel
    Install python3-bcrypt-3.1.6-2.el8.1.x86_64   @epel
    Install python3-paramiko-2.4.3-1.el8.noarch   @epel
    Install python3-pynacl-1.3.0-5.el8.x86_64     @epel
    Install sshpass-1.06-9.el8.x86_64             @epel
    Install python3-pyyaml-3.12-12.el8.x86_64     @rhel-8-for-x86_64-baseos-rpms
    Install python3-jmespath-0.9.0-11.el8.noarch  @rhel-8-for-x86_64-appstream-rpms
    Install python3-pytz-2017.2-9.el8.noarch      @rhel-8-for-x86_64-appstream-rpms
    Install python3-pyasn1-0.3.7-6.el8.noarch     @rhel-8-for-x86_64-appstream-rpms
    Install python3-markupsafe-0.23-19.el8.x86_64 @rhel-8-for-x86_64-appstream-rpms
    Install python3-jinja2-2.10.1-2.el8_0.noarch  @rhel-8-for-x86_64-appstream-rpms
    Install python3-babel-2.5.1-5.el8.noarch      @rhel-8-for-x86_64-appstream-rpms
Dependencies resolved.
==============================================================================================================================================================================================================
 Package                                           Architecture                          Version                                       Repository                                                        Size
==============================================================================================================================================================================================================
Removing:
 ansible                                           noarch                                2.9.10-1.el8                                  @epel                                                             98 M
 libsodium                                         x86_64                                1.0.18-2.el8                                  @epel                                                            399 k
 python3-babel                                     noarch                                2.5.1-5.el8                                   @rhel-8-for-x86_64-appstream-rpms                                 20 M
 python3-bcrypt                                    x86_64                                3.1.6-2.el8.1                                 @epel                                                             78 k
 python3-jinja2                                    noarch                                2.10.1-2.el8_0                                @rhel-8-for-x86_64-appstream-rpms                                2.5 M
 python3-jmespath                                  noarch                                0.9.0-11.el8                                  @rhel-8-for-x86_64-appstream-rpms                                117 k
 python3-markupsafe                                x86_64                                0.23-19.el8                                   @rhel-8-for-x86_64-appstream-rpms                                 76 k
 python3-paramiko                                  noarch                                2.4.3-1.el8                                   @epel                                                            1.2 M
 python3-pyasn1                                    noarch                                0.3.7-6.el8                                   @rhel-8-for-x86_64-appstream-rpms                                522 k
 python3-pynacl                                    x86_64                                1.3.0-5.el8                                   @epel                                                            457 k
 python3-pytz                                      noarch                                2017.2-9.el8                                  @rhel-8-for-x86_64-appstream-rpms                                175 k
 python3-pyyaml                                    x86_64                                3.12-12.el8                                   @rhel-8-for-x86_64-baseos-rpms                                   634 k
 sshpass                                           x86_64                                1.06-9.el8                                    @epel                                                             40 k

Transaction Summary
==============================================================================================================================================================================================================
Remove  13 Packages

Freed space: 124 M
Is this ok [y/N]: y
Running transaction check
Transaction check succeeded.
Running transaction test
Transaction test succeeded.
Running transaction
  Preparing        :                                                                                                                                                                                      1/1 
  Erasing          : ansible-2.9.10-1.el8.noarch                                                                                                                                                         1/13 
  Erasing          : python3-paramiko-2.4.3-1.el8.noarch                                                                                                                                                 2/13 
  Erasing          : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                                3/13 
  Erasing          : python3-babel-2.5.1-5.el8.noarch                                                                                                                                                    4/13 
  Erasing          : python3-pytz-2017.2-9.el8.noarch                                                                                                                                                    5/13 
  Erasing          : python3-pyasn1-0.3.7-6.el8.noarch                                                                                                                                                   6/13 
  Erasing          : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                                7/13 
  Erasing          : python3-pynacl-1.3.0-5.el8.x86_64                                                                                                                                                   8/13 
  Erasing          : libsodium-1.0.18-2.el8.x86_64                                                                                                                                                       9/13 
  Erasing          : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                              10/13 
  Erasing          : python3-bcrypt-3.1.6-2.el8.1.x86_64                                                                                                                                                11/13 
  Erasing          : python3-pyyaml-3.12-12.el8.x86_64                                                                                                                                                  12/13 
  Erasing          : sshpass-1.06-9.el8.x86_64                                                                                                                                                          13/13 
  Running scriptlet: sshpass-1.06-9.el8.x86_64                                                                                                                                                          13/13 
  Verifying        : ansible-2.9.10-1.el8.noarch                                                                                                                                                         1/13 
  Verifying        : libsodium-1.0.18-2.el8.x86_64                                                                                                                                                       2/13 
  Verifying        : python3-babel-2.5.1-5.el8.noarch                                                                                                                                                    3/13 
  Verifying        : python3-bcrypt-3.1.6-2.el8.1.x86_64                                                                                                                                                 4/13 
  Verifying        : python3-jinja2-2.10.1-2.el8_0.noarch                                                                                                                                                5/13 
  Verifying        : python3-jmespath-0.9.0-11.el8.noarch                                                                                                                                                6/13 
  Verifying        : python3-markupsafe-0.23-19.el8.x86_64                                                                                                                                               7/13 
  Verifying        : python3-paramiko-2.4.3-1.el8.noarch                                                                                                                                                 8/13 
  Verifying        : python3-pyasn1-0.3.7-6.el8.noarch                                                                                                                                                   9/13 
  Verifying        : python3-pynacl-1.3.0-5.el8.x86_64                                                                                                                                                  10/13 
  Verifying        : python3-pytz-2017.2-9.el8.noarch                                                                                                                                                   11/13 
  Verifying        : python3-pyyaml-3.12-12.el8.x86_64                                                                                                                                                  12/13 
  Verifying        : sshpass-1.06-9.el8.x86_64                                                                                                                                                          13/13 
Installed products updated.

Removed:
  ansible-2.9.10-1.el8.noarch              libsodium-1.0.18-2.el8.x86_64             python3-babel-2.5.1-5.el8.noarch        python3-bcrypt-3.1.6-2.el8.1.x86_64     python3-jinja2-2.10.1-2.el8_0.noarch    
  python3-jmespath-0.9.0-11.el8.noarch     python3-markupsafe-0.23-19.el8.x86_64     python3-paramiko-2.4.3-1.el8.noarch     python3-pyasn1-0.3.7-6.el8.noarch       python3-pynacl-1.3.0-5.el8.x86_64       
  python3-pytz-2017.2-9.el8.noarch         python3-pyyaml-3.12-12.el8.x86_64         sshpass-1.06-9.el8.x86_64              

Complete!
```

`sudo yum history`で確認すると、ID:23を戻していることが分かる

```
[vagrant@rhel8 scratch]$ sudo yum history
Failed to set locale, defaulting to C.UTF-8
Updating Subscription Management repositories.
ID     | Command line             | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    25 | history undo 23          | 2020-06-23 21:54 | Removed        |   13   
    24 | group install RPM Develo | 2020-06-23 21:50 | Install        |   12   
    23 | install ansible          | 2020-06-23 21:48 | Install        |   13   
    22 | install nginx            | 2020-06-23 21:39 | Install        |   15  <
...
```

###### 10. `tail /var/log/dnf.rpm.log` パッケージのインストール、アンインストール、アップデートのログ

```
[vagrant@rhel8 scratch]$ tail /var/log/dnf.rpm.log 
2020-06-23T21:54:44Z SUBDEBUG Erase: python3-pytz-2017.2-9.el8.noarch
2020-06-23T21:54:44Z SUBDEBUG Erase: python3-pyasn1-0.3.7-6.el8.noarch
2020-06-23T21:54:45Z SUBDEBUG Erase: python3-jmespath-0.9.0-11.el8.noarch
2020-06-23T21:54:45Z SUBDEBUG Erase: python3-pynacl-1.3.0-5.el8.x86_64
2020-06-23T21:54:45Z SUBDEBUG Erase: libsodium-1.0.18-2.el8.x86_64
2020-06-23T21:54:45Z SUBDEBUG Erase: python3-markupsafe-0.23-19.el8.x86_64
2020-06-23T21:54:45Z SUBDEBUG Erase: python3-bcrypt-3.1.6-2.el8.1.x86_64
2020-06-23T21:54:45Z SUBDEBUG Erase: python3-pyyaml-3.12-12.el8.x86_64
2020-06-23T21:54:45Z SUBDEBUG Erase: sshpass-1.06-9.el8.x86_64
2020-06-23T21:55:52Z INFO --- logging initialized ---
```