サポート終了したCentOS5をアップデートする

HOMEリナックスマスター.JP 公式ブログLinux情報・技術・セキュリティ > サポート終了したCentOS5をアップデートする

無料Linux入門マニュアル無料ダウンロード

今だけ2,200円のLinux入門PDFマニュアルが【数量限定】で無料ダウンロードできます。
Linux入門マニュアル無料ダウンロードはこちらをクリック

CentOS5のサポートは、2017年03月31日で終了し、
それ以降yumを使用したアップデートができなくなっています。

サポート終了した時点で、次期バージョンに移行し終わっているのが理想ですが、
クローズド環境で運用しているシステムでは、何らかの理由で次期バージョンに
移行できないケースがあります。

そのような場合でもある程度時間が経過すると
アップデートしたいという要望があると思いますので、
今回は、サポート終了したCentOS5でyumアップデートする手順を紹介します。

サポート終了したCentOS5のyumアップデート手順

yumアップデートを実行するとシステムに不具合で出る場合があります。
実行する前にテスト環境で充分検証を行うことを推奨します。
作業実施にはroot権限が必要になります。
今回はCentOS5.7をCentOS5.11にアップデートします。

1.CentOS5のバージョンを確認する

# cat /etc/redhat-release
CentOS release 5.7 (Final)


2.カーネルバージョンを確認する

# uname -a
Linux Mail_001_Enetmercury.localdomain 2.6.18-274.3.1.el5xen #1 SMP Tue Sep 6 20:57:11 EDT 2011 x86_64 x86_64 x86_64 GNU/Linux




3. /etc/yum.repos.d/CentOS-Base.repoファイルを編集します。
baseurlの箇所を、過去のCentOSバージョンが
ダウンロードできるアーカイブサイトアドレスに変更します。

# vi /etc/yum.repos.d/CentOS-Base.repo


変更前

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[updates]
name=CentOS-$releasever - Updates
baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[extras]
name=CentOS-$releasever - Extras
baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[centosplus]
name=CentOS-$releasever - Plus
baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/extras/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[contrib]
name=CentOS-$releasever - Contrib
baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5


変更後

# CentOS-Base.repo
#
# The mirror system uses the connecting IP address of the client and the
# update status of each mirror to pick mirrors that are updated to and
# geographically close to the client. You should use this for CentOS updates
# unless you are manually picking other mirrors.
#
# If the mirrorlist= does not work for you, as a fall back you can try the
# remarked out baseurl= line instead.
#
#
[base]
name=CentOS-$releasever - Base
#baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/os/$basearch/
baseurl=http://linuxsoft.cern.ch/centos-vault/5.11/os/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[updates]
name=CentOS-$releasever - Updates
#baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/updates/$basearch/
baseurl=http://linuxsoft.cern.ch/centos-vault/5.11/updates/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[extras]
name=CentOS-$releasever - Extras
#baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/addons/$basearch/
baseurl=http://linuxsoft.cern.ch/centos-vault/5.11/addons/$basearch/
gpgcheck=1
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[centosplus]
name=CentOS-$releasever - Plus
#baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/extras/$basearch/
baseurl=http://linuxsoft.cern.ch/centos-vault/5.11/extras/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
[contrib]
name=CentOS-$releasever - Contrib
#baseurl=http://linuxsoft.cern.ch/centos-vault/5.7/contrib/$basearch/
baseurl=http://linuxsoft.cern.ch/centos-vault/5.11/contrib/$basearch/
gpgcheck=1
enabled=0
gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5

編集したら「:wq」で保存終了します。

これまで、過去バージョンのCentOSがダウンロードできるサイトは、
http://vault.centos.org/だったのですが、
運用が変更になったようで、下記3サイトからダウンロードします。
http://archive.kernel.org/centos-vault/
http://linuxsoft.cern.ch/centos-vault/
http://mirror.nsc.liu.se/centos-store/
※今回は、http://linuxsoft.cern.ch/centos-vault/を利用しています。

4. yum updateを実行します。
baseurlの箇所を、過去のCentOSバージョンが
ダウンロードできるアーカイブサイトアドレスに変更します。

# yum update
Determining fastest mirrors
* epel: ftp.iij.ad.jp
base | 1.1 kB 00:00
base/primary | 1.3 MB 00:02
base 3667/3667
epel | 3.6 kB 00:00
extras | 1.9 kB 00:00
extras/primary_db | 1.1 kB 00:00
updates | 1.9 kB 00:00
updates/primary_db | 1.0 MB 00:01
Reading version lock configuration
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package acl.x86_64 0:2.2.39-8.el5 set to be updated
---> Package acpid.x86_64 0:1.0.4-12.el5 set to be updated
---> Package arj.x86_64 0:3.10.22-22.el5 set to be updated
---> Package aspell.i386 12:0.60.3-13 set to be updated
---> Package aspell.x86_64 12:0.60.3-13 set to be updated
---> Package aspell-en.x86_64 50:6.0-3 set to be updated
---> Package at.x86_64 0:3.1.8-84.el5_11.1 set to be updated
---> Package audit.x86_64 0:1.8-2.el5 set to be updated

〜中略〜

Transaction Summary
=================================================================================
Install 4 Package(s)
Upgrade 249 Package(s)

Total download size: 262 M
Is this ok [y/N]: y ←「y」を入力します。

〜中略〜

yum.noarch 0:3.2.22-40.el5.centos
yum-fastestmirror.noarch 0:1.1.16-21.el5.centos
yum-metadata-parser.x86_64 0:1.1.2-4.el5
yum-updatesd.noarch 1:0.9-6.el5_10
zlib.i386 0:1.2.3-7.el5
zlib.x86_64 0:1.2.3-7.el5

Complete!


5. システムを再起動します。

$ shutdown -r now


6.再起動後のCentOS5のバージョンを確認する
CentOS5.7からCentOS5.11にアップデートしています。

# cat /etc/redhat-release
CentOS release 5.11 (Final)


7.再起動後のカーネルバージョンを確認する
カーネルバージョンもアップデートしています。

# uname -a
Linux Mail_001_Enetmercury.localdomain 2.6.18-419.el5xen #1 SMP Fri Feb 24 22:50:37 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux


CentOS5からCentOS6へのアップデートについて

CentOS5→CentOS6のアップデートについてですが、
下記ページでアナウンスされているとおり、
同一サーバーでのバージョンアップではなく、
新たにCentOS6環境を構築して、環境、データ移行するのが推奨されています。

Migration from CentOS-5 to CentOS-6

無料Linux入門マニュアル無料ダウンロード

今だけ2,200円のLinux入門PDFマニュアルが【数量限定】で無料ダウンロードできます。
Linux入門マニュアル無料ダウンロードはこちらをクリック


<<関連記事>>
・RHEL7/CentOS7が重要カーネルセキュリティアップデートをリリース【CVE-2019-14821/CVE-2019-15239】
・PostgreSQL 12が公開と2019年10月データベース人気ランキング
・CentOS8とCentOS7の違い、変更点のまとめ
・Apacheに脆弱性(CVE-2017-9798)、メモリから情報漏えいの恐れ
・Apache Tomcat の複数の脆弱性に対するアップデート(CVE-2017-7674、CVE-2017-7675)

Linux入門マニュアル無料ダウンロード