Upgrade RHEL6 to RHEL7
From Notes_Wiki
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:
- Clear the version lock
- yum versionlock clear
- Enable the Extras repository
- subscription-manager repos --enable rhel-6-server-extras-rpms --enable rhel-6-server-optional-rpms
- Install the Preupgrade Assistant and Red Hat Upgrade Tool
- yum install preupgrade-assistant preupgrade-assistant-el6toel7 redhat-upgrade-tool
- Update all packages to their latest RHEL 6 version
- yum update
- shutdown -r now
- 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.
- 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.
- 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:
- Install the yum-utils package
- yum install yum-utils redhat-upgrade-tool
- Disable active repositories:
- yum-config-manager --disable \*
- Download latest RHEL 7 ISO
- Visit the Red Hat Customer Service Portal at https://access.redhat.com/login and enter your user name and password to log in.
- Click Downloads to visit the Software & Download Center.
- In the Red Hat Enterprise Linux area, click Download Software to download the latest version of the software.
- Copy the RHEL 7.9 iso to /root directory
- 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
- Reboot the system when prompted
- shutdown -r now
- (Optionally) Update your new RHEL 7 packages to their latest version
- yum update
- Verify that the system was upgraded to the desired minor version of RHEL 7
- cat /etc/*release
- (Optionally) Install the gnome desktop
- yum groupinstall 'X Window System' 'GNOME'
- (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:
- Ensure that the GRUB Legacy package has been uninstalled
- yum remove grub
- Make sure that the grub2 package has been installed.
- yum install grub2
- Generate the GRUB 2 configuration files
- 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"
- 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
- Set correct ownership and permissions
- chown root:root /etc/default/grub
- chmod 644 /etc/default/grub
- 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
- Generate the GRUB 2 configuration file
- grub2-mkconfig -o /boot/grub2/grub.cfg
- Manually create the /etc/default/grub file with content similar to:
- Testing GRUB 2 with GRUB Legacy bootloader still installed
- 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
- Reboot the system
- When presented with a GRUB Legacy menu, select the "GRUB 2 Test" entry
- When presented with a GRUB 2 menu, select a kernel to boot
- If the above did not work, restart, and do not choose the GRUB 2 Test entry on the next boot.
- For systems with a separate /boot partition, Add a new section into grub.conf '/boot/grub/grub.conf'
- Replacing GRUB Legacy bootloader on systems that use BIOS, if GRUB 2 works successfully
- Replace the GRUB Legacy bootloader with the GRUB 2 bootloader
- grub2-install /dev/sdX
- Remove the old GRUB Legacy configuration file
- mv /boot/grub/grub.conf /boot/grub/grub-old.conf
- Reboot the system
- reboot
- Replace the GRUB Legacy bootloader with the GRUB 2 bootloader
Refer:
- https://access.redhat.com/documentation/en-us/red_hat_enterprise_linux/7/html/system_administrators_guide/ch-working_with_the_grub_2_boot_loader#sec-Upgrading_from_GRUB_Legacy_to_GRUB_2
- https://access.redhat.com/solutions/3185891
- https://access.redhat.com/solutions/5697541