Upgrade OS: CentOS 7 to Rocky Linux 8#

Caution

There is no official upgrade path from CentOS 7 to CentOS 8 or Rocky Linux.

Instructions here are provided here on a best effort basis, and without warranty. Back up your data before attempting an upgrade.

This section provides instructions on how to upgrade CentOS 7 to Rocky Linux 8.

Requirements#

  • Familiarity with the terminal

  • Root access to the CentOS 7 host.

Manually upgrade CentOS 7 to CentOS 8#

Important

Back up your data. Run at your own risk. There is no official upgrade path from CentOS 7 to CentOS 8. Instructions here are provided here on a best effort basis, and without warranty.

To upgrade a CentOS 7 host to CentOS 8, run as root:

  1. Make sure CentOS 7 is up-to-date:

    yum update -y
    
  2. Remove old kernel packages:

    sudo package-cleanup -y --oldkernels --count=1
    
  3. Reboot:

    reboot
    

Migrate to Rocky Linux using Leapp#

Run the following with root privileges:

  1. Install Leapp:

    yum install -y http://repo.almalinux.org/elevate/elevate-release-latest-el7.noarch.rpm
    yum install -y leapp-upgrade leapp-data-rocky
    
  2. Disable root login via SSH:

    Warning

    This disables logging with root user via SSH. Ensure you have access to the server through a user other than root before continuing.

    echo PermitRootLogin no | tee -a /etc/ssh/sshd_config
    
  3. Generate the Leapp answerfile:

    1. Generate the initial answerfile:

      leapp preupgrade
      
    2. Remediate inhibitors raised by preupgrade.

      leapp answer --section remove_pam_pkcs11_module_check.confirm=True
      
    3. Remediate other inhibitors raised by preupgrade. These are usually found in /var/log/leapp/leapp-report.txt.

      You can run leap answer --section=<section> to address individual inhibitors.

    4. Run preupgrade to make sure that all inhibitors have been addressed.

  4. Once all preupgrade inhibitors have been addressed, run the upgrade command to start migrating from CentOS to Rocky Linux:

    leapp upgrade
    
  5. Once the upgrade completes, clean any dangling packages and reboot:

    dnf clean packages -y
    reboot
    

Tip

Once your system has started up again, you can check the current OS version it is running with:

cat /etc/os-release