CentOS7にアップグレードしてみる

素直にクリーンインストールしたほうがいいかもね！（吐血
いろいろ面倒・・・。

[CentOS 6.5から7へアップグレード | 俺的備忘録 〜なんかいろいろ〜](http://orebibou.com/2014/07/centos-6-5%E3%81%8B%E3%82%897%E3%81%B8%E3%82%A2%E3%83%83%E3%83%97%E3%82%B0%E3%83%AC%E3%83%BC%E3%83%89/)

試してみる。

```bash
# yum update
# yum install openscap pcre-devel libxml2-devel libxslt-devel
# yum install m2crypto python-simplejson
# wget http://dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-1.0.2-33.0.2.el6.centos.x86_64.rpm
# wget http://dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-contents-0.5.13-1.0.3.el6.centos.noarch.rpm
# wget http://dev.centos.org/centos/6/upg/x86_64/Packages/preupgrade-assistant-ui-1.0.2-33.0.2.el6.centos.x86_64.rpm
# wget http://dev.centos.org/centos/6/upg/x86_64/Packages/python-rhsm-1.9.7-1.el6.x86_64.rpm
# wget http://dev.centos.org/centos/6/upg/x86_64/Packages/redhat-upgrade-tool-0.7.22-1.el6.noarch.rpm

# rpm -ivh preupgrade-assistant-1.0.2-33.0.2.el6.centos.x86_64.rpm
# rpm -ivh preupgrade-assistant-contents-0.5.13-1.0.3.el6.centos.noarch.rpm
# rpm -ivh python-rhsm-1.9.7-1.el6.x86_64.rpm
# rpm -ivh redhat-upgrade-tool-0.7.22-1.el6.noarch.rpm

# preupg -s RHEL6_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
Specify correct upgrade path parameter like -s RHEL6_7
Upgrade path is provided by command preupg --list

# preupg --list
CentOS6_7

# 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

Gathering logs used by preupgrade assistant:
All installed packages : 01/11 ...finished (time 00:00s)
All changed files      : 02/11 ...finished (time 04:34s)
Changed config files   : 03/11 ...finished (time 00:00s)
All users              : 04/11 ...finished (time 00:00s)
All groups             : 05/11 ...finished (time 00:00s)
Service statuses       : 06/11 ...finished (time 00:00s)
All installed files    : 07/11 ...finished (time 00:02s)
All local files        : 08/11 ...finished (time 00:30s)
All executable files   : 09/11 ...finished (time 00:03s)
RedHat signed packages : 10/11 ...finished (time 00:00s)
CentOS signed packages : 11/11 ...finished (time 00:00s)
Assessment of the system, running checks / SCE scripts:
001/097 ...done    (Configuration Files to Review)
002/097 ...done    (File Lists for Manual Migration)
003/097 ...done    (Bacula Backup Software)
004/097 ...done    (MySQL configuration)
005/097 ...done    (Migration of the MySQL data stack)
006/097 ...done    (General changes in default MySQL implementation)
007/097 ...done    (PostgreSQL upgrade content)
008/097 ...running (GNOME Desktop Environment underwent several design modifications in Red Hat Entedone    (GNOME Desktop Environment underwent several design modifications in Red Hat Enterprise Linux 7 release)
009/097 ...running (KDE Desktop Environment underwent several design modifications in Red Hat Enterpdone    (KDE Desktop Environment underwent several design modifications in Red Hat Enterprise Linux 7 release)
010/097 ...done    (several graphic drivers not supported in Red Hat Enterprise Linux 7)
011/097 ...done    (several input drivers not supported in Red Hat Enterprise Linux 7)
012/097 ...done    (several kernel networking drivers not available in Red Hat Enterprise Linux 7)
013/097 ...done    (several kernel storage drivers not available in Red Hat Enterprise Linux 7)
014/097 ...done    (Names, Options and Output Format Changes in arptables)
015/097 ...done    (BIND9 running in a chroot environment check.)
016/097 ...done    (BIND9 configuration compatibility check)
017/097 ...done    (Move dhcpd/dhcprelay arguments from /etc/sysconfig/* to *.service files)
018/097 ...done    (DNSMASQ configuration compatibility check)
019/097 ...done    (Dovecot configuration compatibility check)
020/097 ...done    (Compatibility Between iptables and ip6tables)
021/097 ...done    (Net-SNMP check)
022/097 ...done    (Squid configuration compatibility check)
023/097 ...done    (Reusable Configuration Files)
024/097 ...done    (VCS repositories)
025/097 ...done    (Added and extended options for BIND9 configuration)
026/097 ...done    (Added options in DNSMASQ configuration)
027/097 ...done    (Packages not signed by CentOS)
028/097 ...done    (Obsoleted rpms)
029/097 ...done    (w3m not available in Red Hat Enterprise Linux 7)
030/097 ...running (report incompatibilities between Red Hat Enterprise Linux 6 and 7 in qemu-guest-done    (report incompatibilities between Red Hat Enterprise Linux 6 and 7 in qemu-guest-agent package)
031/097 ...done    (Removed options in coreutils binaries)
032/097 ...done    (Removed options in gawk binaries)
033/097 ...done    (Removed options in netstat binary)
034/097 ...done    (Removed options in quota tools)
035/097 ...done    (Removed rpms)
036/097 ...done    (Replaced rpms)
037/097 ...done    (GMP library incompatibilities)
038/097 ...done    (optional channel problems)
039/097 ...done    (package downgrades)
040/097 ...done    (restore custom selinux configuration)
041/097 ...done    (General)
042/097 ...done    (samba shared directories selinux)
043/097 ...done    (CUPS Browsing/BrowsePoll configuration)
044/097 ...done    (CVS Package Split)
045/097 ...done    (FreeRADIUS Upgrade Verification)
046/097 ...done    (httpd configuration compatibility check)
047/097 ...done    (bind-dyndb-ldap)
048/097 ...done    (Identity Management Server compatibility check)
049/097 ...done    (IPA Server CA Verification)
050/097 ...done    (NTP configuration)
051/097 ...done    (Information on time-sync.target)
052/097 ...done    (OpenLDAP /etc/sysconfig and data compatibility)
053/097 ...done    (OpenSSH sshd_config migration content)
054/097 ...done    (OpenSSH sysconfig migration content)
055/097 ...done    (Configuration for quota_nld service)
056/097 ...done    (Disk quota netlink message daemon moved into quota-nld package)
057/097 ...done    (SSSD compatibility check)
058/097 ...done    (Luks encrypted partition)
059/097 ...done    (Clvmd and cmirrord daemon management.)
060/097 ...done    (State of LVM2 services.)
061/097 ...done    (device-mapper-multipath configuration compatibility check)
062/097 ...done    (Removal of scsi-target-utils)
063/097 ...done    (Configuration for warnquota tool)
064/097 ...done    (Disk quota tool warnquota moved into quota-warnquota package)
065/097 ...done    (Architecture Support)
066/097 ...done    (Binary rebuilds)
067/097 ...done    (Debuginfo packages)
068/097 ...done    (Cluster and High Availablility)
069/097 ...done    (fix krb5kdc config file)
070/097 ...done    (File Systems, Partitions and Mounts Configuration Review)
071/097 ...done    (Read Only FHS directories)
072/097 ...done    (Sonamebumped libs)
073/097 ...done    (SonameKept Reusable Dynamic Libraries)
074/097 ...done    (Removed .so libs)
075/097 ...done    (In-place Upgrade Requirements for the /usr/ Directory)
076/097 ...done    (CA certificate bundles modified)
077/097 ...done    (Developer Tool Set packages)
078/097 ...done    (Hyper-V)
079/097 ...done    (Content for enabling and disabling services based on RHEL 6 system)
080/097 ...done    (Check for ethernet interface naming)
081/097 ...done    (User modification in /etc/rc.local and /etc/rc.d/rc.local)
082/097 ...done    (cgroups configuration compatibility check)
083/097 ...done    (Plugable authentication modules (PAM))
084/097 ...done    (Foreign Perl modules)
085/097 ...done    (Python 2.7.5)
086/097 ...done    (Ruby 2.0.0)
087/097 ...done    (SCL collections)
088/097 ...done    (Red Hat Network Classic Unsupported)
089/097 ...done    (System kickstart)
090/097 ...done    (YUM)
091/097 ...done    (Check for usage of dangerous range of UID/GIDs)
092/097 ...done    (Incorrect usage of reserved UID/GIDs)
093/097 ...done    (NIS ypbind config files back-up)
094/097 ...done    (NIS Makefile back-up)
095/097 ...done    (NIS server maps check)
096/097 ...done    (NIS server MAXUID and MAXGID limits check)
097/097 ...done    (NIS server config file back-up)
Assessment finished (time 00:00s)
Result table with checks and their results for main contents:
------------------------------------------------------------------------------------------------------------------------------
Tarball with results is stored here /root/preupgrade-results/preupg_results-140726034535.tar.gz .
The latest assessment is stored in directory /root/preupgrade .
Upload results to UI by command:
e.g. preupg -u http://127.0.0.1:8099/submit/ -r /root/preupgrade-results/preupg_results-*.tar.gz .

# redhat-upgrade-tool-cli --network 7.0 --instrepo http://mirror.centos.org/centos/7/os/x86_64/
setting up repos...
cmdline-instrepo                                                             | 3.6 kB     00:00
cmdline-instrepo/primary_db                                                  | 4.9 MB     00:03
epel/metalink                                                                | 6.1 kB     00:00
epel                                                                         | 4.4 kB     00:00
epel/primary_db                                                              | 6.2 MB     00:00
No upgrade available for the following repos: base extras updates
.treeinfo                                                                    | 1.1 kB     00:00
preupgrade-assistant has not been run.
To perform this upgrade, either run preupg or run redhat-upgrade-tool --force

# redhat-upgrade-tool-cli --network 7.0 --instrepo http://mirror.centos.org/centos/7/os/x86_64/ --force

# reboot

[FAILED] Failed to start LSB: Bring up/down networking.
See 'systemctl status network.service' for details.
[  OK  ] Reached target Network.
         Starting OpenSSH server daemon...
         Starting Postfix Mail Transport Agent...
         Starting /etc/rc.d/rc.local Compatibility...
[FAILED] Failed to start /etc/rc.d/rc.local Compatibility.
See 'systemctl status rc-local.service' for details.
         Starting Terminate Plymouth Boot Screen...
         Starting Wait for Plymouth Boot Screen to Quit...
 
CentOS Linux 7 (Core)
Kernel 3.10.0-123.el7.x86_64 on an x86_64
 
localhost login:  
```

# トラブル

## ネットワークが立ち上がらない
* eth0というネットワークデバイス名ではなくなったため。（さくらVPS仮想環境）

```bash
# systemctl start network.service
Job for network.service failed. See 'systemctl status network.service' and 'journalctl -xn' for details.

# cd /etc/init.d
# ./network start
Bringing up interface eth0: ERROR    : [/etc/sysconfig/network-scripts/ifup-eth] Device eth0 does not seem to be present, delaying initialization. [ FAILED ]

# ifconfig -a
ens3: xxxx

# cd /etc/sysconfig/network-scripts
# mv ifcfg-eth0 ifcfg-ens3
# vi ifcfg-ens3
- DEVICE="eth0"
+ DEVICE="ens3"

```

## rc.localが実行されない
* ？

```bash
# systemctl start rc.local
Failed to issue method call: Unit rc.local.service failed to load: No such file or directory.

```

## httpdが起動していない
* apache 2.2から2.4にアップデートしたことで設定ファイルの互換がない様子

```bash
# systemctl enable httpd
# systemctl start httpd
Job for httpd.service failed. See 'systemctl status httpd.service' and 'journalctl -xn' for details.
# systemctl status httpd
httpd[2949]: httpd: Syntax error on line 153 of /etc/httpd/conf/httpd.conf: Cannot load modules/mod_authn_alias.so into server: /etc/httpd/modules/mod_aut... or directory

# yum remove httpd
# yum install httpd
file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6 から鍵を取得中です。
GPG 鍵の取得に失敗しました: [Errno 14] curl#37 - "Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6"
# grep CentOS-6 -r /etc/yum.repos.d/
/etc/yum.repos.d/CentOS-Base.repo.orig:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo.orig:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo.orig:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo.orig:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo.orig:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
/etc/yum.repos.d/CentOS-Base.repo:gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
-> CentOS-7に書き換え
# yum install httpd
# systemctl start httpd
```

## perlモジュールでエラー
* いざ動かしてみるとcpanmで別途インストールしたモジュールがエラーしている
* perlのバージョンが上がったことでバイナリレベルの互換がなくなってしまった様子なので再インストールする

```bash
# less /var/log/httpd/errorlog
/usr/bin/perl: symbol lookup error: /home/ymko/perl5/lib/perl5//x86_64-linux-thread-multi/auto/Data/Dumper/Dumper.so: undefined symbol: Perl_Istack_sp_ptr, refere

$ mv ~/perl5{,.old}
$ curl -L cpanmin.us > cpanm
$ chmod +x cpanm
$ ./cpanm --local-lib=~/perl5 local::lib
$ echo 'eval $(perl -I$HOME/perl5/lib/perl5 -Mlocal::lib)' >> ~/.bashrc
$ source ~/.bashrc

$ cpanm Furl

// CGI.pmは標準モジュールから削除されたので無い
# less /var/log/httpd/errorlog
Can't locate CGI.pm in @INC

$ cpanm CGI
```


# 参考
* [CentOS 7 KVMゲストとしてインストール - ソフトウェアエンジニアリング - Torutk](http://www.torutk.com/projects/swe/wiki/CentOS_7_KVM%E3%82%B2%E3%82%B9%E3%83%88%E3%81%A8%E3%81%97%E3%81%A6%E3%82%A4%E3%83%B3%E3%82%B9%E3%83%88%E3%83%BC%E3%83%AB)
* [Apache HTTPサーバ – Upgrading to 2.4 from 2.2 超意訳版](http://damelog.com/computer/server-administration/apache/apache-http%E3%82%B5%E3%83%BC%E3%83%90-upgrading-to-2-4-from-2-2-%E8%B6%85%E6%84%8F%E8%A8%B3%E7%89%88/)
* [perl: symbol lookup error: とエラーが出てfluent-agent-liteがメッセージを送信してくれない場合 - Studio3104::BLOG.new](http://studio3104.hatenablog.com/entry/20130116/1358304522)