


RedHat, CentOSではyumを使用してアプリケーションをインストール、アップデートを行います。
たまに「あのパッケージはいつ{Install|Update}した?」って確認したい時があります。
そんな時はyum historyコマンドで確認できます。
以下はCentOS 7で確認しました。
- yum history
- yum history info
- yum history packages-list
- yum history packages-info
- yum history summary
- yum history addon-info
- yum history rollback
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
[root@host01 ~]# yum history 読み込んだプラグイン:fastestmirror ID | ログイン ユーザー | 日時 | 操作 | 変更 ------------------------------------------------------------------------------- 12 | root <root> | 2016-01-20 10:46 | Install | 1 11 | root <root> | 2016-01-20 10:07 | Update | 3 10 | root <root> | 2016-01-19 17:35 | Install | 1 9 | root <root> | 2016-01-18 16:03 | Install | 1 < 8 | root <root> | 2016-01-17 11:08 | Install | 1 >< 7 | root <root> | 2016-01-13 18:29 | Install | 9 > 6 | root <root> | 2016-01-13 18:27 | Install | 7 5 | root <root> | 2016-01-13 18:20 | Install | 3 4 | root <root> | 2016-01-13 18:05 | I, U | 221 EE 3 | root <root> | 2015-06-21 12:28 | I, U | 49 2 | root <root> | 2015-06-21 12:10 | Install | 1 1 | システム <未設定> | 2015-06-21 11:45 | Install | 393 history list |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[root@host01 ~]# yum history info 11 読み込んだプラグイン:fastestmirror トランザクション ID : 11 開始時間 : Wed Jan 20 10:07:46 2016 開始 rpmdb : 424:f6b803bd9eba0debc604c550f2d49eaab38294a0 終了時間 : 10:07:47 2016 (1 秒) 終了 rpmdb : 424:b19ac04e605a00d174c53c3068379babdf26be35 ユーザー : root <root> 終了コード : 成功 コマンドライン : update トランザクションの実行: インストール rpm-4.11.3-17.el7.x86_64 @base インストール yum-3.4.3-132.el7.centos.0.1.noarch @base インストール yum-plugin-fastestmirror-1.1.31-34.el7.noarch @base 切り替えたパッケージ: 更新 openssh-6.6.1p1-22.el7.x86_64 @base 更新 6.6.1p1-23.el7_2.x86_64 @updates 更新 openssh-clients-6.6.1p1-22.el7.x86_64 @base 更新 6.6.1p1-23.el7_2.x86_64 @updates 更新 openssh-server-6.6.1p1-22.el7.x86_64 @base 更新 6.6.1p1-23.el7_2.x86_64 @updates history info |
1 2 3 4 5 6 7 8 9 10 11 12 |
[root@host01 ~]# yum history packages-list openssh 読み込んだプラグイン:fastestmirror ID | 操作 | Package ------------------------------------------------------------------------------- 11 | 更新 | openssh-6.6.1p1-22.el7.x86_64 11 | 更新 | 6.6.1p1-23.el7_2.x86_64 4 | 更新 | openssh-6.6.1p1-12.el7_1.x86_64 EE 4 | 更新 | 6.6.1p1-22.el7.x86_64 EE 3 | 更新 | openssh-6.6.1p1-11.el7.x86_64 3 | 更新 | 6.6.1p1-12.el7_1.x86_64 1 | 依存インストール | openssh-6.6.1p1-11.el7.x86_64 history packages-list |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
[root@host01 ~]# yum history packages-info openssh-6.6.1p1-23.el7_2.x86_64 読み込んだプラグイン:fastestmirror トランザクション ID : 11 開始時間 : Wed Jan 20 10:07:46 2016 パッケージ : openssh-6.6.1p1-23.el7_2.x86_64 状態 : 更新 容量 : 1,450,042 構築ホスト : worker1.bsys.centos.org 構築日時 : Fri Jan 15 08:03:13 2016 パッケージ者 : CentOS BuildSystem <http://bugs.centos.org> ベンダー : CentOS ライセンス : BSD URL : http://www.openssh.com/portable.html ソース RPM : openssh-6.6.1p1-23.el7_2.src.rpm コミット日時 : Wed Jan 13 21:00:00 2016 コミッター : Jakub Jelen <jjelen@redhat.com> 理由 : dep コマンドライン : update 取得リポジトリ : updates インストール者 : システム <未設定> 変更者 : root <root> history packages-info |
1 2 3 4 5 6 7 8 9 |
[root@host01 ~]# yum history summary 読み込んだプラグイン:fastestmirror ログイン ユーザー | 時間 | 操作 | 変更 ------------------------------------------------------------------------------- root <root> | 先週 | I, U | 7 root <root> | 最近の 2 週間 | I, U | 240 root <root> | 昨年 | I, U | 50 システム <未設定> | 昨年 | Install | 393 history summary |
1 2 3 4 5 6 7 8 9 |
[root@host01 ~]# yum history addon-info 読み込んだプラグイン:fastestmirror トランザクション ID: 12 追加の履歴情報が利用できます: config-main config-repos saved_tx history addon-info |
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 53 54 |
root@host01 ~]# yum history rollback 11 読み込んだプラグイン:fastestmirror Rollback to transaction 11, from Wed Jan 20 10:07:46 2016 Undoing the following transactions: 12 インストール keyutils-libs-devel-1.5.8-3.el7.x86_64 @base 依存性の解決をしています --> トランザクションの確認を実行しています。 ---> パッケージ keyutils-libs-devel.x86_64 0:1.5.8-3.el7 を 削除 --> 依存性解決を終了しました。 依存性を解決しました ============================================================================================================ Package アーキテクチャー バージョン リポジトリー 容量 ============================================================================================================ 削除中: keyutils-libs-devel x86_64 1.5.8-3.el7 @base 29 k トランザクションの要約 ============================================================================================================ 削除 1 パッケージ インストール容量: 29 k 上記の処理を行います。よろしいでしょうか? [y/N]y Downloading packages: Running transaction check Running transaction test Transaction test succeeded Running transaction 削除中 : keyutils-libs-devel-1.5.8-3.el7.x86_64 1/1 検証中 : keyutils-libs-devel-1.5.8-3.el7.x86_64 1/1 削除しました: keyutils-libs-devel.x86_64 0:1.5.8-3.el7 完了しました! [root@host01 ~]# yum history 読み込んだプラグイン:fastestmirror ID | ログイン ユーザー | 日時 | 操作 | 変更 ------------------------------------------------------------------------------- 13 | root <root> | 2016-01-22 21:15 | Erase | 1 12 | root <root> | 2016-01-20 10:46 | Install | 1 11 | root <root> | 2016-01-20 10:07 | Update | 3 10 | root <root> | 2016-01-19 17:35 | Install | 1 9 | root <root> | 2016-01-18 16:03 | Install | 1 < 8 | root <root> | 2016-01-17 11:08 | Install | 1 >< 7 | root <root> | 2016-01-13 18:29 | Install | 9 > 6 | root <root> | 2016-01-13 18:27 | Install | 7 5 | root <root> | 2016-01-13 18:20 | Install | 3 4 | root <root> | 2016-01-13 18:05 | I, U | 221 EE 3 | root <root> | 2015-06-21 12:28 | I, U | 49 2 | root <root> | 2015-06-21 12:10 | Install | 1 1 | システム <未設定> | 2015-06-21 11:45 | Install | 393 history list |
man 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 53 54 55 56 57 58 59 60 61 62 |
* history [info|list|packages-list|packages-info|summary|addon-info|redo|undo|roll‐back|new|sync|stats] history The history command allows the user to view what has happened in past transactions (assum‐ ing the history_record config. option is set). You can use info/list/packages-list/pack‐ ages-info/summary to view what happened, undo/redo/rollback to act on that information and new to start a new history file. The info/list/summary commands take either a transaction id or a package (with wildcards, as in Specifying package names), all three can also be passed no arguments. list can be passed the keyword "all" to list all the transactions. The info command can also take ranges of transaction ids, of the form start..end, which will then display a merged history as if all the transactions in the range had happened at once. Eg. "history info 1..4" will merge the first four transactions and display them as a single transaction. The packages-list/packages-info commands takes a package (with wildcards, as in Specifying package names). And show data from the point of view of that package. The undo/redo/rollback commands take either a single transaction id or the keyword last and an offset from the last transaction (Eg. if you've done 250 transactions, "last" refers to transaction 250, and "last-4" refers to transaction 246). The redo command can also take some optional arguments before you specify the transaction. "force-reinstall" tells it reinstall any packages that were installed in that transaction (via install, upgrade or downgrade). "force-remove" tells it to forcibly remove any packages that were updated or downgraded. The undo/redo commands act on the specified transaction, undo'ing or repeating the work of that transaction. While the rollback command will undo all transactions up to the point of the specified transaction. For example, if you have 3 transactions, where package A; B and C where installed respectively. Then "undo 1" will try to remove package A, "redo 1" will try to install package A (if it is not still installed), and "rollback 1" will try to remove packages B and C. Note that after a "rollback 1" you will have a fourth transaction, although the ending rpmdb version (see: yum version) should be the same in transactions 1 and 4. The addon-info command takes a transaction ID, and the packages-list command takes a pack‐ age (with wildcards). The stats command shows some statistics about the current history DB. The sync commands allows you to change the rpmdb/yumdb data stored for any installed pack‐ ages, to whatever is in the current rpmdb/yumdb (this is mostly useful when this data was not stored when the package went into the history DB). In "history list" you can change the behaviour of the 2nd column via the configuration option history_list_view. In "history list" output the Altered column also gives some extra information if there was something not good with the transaction (this is also shown at the end of the package col‐ umn in the packages-list command). > - The rpmdb was changed, outside yum, after the transaction. < - The rpmdb was changed, outside yum, before the transaction. * - The transaction aborted before completion. # - The transaction completed, but with a non-zero status. E - The transaction completed fine, but had warning/error output during the transaction. P - The transaction completed fine, but problems already existed in the rpmdb. s - The transaction completed fine, but --skip-broken was enabled and had to skip some packages. |