“yum update”コマンドで、現在インストールされているパッケージの中でアップデート可能なパッケージをすべて最新(yumのリポジトリで管理されているバージョンの最新)にアップデートする事ができます。
※目次をクリックすると目次の下部にコンテンツが表示されます。
- 1.アップデート可能なパッケージを確認
- 2.アップデート実行
- 3.yumコマンドの実行履歴の確認方法
- 4.yumコマンドの実行内容を元に戻したい場合
- 5.アップデート可能な最新のパッケージを自動で確認する
アップデート可能なパッケージを確認
下記のように、”yum check-update”、”yum list updates”で確認する事ができます。
 
# yum check-update : audit.x86_64 2.2-2.el6 base audit-libs.x86_64 2.2-2.el6 base automake.noarch 1.11.1-4.el6 base
# yum list updates : Updated Packages audit.x86_64 2.2-2.el6 base audit-libs.x86_64 2.2-2.el6 base automake.noarch 1.11.1-4.el6 base
アップデート実行
“yum update”コマンドを実行すると、アップデート対象のパッケージ名が表示され、実際にアップデートを実施するかどうか聞かれ、実施する場合は”y”を押します。
 
# yum update : Setting up Update Process Resolving Dependencies --> Running transaction check ---> Package audit.x86_64 0:2.1.3-3.el6 will be updated : Dependencies Resolved : Installing: kernel x86_64 2.6.32-358.14.1.el6 updates 26 M : Updating: audit x86_64 2.2-2.el6 base 225 k : Installing for dependencies: device-mapper-persistent-data x86_64 0.1.4-1.el6 base 164 k file x86_64 5.04-15.el6 base 46 k Transaction Summary ====================================================================================================================================================== Install 4 Package(s) Upgrade 158 Package(s) Total download size: 187 M Is this ok [y/N]: Installed: kernel.x86_64 0:2.6.32-358.14.1.el6 matahari.x86_64 0:0.6.0-19.el6 Dependency Installed: device-mapper-persistent-data.x86_64 0:0.1.4-1.el6 file.x86_64 0:5.04-15.el6 Updated: audit.x86_64 0:2.2-2.el6 audit-libs.x86_64 0:2.2-2.el6 automake.noarch 0:1.11.1-4.el6 : Replaced: matahari-agent-lib.x86_64 0:0.4.4-11.el6 matahari-broker.x86_64 0:0.4.4-11.el6 matahari-host.x86_64 0:0.4.4-11.el6 : Complete!
yumコマンドの実行履歴の確認方法
アップデート後に問題が発生した場合にはアップデート内容を確認する必要があります。
 
yum historyコマンドで過去のyumコマンドによる実行内容を確認できます。
 
①過去の実行履歴のリストを表示
yum historyコマンドで過去のyumコマンドによる実行内容を確認できます。
①過去の実行履歴のリストを表示
# yum history list
Loaded plugins: fastestmirror, refresh-packagekit
ID     | Login user               | Date and time    | Action(s)      | Altered
-------------------------------------------------------------------------------
    49 |                   | 2013-08-14 07:56 | I, O, U        |  169 EE
    48 |                   | 2013-08-13 22:26 | Install        |    1                   | 2013-08-10 13:04 | I, U           |  409 >
    46 |                   | 2013-07-31 15:26 | Install        |    5                   | 2013-06-26 16:26 | Install        |    1 >
       :
 
②各リストの詳細の作業内容を表示
 
“yum history list”の表示結果の日時や”Altered”欄の変更されたパッケージ数などから調査対象のIDを確認します。
 
“yum history info [ID]”で詳細の実行内容を表示できます。
 
例)yum updateコマンド実施時の内容表示例
# yum history info 49
Loaded plugins: fastestmirror, refresh-packagekit
Transaction ID : 49
Begin time     : Wed Aug 14 07:56:10 2013
 :
Return-Code    : Success
Command Line   : update
Transaction performed with:
    Updated       rpm-4.8.0-19.el6.x86_64                       @anaconda-CentOS-201112091719.x86_64/6.2
    Updated       yum-3.2.29-22.el6.centos.noarch               @anaconda-CentOS-201112091719.x86_64/6.2
    Updated       yum-plugin-fastestmirror-1.1.30-10.el6.noarch @anaconda-CentOS-201112091719.x86_64/6.2
Packages Altered:
    Updated     audit-2.1.3-3.el6.x86_64                           @anaconda-CentOS-201112091719.x86_64/6.2
    Update            2.2-2.el6.x86_64                             @base
    Updated     audit-libs-2.1.3-3.el6.x86_64                      @anaconda-CentOS-201112091719.x86_64/6.2
    Update                 2.2-2.el6.x86_64                        @base
    Updated     automake-1.11.1-1.2.el6.noarch                     @base
    Update               1.11.1-4.el6.noarch                       @base
    Updated     bash-4.1.2-8.el6.centos.x86_64                     @anaconda-CentOS-201112091719.x86_64/6.2
    Update           4.1.2-15.el6_4.x86_64                         @updates
        :
    Updated     device-mapper-libs-1.02.66-6.el6.x86_64            @anaconda-CentOS-201112091719.x86_64/6.2
    Update                         1.02.77-9.el6.x86_64            @base
    Dep-Install device-mapper-persistent-data-0.1.4-1.el6.x86_64   @base
        :
    Obsoleting  matahari-0.6.0-19.el6.x86_64                       @base
    Obsoleted   matahari-agent-lib-0.4.4-11.el6.x86_64             @anaconda-CentOS-201112091719.x86_64/6.2
        :
Scriptlet output:
   1 warning: /etc/sudoers created as /etc/sudoers.rpmnew
   2 warning: /etc/rsyslog.conf created as /etc/rsyslog.conf.rpmnew
   3 warning: /etc/group created as /etc/group.rpmnew
   4 warning: /etc/gshadow created as /etc/gshadow.rpmnew
   5 warning: /etc/profile created as /etc/profile.rpmnew
   6 warning: /etc/shadow created as /etc/shadow.rpmnew
history info
yumコマンドの実行内容を元に戻したい場合
yumコマンドでインストール、アップデート、削除などを行った後に、不具合が発生した場合は、”yum history undo”コマンドで実行前の状態に戻す事ができます。詳細は下記記事参照。
yumでインストール済みのパッケージを元に戻す
 
①”yum history list all”で過去の実行履歴を表示し、対象作業のIDを確認します。
 
②”yum history undo [ID]”でyumコマンドで実行した内容をundoします。
yumでインストール済みのパッケージを元に戻す
①”yum history list all”で過去の実行履歴を表示し、対象作業のIDを確認します。
②”yum history undo [ID]”でyumコマンドで実行した内容をundoします。
アップデート可能な最新のパッケージを自動で確認する
下記記事参照
更新可能なRPMパッケージのリストをメールで送信する
更新可能なRPMパッケージのリストをメールで送信する