Support for CentOS 6 series ended on November 30, 2020. I decided to upgrade the version in a running project, and there was a CentOS Upgrade Tool, so I tried it.
You can see it by transitioning from the above link. .. .. ** It says "Currently unavailable" **.
It seems that if you have CentOS 6.7 or above, some software packages may have a higher version than the same CentOS 7 package, and you may not be able to update normally.
Please be careful if you have something to try. .. ..
Of course, I think the straightforward method is to create a new server on CentOS 7 (8 ... I'll leave it), add the necessary software packages, and migrate the data. However, due to adult circumstances (?) Such as budget and schedule, we have to upgrade the server with the same server. .. .. In that case, I thought it would be good to know that there is an upgrade tool.
Let's proceed according to the above flow! Don't forget to ** make a backup ** before you start. .. ..
Add a repository to yum.repos.d
to install the upgrade tools.
# vi /etc/yum.repos.d/upgradetool.repo
(Create New)
[upg]
name=CentOS-$releasever - Upgrade Tool
baseurl=https://buildlogs.centos.org/centos/6/upg/x86_64/
gpgcheck=1
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
Install it.
# yum install redhat-upgrade-tool preupgrade-assistant-contents
Loaded plugins: fastestmirror, presto
Determining fastest mirrors
YumRepo Error: All mirror URLs are not using ftp, http[s] or file.
Eg. Invalid release/repo/arch combination/
removing mirrorlist with no valid mirrors: /var/cache/yum/x86_64/6/base/mirrorlist.txt
Error: Cannot find a valid baseurl for repo: base
error. .. .. CentOS 6 seems to have been removed from the mirrorlist server as it was no longer supported on November 30, 2020. Comment out the mirrorlist line with the following settings and add the baseurl. (Change the [updates] and [extras] settings as needed.)
# cp -p /etc/yum.repos.d/CentOS-Base.repo /etc/yum.repos.d/CentOS-Base.repo.bu
# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os (* ← comment out)
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
baseurl=http://vault.centos.org/6.5/os/$basearch/(* ← added)
Install again.
# yum install redhat-upgrade-tool preupgrade-assistant-contents
Loaded plugins: fastestmirror, presto
Determining fastest mirrors
base | 3.7 kB 00:00
Not using downloaded repomd.xml because it is older than what we have:
Current : Fri Oct 24 22:59:03 2014
Downloaded: Thu Nov 28 07:08:25 2013
extras | 2.9 kB 00:00
Not using downloaded repomd.xml because it is older than what we have:
Current : Thu May 21 00:34:00 2015
Downloaded: Fri Nov 7 01:15:00 2014
updates | 2.9 kB 00:00
Not using downloaded repomd.xml because it is older than what we have:
Current : Thu Jul 2 21:22:31 2015
Downloaded: Fri Nov 7 01:20:59 2014
(Omitted in the middle ...)
Error Downloading Packages:
libxml2-2.7.6-17.el6_6.1.x86_64: failure: Packages/libxml2-2.7.6-17.el6_6.1.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
openscap-1.0.8-1.0.1.el6.centos.1.x86_64: failure: Packages/openscap-1.0.8-1.0.1.el6.centos.1.x86_64.rpm from base: [Errno 256] No more mirrors to try.
yum-3.2.29-60.el6.centos.noarch: failure: Packages/yum-3.2.29-60.el6.centos.noarch.rpm from base: [Errno 256] No more mirrors to try.
libxml2-devel-2.7.6-17.el6_6.1.x86_64: failure: Packages/libxml2-devel-2.7.6-17.el6_6.1.x86_64.rpm from updates: [Errno 256] No more mirrors to try.
Also an error. .. .. It seems that the latest one downloaded when browsing the repository is said to be old.
Save the yum cache you are currently holding.
# mv /var/cache/yum/x86_64 /tmp/
Install it again.
# yum install redhat-upgrade-tool preupgrade-assistant-contents
Loaded plugins: fastestmirror, presto
Determining fastest mirrors
base | 3.7 kB 00:00
base/primary_db | 4.4 MB 00:03
extras | 2.9 kB 00:00
extras/primary_db | 19 kB 00:00
updates | 2.9 kB 00:00
updates/primary_db | 5.9 MB 00:03
upg | 1.9 kB 00:00
upg/primary_db | 14 kB 00:00
(Omitted in the middle ...)
Installed:
preupgrade-assistant-contents.noarch 0:0.5.14-1.el6.centos redhat-upgrade-tool.noarch 1:0.7.22-3.el6.centos
Dependency Installed:
libgcrypt-devel.x86_64 0:1.4.5-11.el6_4 libgpg-error-devel.x86_64 0:1.7-4.el6 libxml2-devel.x86_64 0:2.7.6-14.el6_5.2 libxslt.x86_64 0:1.1.26-2.el6_3.1 libxslt-devel.x86_64 0:1.1.26-2.el6_3.1
openscap.x86_64 0:1.0.8-1.0.1.el6.centos.1 pcre-devel.x86_64 0:7.8-6.el6 preupgrade-assistant.x86_64 0:1.0.2-36.0.1.el6.centos zlib-devel.x86_64 0:1.2.3-29.el6
Dependency Updated:
libxml2.x86_64 0:2.7.6-14.el6_5.2 yum.noarch 0:3.2.29-43.el6.centos
Complete!
success! !! !!
Run the upgrade verification tool.
# 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:
(Omitted in the middle ...)
Tarball with results is stored here /root/preupgrade-results/preupg_results-201214042319.tar.gz .
The latest assessment is stored in directory /root/preupgrade .
Summary information:
We found some potential in-place upgrade risks.
Read the file /root/preupgrade/result.html for more details.
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 .
There was no particular problem and it ended normally!
The verification result is output to /root/preupgrade/result.html
, and you are asked to read it, so check it.
We have detected that you are using SELinux.
There were changes in policies which require to apply custom command before upgrade process.
In order to have working SELinux on CentOS 7, you <b>HAVE TO</b> run command prior to running redhat-upgrade-tool:semodule -r sandbox
It says to run the following command before running the upgrade, so run it.
# semodule -r sandbox
At this point you are ready to upgrade. It's time to upgrade.
# 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/
setting up repos...
CentOS7 | 3.6 kB 00:00
CentOS7/primary_db | 6.1 MB 00:00
base | 3.7 kB 00:00
base/primary_db | 4.4 MB 00:03
cmdline-instrepo | 3.6 kB 00:00
cmdline-instrepo/primary_db | 5.3 MB 00:03
extras | 2.9 kB 00:00
extras/primary_db | 19 kB 00:00
updates | 2.9 kB 00:00
updates/primary_db | 5.9 MB 00:03
upg | 1.9 kB 00:00
upg/primary_db | 14 kB 00:00
zabbix | 951 B 00:00
zabbix/primary | 25 kB 00:00
zabbix-non-supported | 951 B 00:00
zabbix-non-supported/primary | 3.8 kB 00:00
.treeinfo | 1.1 kB 00:00
Preupgrade assistant risk check found risks for this upgrade.
You can run preupg --riskcheck --verbose to view these risks.
Addressing high risk issues is required before the in-place upgrade
and ignoring these risks may result in a broken upgrade and unsupported upgrade.
Please backup your data.
(Omitted in the middle ...)
testing upgrade transaction
rpm transaction 100% [========================================================]
rpm install 100% [========================================================]
setting up system for upgrade
Finished. Reboot to start upgrade.
success! !! !! !! !! !!
Reboot to apply CentOS 7.
However, after rebooting, CentOS 7 will change the process startup method from service
to systemctl
, so sshd will not start. .. ..
Set sshd to start after a reboot.
# vi /etc/rc.d/rc.local
(Added at the end)
systemctl enable sshd && systemctl start sshd.service
# chmod +x /etc/rc.d/rc.local
Restart!
# reboot
Broadcast message from hoge
(/dev/pts/0) at 14:31 ...
The system is going down for reboot NOW!
After rebooting, check the version of CentOS.
$ cat /etc/redhat-release
CentOS Linux release 7.9.2009 (Core)
It was CentOS 7 properly! !!
From here on, it's a project-specific story. If you have any related content, please.
By default, the time zone is set to UTC (Coordinated Universal Time), so I changed it to JST (Japan Standard Time).
# timedatectl set-timezone Asia/Tokyo
# date
Monday, December 14, 2020 14:38:04 JST
After the upgrade, zabbix-agent, which was automatically started, no longer starts automatically. .. ..
It seems that zabbix directory is not created in / var/run /
at startup.
I have set the / var/run/zabbix
directory to be created automatically at startup.
vi /etc/tmpfiles.d/zabbix.conf
(New addition)
#Type Path Mode UID GID Age Argument
d /var/run/zabbix 0755 zabbix zabbix -
After the version upgrade, the time synchronization process from the automatically started NTP service to another server is no longer possible. .. .. (It was a situation where synchronization could be achieved by manually stopping and starting the NTP service.)
Check the log when the NTP service starts.
■ At automatic startup
12 Oct 07:43:11 ntpd[332]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
12 Oct 07:43:11 ntpd[332]: Listen and drop on 1 v6wildcard :: UDP 123
12 Oct 07:43:11 ntpd[332]: Listen normally on 2 lo 127.0.0.1 UDP 123
12 Oct 07:43:11 ntpd[332]: Listen normally on 3 lo ::1 UDP 123
12 Oct 07:43:11 ntpd[332]: Listening on routing socket on fd #20 for interface updates
12 Oct 07:43:11 ntpd[332]: Deferring DNS for mta01 1
12 Oct 07:43:11 ntpd[332]: Deferring DNS for mta02 1
12 Oct 07:43:11 ntpd[332]: 0.0.0.0 c016 06 restart
12 Oct 07:43:11 ntpd[332]: 0.0.0.0 c012 02 freq_set ntpd 31.109 PPM
12 Oct 07:43:11 ntpd[338]: signal_no_reset: signal 17 had flags 4000000
12 Oct 07:43:13 ntpd[338]: host name not found: mta01
12 Oct 07:43:13 ntpd[338]: host name not found: mta02
12 Oct 07:43:17 ntpd[332]: Listen normally on 4 eth0 10.0.xxx.xxx UDP 123
12 Oct 07:43:17 ntpd[332]: Listen normally on 5 eth0 fe80::4d2:72ff:fede:783b UDP 123
12 Oct 07:43:17 ntpd[332]: new interface(s) found: waking up resolver
■ At manual startup
12 Oct 10:00:15 ntpd[2777]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
12 Oct 10:00:15 ntpd[2777]: Listen and drop on 1 v6wildcard :: UDP 123
12 Oct 10:00:15 ntpd[2777]: Listen normally on 2 lo 127.0.0.1 UDP 123
12 Oct 10:00:15 ntpd[2777]: Listen normally on 3 eth0 10.0.xxx.xxx UDP 123
12 Oct 10:00:15 ntpd[2777]: Listen normally on 4 lo ::1 UDP 123
12 Oct 10:00:15 ntpd[2777]: Listen normally on 5 eth0 fe80::4d2:72ff:fede:783b UDP 123
12 Oct 10:00:15 ntpd[2777]: Listening on routing socket on fd #22 for interface updates
Hmm. .. ..
At the time of automatic startup, Deferring DNS for mta01
is output, so it seems that the server to be synchronized cannot be seen.
It seems that the recognition of eth0
is a little delayed at the time of automatic startup.
Is this the cause? .. ..
Let's take a look at the settings in /usr/lib/systemd/system/ntpd.service
.
# vi /usr/lib/systemd/system/ntpd.service
[Unit]
Description=Network Time Service
After=syslog.target ntpdate.service sntp.service
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/ntpd
ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Add network.target
to the After setting of [Unit].
# vi /usr/lib/systemd/system/ntpd.service
[Unit]
Description=Network Time Service
After=syslog.target network.target ntpdate.service sntp.service
↑ (Addition)
[Service]
Type=forking
EnvironmentFile=-/etc/sysconfig/ntpd
ExecStart=/usr/sbin/ntpd -u ntp:ntp $OPTIONS
PrivateTmp=true
[Install]
WantedBy=multi-user.target
Reflect the changes.
# systemctl daemon-reload
The time synchronization process is now executed normally even during automatic startup.
14 Oct 18:31:40 ntpd[583]: ntp_io: estimated max descriptors: 1024, initial socket boundary: 16
14 Oct 18:31:40 ntpd[583]: Listen and drop on 0 v4wildcard 0.0.0.0 UDP 123
14 Oct 18:31:40 ntpd[583]: Listen and drop on 1 v6wildcard :: UDP 123
14 Oct 18:31:40 ntpd[583]: Listen normally on 2 lo 127.0.0.1 UDP 123
14 Oct 18:31:40 ntpd[583]: Listen normally on 3 eth0 10.0.111.115 UDP 123
14 Oct 18:31:40 ntpd[583]: Listening on routing socket on fd #20 for interface updates
That's it.
Recommended Posts