Upgrade RHEL 6 to RHEL 7

Here’s step by step upgrade guide for RHEL Operating System Upgrade from 6 to 7

 

Create /etc/default/grub first:

# cat /etc/default/grub

 

GRUB_TIMEOUT=10

GRUB_DISTRIBUTOR=”$(sed ‘s, release .*$,,g’ /etc/system-release)”

GRUB_DEFAULT=saved

GRUB_DISABLE_SUBMENU=true

GRUB_TERMINAL_OUTPUT=”console”

GRUB_CMDLINE_LINUX=”crashkernel=auto rd.lvm.lv=vg_cicamdb1dr/lv_root rd.lvm.lv=vg_cicamdb1dr/lv_swap ld.lvm.lv=vg_cicamdb1dr/lv_home rhgb quiet”

GRUB_DISABLE_RECOVERY=”true”

 

Patch system to latest Rhel 6.10 first and reboot

# yum clean all

# yum makecache

# yum update

# shutdown -rf now

 

Install pre-req packages for upgrade

# yum install openscap-engine-sce preupgrade-assistant* redhat-upgrade-tool

 

Delete HA related pkgs/files/dirs

# yum remove modcluster corosync luci ricci openais ccs pacemaker pcs fence-agents-all

# rm -rf /etc/cluster/cluster.conf* /etc/corosync/corosync.conf /var/log/cluster /var/log/luci /var/lib/pacemaker /etc/corosync /var/log/pcsd

 

Run the preupg command to perform the assessment of the system

# preupg    (With no options, produces result.html and tar.gz results file)

 

You can run preupg –riskcheck –verbose to view these risks

 

*Some filesystems such as /usr and /var cannot be a separate fs for the upgrade, so you need to copy the contents and remove the lvs (also remove from fstab)

 

/usr separate filesystem

https://access.redhat.com/solutions/909603

 

#  mkdir /mnt/usr/

#  mkdir /mnt/root

#  mount –bind / /mnt/root

#  mount –bind /usr /mnt/usr

#  rsync -aHAXv /mnt/usr/* /mnt/root/usr/

 

Run preupg again to verify if the risk is eliminated or not

# preupg

 

Copy ISO to client:

server:/home/user/upgrade/rhel-server-7.9-x86_64-dvd.iso

 

redhat-upgrade-tool –iso /root/rhel-server-7.9-x86_64-dvd.iso –addrepo rhel-7=http://192.168.0.1/rhel-7-server-rpms/ –cleanup-post –nogpgcheck

 

if some packages fail to upgrade and it fails out you may need to the additional repos

redhat-upgrade-tool –iso /root/rhel-server-7.9-x86_64-dvd.iso –addrepo rhel-7=http://192.168.0.1/rhel-7-server-rpms  –cleanup-post –nogpgcheck

 

if you get an error about redhat-upgrade tool outdated, then use 7.6 iso

 

yum update again to latest Rhel7

# yum clean all

# yum makecache

# yum update

 

Update GRUB2

After /etc/default/grub is created:

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

#grub2-install /dev/sda

 

Reboot to check if it’s using grub2

 

yum update with rhel7 repos

 

Optional: If you did not use the –cleanup-post option when running the Red Hat Upgrade Tool, clean up orphaned RHEL 6 packages:

# rpm -qa | grep .el6 &> /tmp/el6.txt

# rpm -e $(cat /tmp/el6.txt) –nodeps

 

Check for dependency issue

#yum check dependencies

#yum reinstall program_name

 

Install the missing packages from rhel6

#cd /root/preupgrade

#bash noauto_postupgrade.d/install_rpmlist.sh kickstart/RHRHEL7rpmlist_kept

 

Check for clean up again

#rpm -qa | grep .el6 &> /tmp/el6.txt

#rpm -e $(cat /tmp/el6.txt) –nodeps

 

After rhel7 upgrade

systemctl stop NetworkManager && systemctl disable NetworkManager

systemctl stop firewalld.service && systemctl disable firewalld.service

 

service iptables stop

iptables.service