Assuming that reinstalling from zero is not practical, how do I perform an update from CentOS 7 to CentOS 8?
I tried to do a yum install http://mirror.bytemark.co.uk/centos/8/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm
but apparently that does not work as one would expect. Running yum update
after this puts yum into an endless recursive attempt to resolve dependencies.
Red Hat provide the tool
leapp
to upgrade from EL 7.6+ to 8, however according to this CentOS bug, there are no plans to support it on CentOS. Trying to point an existing 7.x machine to the 8.x repos and runningyum update
will likely not work; it's never been a supported method. Your only choice is a reinstall.There are manuals around with bugs, so try this (see comments). If something fails, you need to resolve the issue or it won't work. Some steps are hard to reverse and you may end up with unbootable system so be prepared to rescue/reinstall the system from scratch and have backups. Some commands (distro-sync) takes long time and must not be interrupted so if you know how to use
screen
you will be fine (even you'll not be able to reconnect after update, update process finishes in screen, check log bytail -f /var/log/dnf.log
). If don't, upgrade from terminal (no network connection) or over super-stable network connection. You have been warned. It is suggested to update the whole system first byyum -y update
, reboot and check if everything works, so you will know what was broken by upgrade and what has been broken before upgrade.Switch all your active yum/dnf repositories to version 8 or you get strange errors (conflicting packages etc) at distro-sync later. List your repos by
rpm -qf /etc/yum.repos.d/* | sort -u
and IF you get something like epel-release-7-1.el7.noarch update repos by command below (URL parametr is copied from EPEL page). Repeat this paragraph until you have all repos on v8 (Chrome repo doesn't have to be updated).Let's continue:
Take a copy/photo of the file
/etc/sysconfig/grub
. You may need content of theGRUB_CMDLINE_LINUX
if GRUB loader fall to shell prompt at bootup (root filesystem info). Check list and number of modules in iniramfs image bylsinitrd /boot/initramfs-4*.img | grep -c ko.xz
CentOS 8 uses new BLS configuration through directory
/boot/loader/entries/
where every kernel has own config file for every GRUB menu entry (they are sorted alphabeticaly, not by date/time) so/etc/grub2.cfg
has no menuentry and does not need to be updated with kernel. CentOS 8 obsoletes network scripts and moves to NetworkManager. If your network interfaces are handled by network scripts, make sure you havenetwork-scripts
package installed and this service is enabled (systemctl enable network.service
).Cross your fingers and keep handy bootable CentOS 8 DVD (or USB stick) to rescue your system and type
reboot
to boot new system (SELinux autorelabel will take a time, pressESC
key to see what's going on on boot screen, it reboots once when finished).After successful reboot, you may want to check what config files were left behind by
rpmconf -a
from packagerpmconf
(this package is in EPEL repo, so you need to enable this repo first bydnf -y install epel-release
).There will be some packages that are no longer part of CentOS 8 repo (orphans), you may list them by
dnf repoquery --extras
. Remove bydnf remove <package>
, remove all bydnf remove $(dnf repoquery --extras)
. List leaves bydnf repoquery --unneeded
(remove some or all of them).Check SELinux denial messages after reboot by
ausearch -m avc --start recent
(fix them if you have own rules or non-standard setup). Check/var/log/messages
,/var/log/boot.log
andjournalctl -xe
for errors and warnings. Set AutoUpdates (if you hadyum-cron
). Delete rescue kernel byrm /boot/vmlinuz-0-rescue* /boot/initramfs-0-rescue*
and reinstall kernel to get new GRUB rescue menuentry for CentOS 8 by commanddnf -y reinstall kernel-core
(the rescue kernel has all possible drivers/modules included). Set proper alternative for Python byalternatives --config python
(pick version 3 or old 2).I was able to update one machine running CentOS 7 using this guide as reference: https://www.tecmint.com/upgrade-centos-7-to-centos-8/
Thought I had to search for the correct mirror package to upgrade to v8.0 since I had gpg key issues updating directly to v8.1 as suggested in this guide.
So for step 4, this is the command I used:
(Notice the version number change in the URL 8 -> 8.0.1905)
I did not need to install
centos-repos
andcentos-gpg-keys
as mentioned in the guide and was able to carry on with the next steps of the guide.NB: Though I wouldn't really use this on a production server. I'd rather go for a migration. If you can't, make sure you have backuped up everything thouroughly (data AND configurations).
I hope this helps!
Cheers, D