CentOSサポート終了後の延長サポートにRHEL ELSを適用する方法(convert2rhelを使用してみた)

Blog

CentOS7のサポートが2024年6月30日に終了することを受けて、システムのリプレイスを検討されている方が多いかと思います。サポート終了があと1年に迫る中でリプレイスするにもシステム設計から構築そしてカットオーバーまでを考えると残された期間はわずかしかありません。

システムのリプレイスが間に合わないケースや予算の都合ですぐにリプレイスが出来ないという問題があるなかでレッドハット社からCentOSからRed Hat Enterprise Linux 7 (RHEL7)への移行ツールの提供と延長サポート(ELS:Extend Lifecycle Support)の4年間の期間延長が提供されることで、CentOSユーザーがRHEL7へのマイグレーションの上でELSサポートを受けるという考え方も出来るようになります。

CentOS7からRHEL7へのコンバートツールの利用については下記のドキュメントにて詳細がご案内されておりますので、ご活用ください。

RPM ベースの Linux ディストリビューションから RHEL への変換
https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html-single/converting_from_an_rpm-based_linux_distribution_to_rhel/index#doc-wrapper

私の方でも実際に調査し使ってみましたので、概要と流れを下記にまとめていきます。

Conversion from CentOS Linux 7 to Red Hat Enterprise Linux 7

CentOSのサポート終了後にCentOSとしてアップデートパッケージやセキュリティパッチが提供されることはなくなります。一方でRHEL7では延長サポートとしてELSを利用することができます。CentOSのままではELSは利用できませんので、この問題を回避するためにCentOS7をRHEL7にマイグレーションする必要があります。

このマイグレーションを行うためにレッドハット社より、RHELクローンの Linux ディストリビューションから、RHEL 7 または RHEL 8 に変換するツールと方法が提供されています。変換は Convert2RHEL ユーティリティーにより実行することが可能です。

サポート対象の変換パスは下記の通りです。

ソース OSターゲット OSアーキテクチャー製品バリアント
CentOS Linux 8.5RHEL 8.564 ビット Intel該当なし
CentOS Linux 7.9RHEL 7.964 ビット IntelServer
https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html-single/converting_from_an_rpm-based_linux_distribution_to_rhel/index#con_supported-conversion-paths_converting-from-a-linux-distribution-to-rhel

※ RHELへのコンバートには、有効なカスタマーポータル、Red Hat Subscription Manager、Red Hat Enterprise Linux サブスクリプションを有している必要があります。

※ CentOS Linux の最新マイナーバージョンは CentOS Linux 8.5 であるため、CentOS Linux 8 から、RHEL 8 の最新のマイナーバージョンに直接変換できません。

convert2rhel を実行してみる

詳細な手順については下記のドキュメントをご確認の上で実施ください。環境により適用する手順や情報が異なる場合がございます。

RPM ベースの Linux ディストリビューションから RHEL への変換
https://access.redhat.com/documentation/ja-jp/red_hat_enterprise_linux/8/html-single/converting_from_an_rpm-based_linux_distribution_to_rhel/index#doc-wrapper

Convert2rhel を実行する前のCentOSの下準備

まず、現状のCentOS7の環境のバックアップは必ず取得するようにしてください。コンバート中は多くの処理が実行されますが、古いマシンで稼働している場合は実行の負荷に耐えられず途中でプロセスが停止し、起動不可の状況が発生するなどのリスクも想定しなければなりません。

* 弊社検証環境におけるAWS EC2のt3microでは本実行はプロセスが固まり失敗しましたが、t3midiumでは成功しているため、性能指標の一つとして参考に活用ください。

CentOS7は最新の状態にする必要がありますので、「yum update」を実行します。

yum update

最新の状態にUpdate後、kernelが更新されている場合は必ず再起動を行ってください。

Convert2RHEL をインストール

Red Hat GPG キーをダウンロードします。

curl -o /etc/pki/rpm-gpg/RPM-GPG-KEY-redhat-release https://www.redhat.com/security/data/fd431d51.txt

Convert2RHEL リポジトリーを含む https://cdn.redhat.com サーバーの SSL 証明書をダウンロードします。

curl --create-dirs -o /etc/rhsm/ca/redhat-uep.pem https://ftp.redhat.com/redhat/convert2rhel/redhat-uep.pem

Convert2RHEL リポジトリーファイルをインストールします。

curl -o /etc/yum.repos.d/convert2rhel.repo https://ftp.redhat.com/redhat/convert2rhel/7/convert2rhel.repo

Convert2RHEL ユーティリティーをインストールします。

yum -y install convert2rhel

※ Red Hat Satellite サーバーをご利用の環境では手順が追加されている、変わる部分がございますので「RPM ベースの Linux ディストリビューションから RHEL への変換」ドキュメントをご確認頂きながら作業を実施ください。

Red Hat Subscription Manager(RHSM)を利用する環境では、convert2rhel.ini ファイルを編集してRHSMにアクセスが可能なようにします。私の環境では activation_key と org 情報を登録して実行しています。

vi /etc/convert2rhel.ini 
# -*- coding: utf-8 -*-
# This file should be in mode 0600
# Example of configuration file convert2rhel.ini for secrets.
# Possible locations of this file:
# 1) user specified and passed by -c, --config-file option; highest priority
# 2) ~/.convert2rhel.ini; lower priority
# 3) /etc/convert2rhel.ini; the lowest priority

[subscription_manager]
# username       = <insert_username>
# password       = <insert_password>
activation_key = <insert_activation_key>
org            = <insert_org>

activation_key および org の入力値は Red Hat Customer Portalより「管理」→「アクティベーションキー」のメニューより作成・確認が行なえます。

# convert2rhel

コンバートプログラムを実行すると下記のデータが Red Hat サーバーに送信されることへの同意が求められます。問題がない場合は y を入力してください。もし、送信したくないデータがある場合は「CONVERT2RHEL_DISABLE_TELEMETRY=1」環境変数を利用してください。

TASK - [Prepare: Inform about telemetry] **********************************
The convert2rhel utility uploads the following data about the system conversion to Red Hat servers for the purpose of the utility usage analysis:
- The Convert2RHEL command as executed
- The Convert2RHEL RPM version and GPG signature
- Success or failure status of the conversion
- Conversion start and end timestamps
- Source OS vendor and version
- Target RHEL version
- Convert2RHEL related environment variables

To disable the data collection, use the 'CONVERT2RHEL_DISABLE_TELEMETRY=1' environment variable.

Continue with the system conversion? [y/n]: y

次にタスク分析の結果が出力されます。「No problems detected during the analysis!」と出力されていれば、タスク分析では問題は検出されなかったことになります。
問題がないようであれば y を入力するとコンバートが開始されます。

TASK - [Pre-conversion analysis report] ***********************************
No problems detected during the analysis!

WARNING - ********************************************************
WARNING - The tool allows rollback of any action until this point.
WARNING - By continuing all further changes on the system will need to be reverted manually by the user, if necessary.
WARNING - ********************************************************

Continue with the system conversion? [y/n]: y

プログラムの実行が完了すると、下記のようなConversion successful!のメッセージが出力されます。

TASK - [Final: Update RHSM custom facts] **********************************
Updating RHSM custom facts collected during the conversion.
RHSM custom facts uploaded successfully.

Conversion successful!

WARNING - In order to boot the RHEL kernel, restart of the system is needed.

こちらが確認できたらコンバートプログラムは実行が成功した形になります。再起動後にサードパーティ製のパッケージのクリーニング等を実施ください。

コンバート後、リブートしたシステムのKernelVersionなどを確認すると下記のように出力されます。

# uname -a 
Linux ip-172-31-47-212.ap-northeast-1.compute.internal 3.10.0-1160.95.1.el7.x86_64 #1 SMP Fri Jun 23 08:44:55 EDT 2023 x86_64 x86_64 x86_64 GNU/Linux
# cat /proc/version
Linux version 3.10.0-1160.95.1.el7.x86_64 (mockbuild@x86-vm-39.build.eng.bos.redhat.com) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-44) (GCC) ) #1 SMP Fri Jun 23 08:44:55 EDT 2023
# cat /etc/redhat-release 
Red Hat Enterprise Linux Server release 7.9 (Maipo)

以上のように、CentOS7からRHEL7へのコンバートは移行プログラムを利用して行うことができます。ご利用のシステムの移行を検討される際は、一度検証環境にて実施いただき問題なく導入しているアプリケーションを含めてご確認をいただきました上で、バックアップの取得なども行い、万全の体制にてコンバートを実施してください。


RHEL7 ELS 関連リンク

Red Hat Enterprise Linux 7 の延長サポート(ELS)について
https://redhat.sios.jp/news/rhel7-els/

Red Hat Enterprise Linux 7 Extended Life Cycle Support (ELS) 拡張ライフフェーズが延長のご案内と関するFAQ
https://redhat.sios.jp/news/red-hat-enterprise-linux-7-extended-life-cycle-support-els/

Convert2RHEL サポートポリシー
https://access.redhat.com/ja/articles/7003689