CentOS6.9からCentOS7へのアップグレード

CentOS6.9をCentOS7へアップグレードします。
ただし、公式サイトの「CentOS Upgrade Tool」の注意書きとして、
DO NOT USE this tool. Warning: use of this tool is currently BROKEN as several system-critical packages are of a higher version number in CentOS 6.7 than they are in CentOS 7 so those do not get upgraded correctly. This renders yum and several other system tools non-functional.
と書かれているように、CentOS6.7以降だとCentOS7よりバージョンが進んでいるパッケージがあるため、注意が必要です。


1. 準備作業

(1) システムのアップデート
現バージョンで、システムのアップデートを行います。
# yum update
アップデートが完了したらサーバを再起動します。
# reboot

(2) アップグレードツールのインストール
まず、アップグレードツールをインストールするためのリポジトリを作成します。
# vi /etc/yum.repos.d/upgradetool.repo
[upg]
name=CentOS-$releasever - Upgrade Tool
baseurl=http://dev.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6

アップグレードツールをインストールします。
yum --enablerepo=upg install redhat-upgrade-tool preupgrade-assistant-contents

(3) OpenSCAPのバージョンダウン
現行のバージョンだとアップグレードに失敗しますので、バージョンダウンを行います。
【現行バージョンの確認】
# rpm -qa | grep openscap
openscap-1.2.13-2.el6.x86_64
バージョンダウンを行います。
# rpm -Uhv --oldpackage http://dev.centos.org/centos/6/upg/x86_64/Packages/openscap-1.0.8-1.0.1.el6.centos.x86_64.rpm
【バージョンの確認】
# rpm -qa | grep openscap
openscap-1.0.8-1.0.1.el6.centos.x86_64

(4) 事前診断
アップグレードを行う前にシステムの診断を行います。
# preupg -s CentOS6_7
Preupg tool doesn't do the actual upgrade.
Please ensure you have backed up your system and/or data in the event of a failed upgrade that would require a full re-install of the system from installation media.
Do you want to continue? y/n
という確認メッセージが表示されますので、「y」を押します。

完了したら、「/root/preupgrade-results/result.html」を確認します。
ここで結果が特に、「needs_action」や「needs_inspection」の項目について、対処が必要な場合は対処を行います。

2. アップグレード作業

アップグレードを実行します。
# redhat-upgrade-tool-cli --network 7 --cleanup-post --instrepo=http://vault.centos.org/centos/7.2.1511/os/x86_64/ --addrepo=CentOS7=http://mirror.centos.org/centos/7/os/x86_64/
Continue with the upgrade [Y/N]?
という確認メッセージが表示されますので、「Y」を押します。

アップグレードが完了し、
Finished. Reboot to start upgrade.
というメッセージが表示されれば、正常に終了しました。
ここで、サーバを再起動します。
# reboot
※アップグレード処理のため、しばらく時間がかかります。

3. アップグレード後のトラブルシューティング

アップグレード後はいろいろと不具合が出てくるので、対応する必要があります。

(1) sshdサービスの起動
アップグレード直後は、sshdサービスが停止しているため、リモートではアクセスできません。
ホスティングサーバなどでは、コントロールパネルなどのコンソールを利用してサーバにログインして、sshdサービスを起動させます。
# ln -s /lib64/libsasl2.so.3 /lib64/libsasl2.so.2
# systemctl start sshd.service
# systemctl enable sshd.service

(2) grep
grepを実行すると
grep: error while loading shared libraries: libpcre.so.0: cannot open shared object file: No such file or directory
というエラーが発生するので、シンボリックリンクを設定します。
# ln -s /lib64/libpcre.so /lib64/libpcre.so.0

(3) yum update
「yum update」を実行すると、エラーが発生する場合があります。
Downloading packages:
Running transaction check
ERROR with transaction check vs depsolve:
httpd-mmn = 20051115 is needed by (installed) mod_perl-2.0.4-11.el6_5.x86_64
この場合には、問題となるソフトウェアをアンインストールします。
# yum remove mod_perl

(4) httpd
Apacheが2.2から2.4にアップグレードされたことでエラーが発生して起動しない現象が発生します。
# apachectl configtest
httpd: Syntax error on line 154 of /etc/httpd/conf/httpd.conf: Cannot load modules/mod_authn_alias.so into server: /etc/httpd/modules/mod_authn_alias.so: cannot open shared object file: No such file or directory
■ mod_authn_alias
The functionality provided by mod_authn_alias in previous versions (i.e., the AuthnProviderAlias directive) has been moved into mod_authn_core.
「mod_authn_core」に機能が移管されたようなので、この設定をコメントアウトします。
# vi /etc/httpd/conf/httpd.conf
#LoadModule authn_alias_module modules/mod_authn_alias.so
■ mod_authn_default、mod_authz_default
These modules have been removed: mod_authn_default, mod_authz_default, mod_mem_cache.
廃止されたようなので、これもコメントアウトします。
#LoadModule authn_alias_module modules/mod_authn_default.so
#LoadModule authn_alias_module modules/mod_authz_default.so
■ mod_ldap、mod_authnz_ldap
mod_ldap: LDAPTrustedClientCert is now consistently a per-directory setting only. If you use this directive, review your configuration to make sure it is present in all the necessary directory contexts.
コメントアウトします。
#LoadModule ldap_module modules/mod_ldap.so
#LoadModule authnz_ldap_module modules/mod_authnz_ldap.so
■ mod_disk_cache
#LoadModule disk_cache_module modules/mod_disk_cache.so
■ DefaultType
The DefaultType directive no longer has any effect, other than to emit a warning if it's used with any value other than none. You need to use other configuration settings to replace it in 2.4.
「DefaultType」は警告を表示するだけになったので、コメントアウトします。
#DefaultType text/plain






最終更新:2018年05月09日 09:50