Upgrading from RHEL 7 to RHEL 8

Derek ArmstrongDerek Armstrong
4 min read

Introduction

Upgrading from Red Hat Enterprise Linux (RHEL) 7 to RHEL 8 is a significant step that offers enhanced features, security updates, and improved performance. However, it also comes with potential risks such as breaking existing applications, compatibility issues, or data loss. This guide will walk you through the process with detailed instructions, practical tips, and recovery strategies to ensure a smooth and secure transition.

Preparation Steps

Backup Data

Before starting the upgrade, it's crucial to back up your data. This step is non-negotiable as an upgrade can lead to unforeseen issues.

  • Command Example:

      sudo tar -czvf /backups/important_data_$(date +%Y%m%d).tar.gz /path/to/data
    
💡
If possible, consider making a copy of this backup on a different server or downloading it for safekeeping during the upgrade to ensure everything is secure.

Verify System Status

Ensure your system is updated and functioning properly before continuing.

  • Update System:

      sudo yum update -y
    
  • Check System Status:

      sudo systemctl status
    

Enable Red Hat Subscription and Repositories

Ensure your system is registered with Red Hat and all required repositories for the upgrade are enabled.

  • Check Subscription:

      sudo subscription-manager status
    
  • Enable Repositories:

      sudo subscription-manager repos --enable rhel-7-server-rpms
    

Review Installed Packages

Find all the installed packages to check compatibility with RHEL 8. Focus on third-party or custom software for conflicts.

  • Command Example:

      rpm -qa > installed_packages.txt
    

Install Upgrade Tools (leapp)

Red Hat recommends using the leapp tool for in-place upgrades as it handles compatibility issues and upgrades dependencies efficiently.

  • Install leapp and Required Packages:

      sudo yum install leapp leapp-repository -y
    

Upgrade Process

Step 1: Pre-Upgrade Checks Using leapp

Run pre-upgrade checks to find compatibility issues or conflicts that may occur during the upgrade.

  • Command Example:

      sudo leapp preupgrade
    

After running this command, review the generated report stored at /var/log/leapp/leapp-report.txt for any issues you need to address.

  • Example to View the Report:

      less /var/log/leapp/leapp-report.txt
    

Fix all the issues highlighted before continuing to the next step.

Step 2: Upgrade with leapp

Once all issues are resolved, run the upgrade process as follows:

  • Command Example:

      sudo leapp upgrade
    

Step 3: Reboot into the Upgrade Environment

After the upgrade command, reboot the system to apply changes and complete the upgrade process.

  • Reboot Command:

      sudo reboot
    

Common Pitfalls and Solutions

Dependency Conflicts

Dependency issues may arise during the process. Use these commands for resolution:

  • Clean Cache and Rebuild Metadata:

      sudo dnf clean all && sudo dnf makecache
    
  • Resolve Dependency Problems:

      sudo dnf upgrade --best --allowerasing
    

Package Incompatibilities

If certain packages aren’t supported in RHEL 8, you may need to remove or replace them. Do this carefully to avoid breaking dependencies.

  • Command Example:

      sudo dnf remove package_name
    

SELinux Conflicts

RHEL 8 introduces stricter SELinux policies. Relabel your filesystem to prevent issues.

  • Relabel Filesystem:

      sudo restorecon -Rv /
    

Kernel Issues Causing Instability

If the upgraded kernel causes issues, roll back to an earlier one:

  • Set Default Kernel:

      sudo grub2-set-default 0
    
  • Reboot to apply the changes.


Post-Upgrade Verification

Check Services and Applications

Verify that all critical services and applications are functioning as expected.

  • List Active Services:

      sudo systemctl list-units --type=service
    
  • Check Logs for Issues:

      journalctl -xe
    

Monitor System Performance

Use monitoring tools to ensure the system is performing within expected parameters.

  • Check Disk Usage:

      df -h
    
  • Check Load Average:

      uptime
    

Resolve Post-Upgrade Issues

If any issues persist, consult the leapp logs for more information:

  • Command Example:

      less /var/log/leapp/leapp-upgrade.log
    

Troubleshooting Commands

Use these commands to diagnose and resolve issues:

  • Network Troubleshooting:

      ping example.com
    
  • View Failed Services:

      systemctl --failed
    
  • Rebuild initramfs:

      sudo dracut --regenerate-all --force
    
  • Reinstall Default Kernel Packages:

      sudo dnf reinstall kernel
    

Conclusion and Next Steps

🥳 Congratulations! You have successfully upgraded from RHEL 7 to RHEL 8.

Post-Upgrade Maintenance

  • Keep the system updated by running periodic dnf update.

  • Monitor the system for any performance degradation or anomalies.

  • Subscribe to Red Hat's newsletter for updates and insights into managing your RHEL system.

For more help, consult Red Hat's official documentation or reach out to their support team.

If you find this guide helpful, don't miss more valuable insights and information. Subscribe to my newsletter now for free and stay updated with the latest tips and resources.

📬 Subscribe Now

0
Subscribe to my newsletter

Read articles from Derek Armstrong directly inside your inbox. Subscribe to the newsletter, and don't miss out.

Written by

Derek Armstrong
Derek Armstrong

I share my thoughts on software development and systems engineering, along with practical soft skills and friendly advice. My goal is to inspire others, spark ideas, and discover new passions.