Linux: Upgrading from Redhat 7 to 8

This document provide instructions on how to upgrade your system from Red Hat Enterprise Linux 7 to Red Hat Enterprise Linux 8 using leapp utility. Not every time you want to create an additional RHEL 8 server first to perform an upgrade and then installing applications on top of it. So this in-place approach which we are referring here is more timesaving and cost-effective if used properly.

PLANNING STAGE – CONSIDERING PRE-PREQUISITES

  1. The server should be having latest variant of RHEL 7 installed. At the time of writing this document it is 7.9
  2. Valid Redhat subscription attached (Here we are using free Developer Subscription provided by Redhat)
  3. Application compatibility with new OS
  4. Thorough analysis of report generated by Leapp utility and fixing the issues reported there.

PREPARING THE SYSTEM FOR UPGRADE

  1. Do have a full system backup (VM snapshot or by any backup utility)
  2. System should be registered with any patching mechanism Like Redhat CDN or Satellite or Free Subscription to feed required packages at time of upgrade.
# subscription-manager list --installed

3. Ensure to have base and extras repository enabled and enable if not already enabled

# subscription-manager repos --enable rhel-7-server-rpms
# subscription-manager repos --enable rhel-7-server-extras-rpms

4. Setting Redhat subscription manager to take content for current release or latest one

# subscription-manager release --set 7.9

OR

# subscription-manager release --unset

5. In case you are using version lock plugin that should also need to be cleared

# yum versionlock clear

6. Update all packages to the latest RHEL 7 version:

# yum update -y

OR 

Customize it as per the inclusion and exclusions as per your requirmenets  

GENRATING AND ANALYZING PRE-UPGRADE REPORT

  1. Install leapp utility and cockpit related packages to view the report in GUI and download additional required data file required for upgrade
# yum install leapp leapp-repository cockpit-leapp wget 

NOTE: BELOW STEPS IN THIS POINT 1 are OBSOLETE now and no more required

# wget https://access.redhat.com/sites/default/files/attachments/leapp-data4.tar.gz

# tar -xzf leapp-data14.tar.gz -C /etc/leapp/files && rm leapp-data14.tar.gz

If above file gives error in extraction, download the file to your local system by putting below URL in browser https://access.redhat.com/node/3664871/5121/0/21161911

—————————————————————-

2. Start the cockpit service and allow in firewall if required (This is for GUI management of logs, if you are comfortable in CLI activity, one can skip this step)

# systemctl enable --now cockpit
# firewall-cmd --permanent --add-port=9090/tcp
# firewall-cmd --reload

Validate if cockpit is opening the Linux console on port 9090 in browser

<primary_ip_address_of_machine>:9090

3. On your RHEL 7 system, perform the pre-upgrade phase either from the command-line interface or from the web console terminal

# leapp preupgrade

4. Analyze the report from CLI or view via cockpit GUI

In left menu select “Upgrade Report”

5. Fix the “inhibitors” or “High Risk” first (Putting command for those which i noticed on current system)

# modprobe -r pata_acpi
# vi /etc/ssh/sshd_config
PermitRootLogin yes
# systemctl restart sshd
# leapp answer --section remove_pam_pkcs11_module_check.confirm=True

6. Notice the activities that might be required to perform after upgrade

# alternatives --set python /usr/bin/python3

UPGRADE PHASE

Upgrade to RHEL 8 using the Leapp utility. leapp will check whether the RHEL 7 system you have is upgradable to RHEL 8. If it is, then, it will start the upgrade process. Otherwise, it will log the problems it detected in the /var/log/leapp/leapp-report.txt file. You can check that file and fix any problem reported there. Once the problem is fixed, you can try to upgrade again.

# leapp upgrade

Reboot the system once above command completes successfully.

On system console, we can see actual upgrade happening.

POST UPGRADE

  1. Validate and apply the recommendations and make the system as similar as previous.
# alternatives --set python /usr/bin/python3
# getenforce

2. Verify if grub is rebuilded properly and remove if any un-necesary kernel consuming /boot space (for example in our case)

# yum list kernel
# yum erase kernel-3.10.0-1160.el7 kernel-3.10.0-1160.45.1.el7

# grub2-mkconfig -o /boot/grub2/grub.cfg

3. Validate if any old rpm not present and clean them if they don’t have any impact on system

# rpm -qa | grep -i el7

Leave a comment