CentOS:パッケージを更新する

yum コマンドでパッケージを更新します。


まず、更新するパッケージがあるか確認します。
yumコマンドに check-updateオプションを付けて実行します。

[aaa@localhost ~]$ sudo tcsh
Password:
[root@localhost ~]# yum check-update
Loading "installonlyn" plugin
Setting up repositories
base 100% |=========================| 1.1 kB 00:00
updates 100% |=========================| 951 B 00:00
addons 100% |=========================| 951 B 00:00
extras 100% |=========================| 1.1 kB 00:00
Reading repository metadata in from local files
primary.xml.gz 100% |=========================| 323 kB 00:22
updates : ################################################## 731/731
Added 8 new packages, deleted 0 old in 3.97 seconds

hpijs.i386 1:1.6.7-4.1.el5.3 updates
hplip.i386 1.6.7-4.1.el5.3 updates
libsane-hpaio.i386 1.6.7-4.1.el5.3 updates


更新するパッケージがあれば
yumコマンドにupdateオプションをつけ、-y でinstallするか?という質問に無条件に
yes と答えるようにします。 

[root@localhost ~]# yum update -y
Loading "installonlyn" plugin
Setting up Update Process
Setting up repositories
Reading repository metadata in from local files
Resolving Dependencies

    • > Populating transaction set with selected packages. Please wait.
      • > Downloading header for hpijs to pack into transaction set.

hpijs-1.6.7-4.1.el5.3.i38 100% |=========================| 9.5 kB 00:00

      • > Package hpijs.i386 1:1.6.7-4.1.el5.3 set to be updated
      • > Downloading header for hplip to pack into transaction set.

hplip-1.6.7-4.1.el5.3.i38 100% |=========================| 98 kB 00:00

      • > Package hplip.i386 0:1.6.7-4.1.el5.3 set to be updated
      • > Downloading header for libsane-hpaio to pack into transaction set.

libsane-hpaio-1.6.7-4.1.e 100% |=========================| 8.8 kB 00:00

      • > Package libsane-hpaio.i386 0:1.6.7-4.1.el5.3 set to be updated
    • > Running transaction check

Dependencies Resolved

=============================================================================
Package Arch Version Repository Size
=============================================================================
Updating:
hpijs i386 1:1.6.7-4.1.el5.3 updates 286 k
hplip i386 1.6.7-4.1.el5.3 updates 7.8 M
libsane-hpaio i386 1.6.7-4.1.el5.3 updates 57 k

Transaction Summary
=============================================================================
Install 0 Package(s)
Update 3 Package(s)
Remove 0 Package(s)

Total download size: 8.1 M
Downloading Packages:
(1/3): hpijs-1.6.7-4.1.el 100% |=========================| 286 kB 00:00
(2/3): hplip-1.6.7-4.1.el 100% |=========================| 7.8 MB 00:13
(3/3): libsane-hpaio-1.6. 100% |=========================| 57 kB 00:00
Running Transaction Test
Finished Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : hpijs ######################### [1/6]
Updating : libsane-hpaio ######################### [2/6]
Updating : hplip ######################### [3/6]
Cleanup : hpijs ######################### [4/6]
Cleanup : hplip ######################### [5/6]
Cleanup : libsane-hpaio ######################### [6/6]

Updated: hpijs.i386 1:1.6.7-4.1.el5.3 hplip.i386 0:1.6.7-4.1.el5.3 libsane-hpaio.i386 0:1.6.7-4.1.el5.3
Complete!
[root@localhost ~]#

これでパッケージが更新されました。