Skip to content

Instantly share code, notes, and snippets.

@grizz
Last active November 23, 2023 15:14
Show Gist options
  • Save grizz/e3668652c0f0b121118ce37d29b06dbf to your computer and use it in GitHub Desktop.
Save grizz/e3668652c0f0b121118ce37d29b06dbf to your computer and use it in GitHub Desktop.
Convert CentOS Stream to AlmaLinux
# swap back to stream repos
# dnf swap centos-{stream,linux}-repos -- only works if the centos-linux-repos package is cached
dnf install --allowerasing https://mirror.rackspace.com/centos-vault/8.5.2111/BaseOS/x86_64/os/Packages/centos-linux-repos-8-3.el8.noarch.rpm
# doesn't work, need to manually flip after update
# dnf swap centos-{stream,linux}-release
# update to centos-vault repos
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[baseos\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/BaseOS/$basearch/os' /etc/yum.repos.d/CentOS-Linux-BaseOS.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[appstream\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/AppStream/$basearch/os' /etc/yum.repos.d/CentOS-Linux-AppStream.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[cr\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/ContinuousRelease/$basearch/os' /etc/yum.repos.d/CentOS-Linux-ContinuousRelease.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[devel\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/Devel/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Devel.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[extras\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/extras/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Extras.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[fasttrack\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/fasttrack/$basearch/os' /etc/yum.repos.d/CentOS-Linux-FastTrack.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[ha\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/HighAvailability/$basearch/os' /etc/yum.repos.d/CentOS-Linux-HighAvailability.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[plus\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/centosplus/$basearch/os' /etc/yum.repos.d/CentOS-Linux-Plus.repo
sudo sed -i -e '/mirrorlist=http:\/\/mirrorlist.centos.org\/?release=$releasever&arch=$basearch&repo=/ s/^#*/#/' -e '/baseurl=http:\/\/mirror.centos.org\/$contentdir\/$releasever\// s/^#*/#/' -e '/^\[powertools\]/a baseurl=https://mirror.rackspace.com/centos-vault/8.5.2111/PowerTools/$basearch/os' /etc/yum.repos.d/CentOS-Linux-PowerTools.repo
# remove packages not in base RHEL
yum remove glibc-gconv-extra NetworkManager-initscripts-updown
# sync to new repo files and reboot
dnf distro-sync
reboot
# switch from Stream release to Linux release
rpm -e --nodeps centos-stream-release
yum install centos-linux-release --releasever=8
# continue on with https://github.com/AlmaLinux/almalinux-deploy
./almalinux-deploy.sh
@josemaX
Copy link

josemaX commented Apr 22, 2022

Worked for me on a Proxmox VM running Icinga over Stream 8. Everything running at first try!

Thanks!!!

@TCMcG008
Copy link

TCMcG008 commented Jun 8, 2022

Been meaning to update you here. Based on your code I've written this version:
https://github.com/TCMcG008/stream-rollback
It's got a bit more stuff due to some errors and hurdles I encountered along the way. IDK if I'll be doing too much more to update it as this is mainly a bridge to get everyone safely away from Stream.

Thank you again, Grizz!
~TCMcG

@grizz
Copy link
Author

grizz commented Jun 8, 2022

Awesome, will use that next time I need to do do it. Cheers!

@ch604
Copy link

ch604 commented Sep 16, 2022

this went pretty well for me up until reboot, its likely that some users will need to rebuild grub per @TCMcG008 's script:

/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment