ウェブサイト検索

CentOS および RHEL でアップデートを確認してインストールする方法


ソフトウェア パッケージまたはカーネル自体のアップデートのインストールは、システム管理者にとって非常に推奨される有益な作業です。特にセキュリティアップデートやパッチに関してはそうです。セキュリティの脆弱性が発見された場合は、システム全体に対する潜在的なセキュリティ リスクを軽減するために、影響を受けるソフトウェアを更新する必要があります。

セキュリティ パッチまたはアップデートを自動的にインストールするようにシステムを構成していない場合は、手動で行う必要があります。この記事では、CentOS および RHEL ディストリビューションでソフトウェア アップデートを確認してインストールする方法を説明します。

インストールされているパッケージに利用可能なアップデートがあるかどうかを確認するには、YUM パッケージ マネージャーを check-update サブコマンドで使用します。これは、利用可能なすべてのリポジトリからのすべてのパッケージ更新を確認するのに役立ちます。

yum check-update
Loaded plugins: changelog, fastestmirror
base                                                                                                                                                 | 3.6 kB  00:00:00     
epel/x86_64/metalink                                                                                                                                 |  22 kB  00:00:00     
epel                                                                                                                                                 | 4.3 kB  00:00:00     
extras                                                                                                                                               | 3.4 kB  00:00:00     
mariadb                                                                                                                                              | 2.9 kB  00:00:00     
updates                                                                                                                                              | 3.4 kB  00:00:00     
(1/2): epel/x86_64/updateinfo                                                                                                                        | 842 kB  00:00:15     
(2/2): epel/x86_64/primary_db                                                                                                                        | 6.1 MB  00:00:00     
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com

MariaDB-client.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
MariaDB-common.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
MariaDB-server.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
MariaDB-shared.x86_64                                                              10.1.28-1.el7.centos                                                             mariadb 
NetworkManager.x86_64                                                              1:1.8.0-11.el7_4                                                                 updates 
NetworkManager-adsl.x86_64                                                         1:1.8.0-11.el7_4                                                                 updates 
....

単一のパッケージを利用可能な最新バージョンに更新するには、以下のコマンドを実行します。この例では、yumhttpd パッケージの更新を試みます。

yum update httpd
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package httpd.x86_64 0:2.4.6-45.el7.centos.4 will be updated
--> Processing Dependency: httpd = 2.4.6-45.el7.centos.4 for package: 1:mod_ssl-2.4.6-45.el7.centos.4.x86_64
---> Package httpd.x86_64 0:2.4.6-67.el7.centos.6 will be an update
--> Processing Dependency: httpd-tools = 2.4.6-67.el7.centos.6 for package: httpd-2.4.6-67.el7.centos.6.x86_64
--> Running transaction check
---> Package httpd-tools.x86_64 0:2.4.6-45.el7.centos.4 will be updated
---> Package httpd-tools.x86_64 0:2.4.6-67.el7.centos.6 will be an update
---> Package mod_ssl.x86_64 1:2.4.6-45.el7.centos.4 will be updated
---> Package mod_ssl.x86_64 1:2.4.6-67.el7.centos.6 will be an update
....

パッケージ グループを更新するには、次のコマンドで開発ツール (C および C++ コンパイラと関連ユーティリティ) を更新します。

yum update "Development Tools"
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
...

すべてのシステム ソフトウェアとその依存関係を最新バージョンにアップグレードするには、次のコマンドを使用します。

yum update
Loaded plugins: changelog, fastestmirror
Loading mirror speeds from cached hostfile
 * base: mirrors.linode.com
 * epel: mirror.vorboss.net
 * extras: mirrors.linode.com
 * updates: mirrors.linode.com
Resolving Dependencies
--> Running transaction check
---> Package MariaDB-client.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-client.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package MariaDB-common.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-common.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package MariaDB-server.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-server.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package MariaDB-shared.x86_64 0:10.1.23-1.el7.centos will be updated
---> Package MariaDB-shared.x86_64 0:10.1.28-1.el7.centos will be an update
---> Package NetworkManager.x86_64 1:1.4.0-19.el7_3 will be obsoleted
---> Package NetworkManager.x86_64 1:1.8.0-11.el7_4 will be obsoleting
....

それでおしまい!以下の関連記事をお読みください。

  1. CentOS 7 で最新のカーネル バージョンをインストールまたはアップグレードする方法
  2. CentOS、RHEL、Fedora で古い未使用のカーネルを削除する方法
  3. Debian および Ubuntu にセキュリティ更新プログラムを自動的にインストールする方法

最新のセキュリティと一般的なパッケージのアップデートにより、Linux システムを常に最新の状態に保ちます。ご質問がございましたら、以下のコメント フォームをご利用ください。