So first, make sure you're up to date with your installation:
[root@katello01 ~]# yum -y clean all
[root@katello01 ~]# rm -rf /var/cache/yum
[root@katello01 ~]# yum -y makecache fast
[root@katello01 ~]# yum -y update
If any foreman-packages have been updated, go ahead and ensure that your foreman-installation is consistent:
[root@katello01 ~]# foreman-maintain service stop
[root@katello01 ~]# foreman-installer --scenario katello
Make sure that the installer runs without errors before continuing.
Check if you need to reboot the server and reboot it if package updates require it
[root@katello01 ~]# yum needs-restarting -r
[root@katello01 ~]# reboot
The foreman team is hosting a patched version of the leapp upgrade utility, so first download that repo and install the required packages to upgrade. As mentioned earlier, I will be upgrading to Almalinux so I have to install the 'leapp-data-almalinux' package:
[root@katello01 ~]# curl -Lo '/etc/yum.repos.d/theforeman-leapp.repo' -X GET 'https://copr.fedorainfracloud.org/coprs/g/theforeman/leapp/repo/epel-7/group_theforeman-leapp-epel-7.repo'
[root@katello01 ~]# yum -y install leapp leapp-repository leapp-data-almalinux
After the packages have been installed, you will need to add the foreman and katello repos to the leapp_upgrade_repositories.repo file in addition to the currently existing repos:
[root@katello01 ~]# vim /etc/leapp/files/leapp_upgrade_repositories.repo
[leapp-foreman]
name=Foreman 3.3
baseurl=https://yum.theforeman.org/releases/3.3/el8/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-foreman
enabled=1
gpgcheck=1
module_hotfixes=1
[leapp-katello]
name=Katello 4.5
baseurl=https://yum.theforeman.org/katello/4.5/katello/el8/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-foreman
enabled=1
gpgcheck=1
module_hotfixes=1
[leapp-katello-candlepin]
name=Candlepin: an open source entitlement management system.
baseurl=https://yum.theforeman.org/katello/4.5/candlepin/el8/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-foreman
enabled=1
gpgcheck=1
module_hotfixes=1
[leapp-pulpcore]
name=pulpcore: Fetch, Upload, Organize, and Distribute Software Packages.
baseurl=https://yum.theforeman.org/pulpcore/3.18/el8/$basearch/
gpgkey=https://yum.theforeman.org/pulpcore/3.18/GPG-RPM-KEY-pulpcore
enabled=1
gpgcheck=1
module_hotfixes=1
[leapp-foreman-plugins]
name=Foreman plugins 3.3
baseurl=https://yum.theforeman.org/plugins/3.3/el8/$basearch
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-foreman
module_hotfixes=1
[leapp-foreman-client]
name=Foreman client 3.3
baseurl=https://yum.theforeman.org/client/3.3/el8/$basearch
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-foreman-client
[leapp-puppet7]
name=Puppet 7 Repository el 8 - $basearch
baseurl=http://yum.puppetlabs.com/puppet7/el/8/$basearch
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-2025-04-06-puppet7-release
enabled=1
gpgcheck=1
Now that the repositories are added, you'll have to remove the 'epel-release', 'centos-release-scl', and 'centos-release-scl-rh' packages as they are not compatible with the upgrade:
[root@katello01 ~]# yum -y remove epel-release centos-release-scl centos-release-scl-rh
All preparations should be done now so we can continue with running the preupgrade checks using leapp:
[root@katello01 ~]# leapp preupgrade
This tool will point out possible issues with the upgrade that need to be addressed. For me, I had two issues that needed to be taken care of:
[root@katello01 ~]# leapp answer --section authselect_check.confirm=True
[root@katello01 ~]# leapp answer --section remove_pam_pkcs11_module_check.confirm=True
If you've fixed any problems that came up with your installation, rerun 'leapp preupgrade' and ensure that it returns a green state.
OPTIONAL: Check for immutable files on your filesystem:
[root@katello01 ~]# lsattr -aR / 2> /dev/null | grep -iE '\-i\-'
In case you have any immutable files on the filesystem, make sure to remove the attribute before upgrading. This for loop did the trick for me:
[root@katello01 ~]# for file in $(lsattr -aR / 2> /dev/null | grep -iE '\-i\-' | awk '{print $2}'); do chattr -i $file; done
Now that that's been taken care of, go ahead and run the upgrade:
[root@katello01 ~]# leapp upgrade
Once leapp finishes, reboot the machine and let leapp upgrade do its thing. Note that this can take a while depending on disk and cpu performance:
[root@katello01 ~]# reboot
After the reboot, grub will automatically boot into the leapp upgrade boot entry and the system will be upgraded. After the machine is back, check the state of 'leapp_resume':
[root@katello01 ~]# journalctl -fu leapp_resume.service
If 'leapp_resume' has finished, there's still some minor work we have to do to ensure selinux is running in 'enforcing' mode again, python is set to the correct executable and all foreman-services are running as expected. Let's start with the python alternatives entry:
[root@katello01 ~]# alternatives --set python /usr/bin/python3
Enable the 'katello:el8' and 'pulpcore:el8' AppStream Modules:
[root@katello01 ~]# dnf -4y --refresh module enable katello:el8 pulpcore:el8
We're almost done. If you want SELiunx to be enforcing, reinstall 'foreman-selinux' and 'katello-selinux' and edit '/etc/selinux/config':
[root@katello01 ~]# dnf -4y --refresh reinstall foreman-selinux katello-selinux
[root@katello01 ~]# sed -i 's/SELINUX=permissive/SELINUX=enforcing/g' /etc/selinux/config
[root@katello01 ~]# reboot
I'd suggest a reboot at this point just to be sure everything is working as expected.
When the machine is back up, you're almost done with the upgrade, there's just some minor cleanup tasks left to do. Once again, ensure foreman and all foreman-services are consistent:
[root@katello01 ~]# foreman-maintain service stop
[root@katello01 ~]# foreman-installer --scenario katello
Optionally, remove the previously installed leapp-packages and repo file:
[root@katello01 ~]# dnf -4y --refresh remove leapp leapp-repository leapp-data-almalinux
[root@katello01 ~]# rm -f /etc/yum.repos.d/theforeman-leapp.repo
That's it, the upgrade is done from el7 to el8 and everything should be right back where you left it on el7. Be sure to test the instance though to confirm functionality.
Freel free to comment and / or suggest a topic.
Comments
Post a Comment