Skip to content

Instantly share code, notes, and snippets.

@athamour1
Created November 22, 2023 11:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save athamour1/5f53ee7ceafedbfac55c5fea31d2f207 to your computer and use it in GitHub Desktop.
Save athamour1/5f53ee7ceafedbfac55c5fea31d2f207 to your computer and use it in GitHub Desktop.
Upgrade RHEL 7.9 to 8.9 bash script
#!/bin/bash
# Register the system (if not already done)
# subscription-manager register --username YOUR_USERNAME --password YOUR_PASSWORD
# Verify the system subscription
subscription-manager status
# Enable necessary repositories
subscription-manager repos --enable rhel-7-server-rpms
subscription-manager repos --enable rhel-7-server-extras-rpms
# Unset Red Hat Subscription Manager to use the latest RHEL 7 content
subscription-manager release --unset
# Install yum-plugin-versionlock if not present
yum install yum-plugin-versionlock -y
# Clear any version locks
yum versionlock clear
# Update all packages
yum update -y
# Reboot the system
reboot
# Wait for system to restart and login again
# Install the Leapp utility
yum install leapp-upgrade -y
# Start the upgrade process with target OS version 8.9
leapp upgrade --target 8.9
# Reboot the system to complete the upgrade
reboot
# The script ends here. Monitor the system for any prompts or messages.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment