Upgrade RHEL 7 to RHEL 8.6

Reff : https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/8/html-single/upgrading_from_rhel_7_to_rhel_8/index#verifying-the-post-upgrade-state-of-the-rhel-8-system_upgrading-from-rhel-7-to-rhel-8

1. Subscription Red Hat server to Satellite Red Hat

a. unregister and clean subscription existing

# subscription-manager unregister
# subscription-manager remove --all
# subscription-manager clean
# yum remove katello-* -y

b. Subscription Red Hat server to Satellite Red Hat

# rpm -Uvh http://satellite.cimbniaga.co.id/pub/katello-ca-consumer-latest.noarch.rpm
# subscription-manager register --org="PT_CIMB_NIAGA_Tbk" --activationkey="RHEL-REPO"
# yum repolist

2. Update Red Hat 7 to latest version (7.9)

# yum update -y

– reboot OS

3. Preparing a RHEL 7 system for the upgrade

a. Verify that you have the Red Hat Enterprise Linux Server subscription

 # subscription-manager list --installed

Product Name: Red Hat Enterprise Linux Server
Product ID: 69
Version: 7.9
Arch: x86_64
Status: Subscribed
Status Details:
Starts: 05/31/2020
Ends: 05/31/2023

b. Pastikan repo berikut aktif di subscription redhat nya.

- rhel-7-server-rpms
- rhel-7-server-extras-rpms

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

c. Set the Red Hat Subscription Manager to consume the latest RHEL 7 content

# subscription-manager release --unset
# yum versionlock clear (optional)

d. Install the Leapp utility

# yum install leapp-upgrade

e. Download metadata leap-upgrade dan upload ke /home/

Reff : https://access.redhat.com/articles/3664871

versi leapp-data yang digunakan bergantung dengan versi yang di sediakan pada link refrensi diatas.

f. Extract metadata leap-upgrade

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

g. Run leap-upgrade preupgrade to check compatibility

# leapp preupgrade --target 8.6

h. Check on log leap-upgrade preupgrade and fixing all problem

# cat /var/log/leapp/leapp-report.txt

– Fixing Leapp detected loaded kernel drivers pata_acpi

# rmmod pata_acpi

– Disable pam_pkcs11 module in PAM configuration

# leapp answer --section remove_pam_pkcs11_module_check.confirm=True

- Remove packages
- BESAgent
- swiagent
- nessus
- sentinelone
- cdata-odbc-driver-for-db2
- Fixing high risk factor about adobe-mappings-cmap

# cd /etc/leapp/files
# cp pes-events.json pes-events.json.original
# sed -i 's/rhel8-appstream/rhel8-AppStream/g' pes-events.json

i. For easier check log you can install cockpit-leap and akses port 9090

# yum install cockpit-leapp
# systemctl start cockpit
# systemctl enable cockpit

j. Fixing all problem log and rerun command leapp-upgrade until report color is Green

4. Running command upgrade RedHat 7 To RedHat 8.6

# leapp upgrade --target 8.6

after finish run the command, you can reboot the server.

# reboot

5. Reconfig after upgrade RHEL

– remove all packages from the exclude list

# dnf config-manager --save --setopt exclude=''

– Check Old Kernel

# cd /lib/modules && ls -d *.el7*

– Remove weak modules from the old kernel

# [ -x /usr/sbin/weak-modules ] && /usr/sbin/weak-modules --remove-kernel 3.10.0-1062.el7.x86_64
# [ -x /usr/sbin/weak-modules ] && /usr/sbin/weak-modules --remove-kernel 3.10.0-1160.76.1.el7.x86_64

note : sesuaikan dengan versi kernel yang terlisting dari aktivitas command sebelumnya.

– Remove the old kernel from the bootloader entry

# /bin/kernel-install remove 3.10.0-1062.el7.x86_64 /lib/modules/3.10.0-1062.el7.x86_64/vmlinuz
# /bin/kernel-install remove 3.10.0-1160.76.1.el7.x86_64 /lib/modules/3.10.0-1160.76.1.el7.x86_64/vmlinuz

note : sesuaikan dengan versi kernel yang terlisting dari aktivitas command sebelumnya

– Locate remaining RHEL 7 packages:

# rpm -qa | grep -e '\.el[67]' | grep -vE '^(gpg-pubkey|libmodulemd|katello-ca-consumer)' | sort

– Remove remaining Leapp dependency packages

# dnf remove leapp-deps-el8 leapp-repository-deps-el8

– Remove any remaining empty directories

# rm -rf /lib/modules/*el7*

– Verify that the old kernels have been removed from the bootloader entry

# grubby --info=ALL | grep "\.el7" || echo “Old kernels are not present in the bootloader.”

– Changing SELinux mode to enforcing (to update relabeling all file / directory RedHat)

# vi /etc/selinux/config

change SELINUX to Enforcing

– Different in python versions and support RedHat 8

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

– Remove all packages el 7

# rpm -qa | grep el7
# rpm -e {list-packages-el7}