Thursday, May 27, 2021
Converting CentOS 8 Stream to AlmaLinux 8.4
There's no better time to migrate CentOS 8 Stream to AlmaLinux 8.4. Because RedHat Enterprise Linux 8.4 has only just been released, the differences between Stream and 8.4 are minor.
First off, make sure your box is up to date:
dnf distro-sync
Then back it up or snapshot it. Some packages may revert to older versions and break things.
Then download the AlamLinux conversion script
curl -O https://raw.githubusercontent.com/AlmaLinux/almalinux-deploy/master/almalinux-deploy.sh
edit almalinux-deploy.sh
MINIMAL_SUPPORTED_VERSION='8'
In REMOVE_PKGS add "centos-stream-release" "centos-stream-repos"
Amend the grep command in get_os_version:
if ! os_version="$(grep -oP 'CentOS\s+(Linux|Stream)\s+release\s+\K(\d+(\.\d+)?)' \
"${REDHAT_RELEASE_PATH}" 2>/dev/null)"; then
Or alternatively, download my modified install script from my repo:
curl -O https://raw.githubusercontent.com/philrandal/almalinux-deploy/master/almalinux-deploy.sh
Then you're set to go. The script works with CentOS 8.3 and CentOS 8 Stream.
bash almalinux-deploy.sh
and if it succeeds
reboot
After the reboot, check for orphaned packages: I got this from migrating a full CentOS 8 Stream install to AlmaLinux 8.4
dnf list extras Extra Packages
llvm-compat-libs.x86_64 10.0.1-1.module_el8.4.0+533+50191577
They can safely be removed.
When you reboot, you'll see that the original CentOS rescue kernel is still there.
Fix that with:
rm -f /boot/vmlinuz-0-rescue-* /boot/initramfs-0-rescue-*.img
/usr/lib/kernel/install.d/51-dracut-rescue.install add $(uname -r) "" /lib/modules/$(uname -r)/vmlinuz
To remove old CentOS kernels,
rpm -qa | grep kernel-core
Then use yum remove to get rid of any superfluous ones.
Test, test, and test again.
Remove any snapshots once you're happy.
Postscript:
So you just want to convert back to CentOS 8.x from CentOS Stream?
No worries (except for the caveat that downgrades may break things).
curl -O http://mirror.centos.org/centos-8/8.3.2011/BaseOS/x86_64/os/Packages/centos-linux-release-8.3-1.2011.el8.noarch.rpm curl -O http://mirror.centos.org/centos-8/8.3.2011/BaseOS/x86_64/os/Packages/centos-linux-repos-8-2.el8.noarch.rpm
rpm -e --nodeps centos-stream-repos centos-stream-release
rpm -ivh centos-linux-release-8.3-1.2011.el8.noarch.rpm centos-linux-repos-8-2.el8.noarch.rpm
dnf distro-sync
reboot