Scenario / Questions
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.
Find below all possible solutions or suggestions for the above questions..
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 running
yum 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 by
tail -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 by
yum -y update, reboot and check if everything works, so you will know what was broken by upgrade and what has been broken before upgrade.
# relax SELinux temporally (permissive mode) setenforce 0 # switch to dnf yum -y install dnf # remove yum and its files dnf -y remove yum yum-metadata-parser rm -Rf /etc/yum /var/cache/yum # switch to CentOS 8 repo dnf -y upgrade http://vault.centos.org/8.0.1905/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm
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).
dnf -y upgrade https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm
# clean repos metadata dnf clean all # update repos packages to their latest version (centos-release, epel-release, ...) dnf -y update \*release* # remove all kernel packages (system is unbootable until new kernel is installed later), modify if using kernel-plus rpm -e --nodeps $(rpm -q kernel) # remove conflicting package rpm -e --nodeps sysvinit-tools # lets upgrade the system to version 8 dnf -y --releasever=8 --allowerasing --setopt=deltarpm=false distro-sync # install kernel modules (you may need kernel-plus and kernel-plus-modules instead if you have obsolete hardware) dnf -y install kernel-modules # kernel package has been renamed so set DEFAULTKERNEL=kernel-core in /etc/sysconfig/kernel sed -i -e s@DEFAULTKERNEL=kernel@DEFAULTKERNEL=kernel-core@ /etc/sysconfig/kernel # refresh initramfs after additional kernel modules were installed dnf -y reinstall kernel-core # make sure all base packages are in place (change install to update if these groups are already installed) dnf -y group install Core "Minimal Install" # fix SELinux labels during shutdown (it will take a time) touch /.autorelabel
Take a copy/photo of the file
/etc/sysconfig/grub. You may need content of the
GRUB_CMDLINE_LINUX if GRUB loader fall to shell prompt at bootup (root filesystem info). Check list and number of modules in iniramfs image by
lsinitrd /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 have
network-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, press
ESC 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 package
rpmconf (this package is in EPEL repo, so you need to enable this repo first by
dnf -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 by
dnf remove <package>, remove all by
dnf remove $(dnf repoquery --extras). List leaves by
dnf 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
journalctl -xe for errors and warnings. Set AutoUpdates (if you had
yum-cron). Delete rescue kernel by
rm /boot/vmlinuz-0-rescue* /boot/initramfs-0-rescue* and reinstall kernel to get new GRUB rescue menuentry for CentOS 8 by command
dnf -y reinstall kernel-core (the rescue kernel has all possible drivers/modules included). Set proper alternative for Python by
alternatives --config python (pick version 3 or old 2).
I was able to update one machine running CentOS 7 using this guide as reference:
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:
# dnf install http://mirror.bytemark.co.uk/centos/8.0.1905/BaseOS/x86_64/os/Packages/centos-release-8.0-0.1905.0.9.el8.x86_64.rpm
(Notice the version number change in the URL 8 -> 8.0.1905)
I did not need to install
centos-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!
Kubernetes Free Online Tutorial, Kubernetes Beginner Tutorial
DevOps Free Online Tutorial, DevOps Beginner Tutorial
Ansible Free Online Tutorial, Ansible Beginner Tutorial
Docker Free Online Tutorial, Docker Beginner Tutorial
Openstack Free Online Tutorial, Openstack Beginner Tutorial
Disclaimer: This has been sourced from a third party syndicated feed through internet. We are not responsibility or liability for its dependability, trustworthiness, reliability and data of the text. We reserves the sole right to alter, delete or remove (without notice) the content in its absolute discretion for any reason whatsoever.