Upgrade RHEL6 to RHEL7

From Notes_Wiki
Revision as of 06:09, 19 September 2022 by Saurabh (talk | contribs)

Home > RHEL > Upgrade RHEL6 to RHEL7

Overall upgrade from RHEL 6 to RHEL 7 can be done as follows:

Run Pre-upgrade check

For upgrading we need to first run pre-upgrade check:

  1. Clear the version lock
    yum versionlock clear
  2. Enable the Extras repository
    subscription-manager repos --enable rhel-6-server-extras-rpms --enable rhel-6-server-optional-rpms
  3. Install the Preupgrade Assistant and Red Hat Upgrade Tool
    yum install preupgrade-assistant preupgrade-assistant-el6toel7 redhat-upgrade-tool
  4. Update all packages to their latest RHEL 6 version
    yum update
    shutdown -r now
  5. Run the Preupgrade Assistant to perform an assessment of the system
    preupg
    This should generate an HTML file for us to view.
    There are options for preupg such as --cleanup for cleaning up after previos run; -S or --skip-common to skip common tests and -d for debug. Apart from HTML it also generate a log file which mostly has same information as what is displayed on screen.
  6. Resolve problems found by the Preupgrade Assistant during the assessment by following the Remediation text in the report. ##: Sometimes for KDE and Gnome the text will include list of packages that need to be removed. We should remove them using yum for preupg test to succeed.
  7. Run the Preupgrade Assistant again. If there are no new problems to be resolved, you can proceed with upgrading your system


Upgrade OS after successful pre-upgrade test

After that we can upgrade using redhat-upgrade-tool via:

  1. Install the yum-utils package
    yum install yum-utils redhat-upgrade-tool
  2. Disable active repositories:
    yum-config-manager --disable \*
  3. Download latest RHEL 7 ISO
    1. Visit the Red Hat Customer Service Portal at https://access.redhat.com/login and enter your user name and password to log in.
    2. Click Downloads to visit the Software & Download Center.
    3. In the Red Hat Enterprise Linux area, click Download Software to download the latest version of the software.
    4. Copy the RHEL 7.9 iso to /root directory
  4. Start the upgrade
    redhat-upgrade-tool --iso iso_path --cleanup-post
    For example
    redhat-upgrade-tool --iso /root/rhel-server-7.9-x86_64-dvd.iso --cleanup-post
  5. Reboot the system when prompted
    shutdown -r now
  6. (Optionally) Update your new RHEL 7 packages to their latest version
    yum update
  7. Verify that the system was upgraded to the desired minor version of RHEL 7
    cat /etc/*release
  8. (Optionally) Install the gnome desktop
    yum groupinstall 'X Window System' 'GNOME'
  9. (Optionally) Enable and start the graphical environment
    systemctl set-default graphical.target
    systemctl start graphical.target

Refer:


Update grub to grub2

After RHEL6 to RHEL7 upgrade we can upgrade grub to grub2 via:

  1. Ensure that the GRUB Legacy package has been uninstalled
    yum remove grub
  2. Make sure that the grub2 package has been installed.
    yum install grub2
  3. Generate the GRUB 2 configuration files
    1. Manually create the /etc/default/grub file with content similar to:
      GRUB_TIMEOUT=5
      GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
      GRUB_DEFAULT=saved
      GRUB_DISABLE_SUBMENU=true
      #GRUB_TERMINAL_OUTPUT="console"
      GRUB_CMDLINE_LINUX="root=/dev/mapper/volgroup_lv_root rd.lvm.lv=vg_<volgroup>/<lvm_1> rd.lvm.lv=vg_<volgroup>/<lvm_1> custom_parameter_1 custom_parameter_2"
      GRUB_DISABLE_RECOVERY="true"
      GRUB_THEME="/boot/grub2/themes/system/theme.txt"
    2. In the created /etc/default/grub file, change the arguments list for GRUB_CMDLINE_LINUX. You can either fetch the list from /proc/cmdline or from /boot/grub2/grub.cfg
      cat /proc/cmdline
      In the output leave BOOT_IMAGE and its value, copy everything from root= till end of line
    3. Set correct ownership and permissions
      chown root:root /etc/default/grub
      chmod 644 /etc/default/grub
    4. Install GRUB 2 specifing the install device
      grub2-install /dev/<DEVICE_NAME> --grub-setup=/bin/true
      For example
      grub2-install /dev/sda1 --grub-setup=/bin/true
    5. Generate the GRUB 2 configuration file
      grub2-mkconfig -o /boot/grub2/grub.cfg
  4. Testing GRUB 2 with GRUB Legacy bootloader still installed
    1. For systems with a separate /boot partition, Add a new section into grub.conf '/boot/grub/grub.conf'
      title GRUB 2 Test
      root (hd0,0)
      kernel /grub2/i386-pc/core.img
      boot
    2. Reboot the system
    3. When presented with a GRUB Legacy menu, select the "GRUB 2 Test" entry
    4. When presented with a GRUB 2 menu, select a kernel to boot
    5. If the above did not work, restart, and do not choose the GRUB 2 Test entry on the next boot.
  5. Replacing GRUB Legacy bootloader on systems that use BIOS, if GRUB 2 works successfully
    1. Replace the GRUB Legacy bootloader with the GRUB 2 bootloader
      grub2-install /dev/sdX
    2. Remove the old GRUB Legacy configuration file
      mv /boot/grub/grub.conf /boot/grub/grub-old.conf
    3. Reboot the system
      reboot

Refer:



Home > RHEL > Upgrade RHEL6 to RHEL7