
Live migration of a RedHat Enteprise Linux 8.0 to Centos 8.0
RHEL 8 to CentOS 8 migration guide.
If you tried a RHEL 8 Beta or you have a Developer’s License of RedHat Enterprise Linux 8 and you want / need to migrate to CentOS 8 for any reason (licensing, cost, hobby, fun) without loosing any data you can do it like this:
Importing CentOS 8 Keys
First of all you need to download, rename and import the CentOS 8 key or yum will fail like this:
1 2 3 |
warning: /var/cache/dnf/AppStream-31fadb45047f5928/packages/GConf2-3.2.6-22.el8.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID 8483c65d: NOKEY CentOS-8 - AppStream 0.0 B/s | 0 B 00:00 Curl error (37): Couldn't read a file:// file for file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial [Couldn't open file /etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial] |
Run this commands:
1 2 3 4 |
[root@server1 ~]# cd /etc/pki/rpm-gpg/ [root@server1 ~]# wget https://www.centos.org/keys/RPM-GPG-KEY-CentOS-Official [root@server1 ~]# cp RPM-GPG-KEY-CentOS-Official RPM-GPG-KEY-centosofficial [root@server1 ~]# gpg --quiet --with-fingerprint RPM-GPG-KEY-centosofficial |
Change Repositories from Redhat’s to CentOS
Disable the subscription manager repo of Redhat:
1 |
[root@server1 ~]# subscription-manager config --rhsm.manage_repos=0 |
1 2 |
[root@server1 ~]# cd /etc/yum.repos.d/ [root@server1 ~]# mv redhat.repo /root/ |
Create or Download CentOS repos:
You need:
CentOS-AppStream.repo CentOS-Base.repo CentOS-Extras.repo CentOS-PowerTools.repo inside /etc/yum.repos.d/
You can create them copying them from here:
1 2 3 4 5 6 7 8 9 |
[root@server1 yum.repos.d]# cat CentOS-AppStream.repo [AppStream] name=CentOS-$releasever - AppStream mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=AppStream&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/AppStream/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial |
1 2 3 4 5 6 7 8 9 |
[root@server1 yum.repos.d]# cat CentOS-Base.repo [BaseOS] name=CentOS-$releasever - Base mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=BaseOS&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/BaseOS/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial |
1 2 3 4 5 6 7 8 9 |
[root@server1 yum.repos.d]# cat CentOS-Extras.repo [extras] name=CentOS-$releasever - Extras mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=extras&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/extras/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial |
1 2 3 4 5 6 7 8 9 10 |
[root@server1 yum.repos.d]# cat CentOS-PowerTools.repo [PowerTools] name=CentOS-$releasever - PowerTools mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=PowerTools&infra=$infra #baseurl=http://mirror.centos.org/$contentdir/$releasever/PowerTools/$basearch/os/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-centosofficial |
Now you have no redhat repos and only CentOS 8 repos in your system. Clean yum:
1 |
[root@server1 ~]# yum clean all |
And try an update:
1 |
[root@server1 ~]# yum update |
It should reinstall every package from the CentOS 8 Repositories.
If it does not, try to create a rpmlist of all installed packages and xargs it to reinstall manually:
1 |
[root@server1 ~]# rpm -qa | sort | sed 's/-[0-9].*[0-9]*//g' > filelist.txt |
1 |
[root@server1 ~]# cat filelist.txt | xargs yum reinstall -y |
If you succeed you should see yum loading only CentOS Repos when issuing a yum install / reinstall like this:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
[root@server1 ~]# yum reinstall yum Updating Subscription Management repositories. CentOS-8 - AppStream 1.4 MB/s | 6.0 MB 00:04 CentOS-8 - Base 1.2 MB/s | 7.9 MB 00:06 CentOS-8 - Extras 671 B/s | 2.1 kB 00:03 CentOS-8 - PowerTools 485 kB/s | 1.8 MB 00:03 Extra Packages for Enterprise Linux 8 - x86_64 513 kB/s | 2.2 MB 00:04 Dependencies resolved. ====================================================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================================================== Reinstalling: yum noarch 4.0.9.2-5.el8 BaseOS 173 k Transaction Summary ====================================================================================================================================================================== Total download size: 173 k Installed size: 59 k Is this ok [y/N]: |
You can also uninstall subscription manager now:
1 |
yum erase dnf-plugin-subscription-manager |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 |
[root@freedom ~]# yum erase dnf-plugin-subscription-manager Updating Subscription Management repositories. Dependencies resolved. ====================================================================================================================================================================== Package Arch Version Repository Size ====================================================================================================================================================================== Removing: dnf-plugin-subscription-manager x86_64 1.23.8-35.el8 @BaseOS 82 k Removing dependent packages: subscription-manager-cockpit noarch 1.23.8-35.el8 @BaseOS 3.2 M subscription-manager-plugin-container x86_64 1.23.8-35.el8 @BaseOS 15 k Removing unused dependencies: python3-ethtool x86_64 0.14-3.el8 @BaseOS 92 k python3-inotify noarch 0.9.6-13.el8 @BaseOS 243 k python3-subscription-manager-rhsm x86_64 1.23.8-35.el8 @BaseOS 369 k subscription-manager x86_64 1.23.8-35.el8 @BaseOS 4.2 M subscription-manager-rhsm-certificates x86_64 1.23.8-35.el8 @BaseOS 0 Transaction Summary ====================================================================================================================================================================== Remove 8 Packages Freed space: 8.2 M Is this ok [y/N]: y Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Running scriptlet: subscription-manager-plugin-container-1.23.8-35.el8.x86_64 1/1 Erasing : subscription-manager-plugin-container-1.23.8-35.el8.x86_64 1/8 Erasing : subscription-manager-cockpit-1.23.8-35.el8.noarch 2/8 Running scriptlet: subscription-manager-1.23.8-35.el8.x86_64 3/8 Erasing : subscription-manager-1.23.8-35.el8.x86_64 3/8 warning: /etc/rhsm/rhsm.conf saved as /etc/rhsm/rhsm.conf.rpmsave Running scriptlet: subscription-manager-1.23.8-35.el8.x86_64 3/8 Erasing : python3-subscription-manager-rhsm-1.23.8-35.el8.x86_64 4/8 Erasing : subscription-manager-rhsm-certificates-1.23.8-35.el8.x86_64 5/8 Erasing : python3-inotify-0.9.6-13.el8.noarch 6/8 Erasing : dnf-plugin-subscription-manager-1.23.8-35.el8.x86_64 7/8 Erasing : python3-ethtool-0.14-3.el8.x86_64 8/8 Running scriptlet: python3-ethtool-0.14-3.el8.x86_64 8/8 Verifying : dnf-plugin-subscription-manager-1.23.8-35.el8.x86_64 1/8 Verifying : python3-ethtool-0.14-3.el8.x86_64 2/8 Verifying : python3-inotify-0.9.6-13.el8.noarch 3/8 Verifying : python3-subscription-manager-rhsm-1.23.8-35.el8.x86_64 4/8 Verifying : subscription-manager-1.23.8-35.el8.x86_64 5/8 Verifying : subscription-manager-cockpit-1.23.8-35.el8.noarch 6/8 Verifying : subscription-manager-plugin-container-1.23.8-35.el8.x86_64 7/8 Verifying : subscription-manager-rhsm-certificates-1.23.8-35.el8.x86_64 8/8 Removed: dnf-plugin-subscription-manager-1.23.8-35.el8.x86_64 subscription-manager-cockpit-1.23.8-35.el8.noarch subscription-manager-plugin-container-1.23.8-35.el8.x86_64 python3-ethtool-0.14-3.el8.x86_64 python3-inotify-0.9.6-13.el8.noarch python3-subscription-manager-rhsm-1.23.8-35.el8.x86_64 subscription-manager-1.23.8-35.el8.x86_64 subscription-manager-rhsm-certificates-1.23.8-35.el8.x86_64 Complete! [root@freedom ~]# yum update Last metadata expiration check: 0:02:33 ago on Tue 15 Oct 2019 07:01:01 PM EEST. Dependencies resolved. Nothing to do. Complete! [root@freedom ~]# |
Don’t forger to grub2-mkconfig !
On RHEL the path is:
grub2-mkconfig -o /boot/efi/EFI/redhat/grub.cfg
You need to use /centos/ like this:
1 |
grub2-mkconfig -o /boot/efi/EFI/centos/grub.cfg |