Migrating your Linux Distro from RHEL to Oracle!

At #C18LV I had many people asking about my old VTN session, where I walked people through how to go from RHEL to Oracle Linux with only a few reboots, and all with keeping all the existing applications running. They wanted the steps outside of having to watch the video…so here we go!

OracleTux

To start off with Oracle has put a lot of effort into Linux over the years, to the extent that that are often on of the top contributors to the kernel, often with more contributions than the Linux Foundation themselves! If your not familiar with Oracle Linux, here my top 5 reasons  to upgrade;

  1. Oracle Linux is Free
  2. Oracle Support is alot less than RedHat support, usually 40-60% less
  3. You can patch Oracle Linux without a reboot
  4. You get DTrace with Oracle Linux
  5. You get backporting of patches, no more forced upgrades today for a patch

For this example, I am using an older RHEL 6 build, but RHEL7 is a similar process.

Before doing the upgrade, take a look at your /etc/redhat-release file;

[root@demo ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 6.2 (Santiago)
[root@demo ~]#

Also take a look at the kernel version using “uname –a “

[root@demo ~]# uname -a
Linux demo.bubba.local 2.6.32-220.el6.x86_64 #1 SMP Wed Nov 9 08:03:13 EST 2011 x86_64 x86_64 x86_64 GNU/Linux
[root@demo ~]#

The first step is to point to the Oracle Public Yum Server, though if you have a local mirror you can use that just as easily. To do this remove the exiting rhel-source.repo and redhat.repo files and use wget to get the current one from Oracle. When you grab the Oracle yum file, we also need to grab the RPM-GPG file as well.

[root@demo ~]# cd /etc/yum.repos.d/
[root@demo yum.repos.d]# ls
redhat.repo  rhel-source.repo
[root@demo yum.repos.d]# ls -lart
total 24
-rw-r–r–.  1 root root   529 Nov  8  2011 rhel-source.repo
drwxr-xr-x.  2 root root  4096 Apr 28 01:11 .
-rw-r–r–.  1 root root    78 Apr 28 01:11 redhat.repo
drwxr-xr-x. 96 root root 12288 Apr 29 21:51 ..
[root@demo yum.repos.d]# rm *
rm: remove regular file `redhat.repo’? y
rm: remove regular file `rhel-source.repo’? y
[root@demo yum.repos.d]#

Next grab the new GPG key and oracle repo file.

[root@demo yum.repos.d]# wget http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6 -O /etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
–2018-04-29 21:52:50–  http://public-yum.oracle.com/RPM-GPG-KEY-oracle-ol6
Resolving public-yum.oracle.com… 23.36.68.147
Connecting to public-yum.oracle.com|23.36.68.147|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 1011 [text/plain]
Saving to: “/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle”

100%[================================================>] 1,011       –.-K/s   in 0s

2018-04-29 21:52:51 (47.8 MB/s) – “/etc/pki/rpm-gpg/RPM-GPG-KEY-oracle” saved [1011/1011]

[root@demo yum.repos.d]# wget http://public-yum.oracle.com/public-yum-ol6.repo
–2018-04-29 21:53:20–  http://public-yum.oracle.com/public-yum-ol6.repo
Resolving public-yum.oracle.com… 23.43.160.127
Connecting to public-yum.oracle.com|23.43.160.127|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 10544 (10K) [text/plain]
Saving to: “public-yum-ol6.repo”

100%[================================================>] 10,544      –.-K/s   in 0.001s

2018-04-29 21:53:20 (11.3 MB/s) – “public-yum-ol6.repo” saved [10544/10544]

Next, we will remove a RHEL package that is unique to RHEL systems. The –y option eliminates the need to hit “Y” throughout the process. It is part of the Red hat support process, and is not used as we upgrade to Oracle Linux.This is done using the “yum -y erase libreport-plugin-rhtsupport” command. This command will take a few minutes to run.

Finally, we simply patch the OS using “yum –y update”. This will upgrade everything using the latest Oracle public repo. In my example, over 980 packages are getting updated, so this will take a while, so now is a great chance to checkout linux.oracle.com for the latest docs, and  oss.oracle.com where you can learn about some of the Oracle open source products. Also check out github.com/oracle, a very useful site with a ton of repositories with the latest docker and development tools.

When yum finishes up, go ahead and reboot to Oracle Linux! You will also have an /etc/oracle-release file in addition to the updated /etc/redhat-release file. A uname will also show a new kernel.

[root@demo ~]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 6.9 (Santiago)
[root@demo ~]# more /etc/oracle-release
Oracle Linux Server release 6.9
[root@demo ~]# uname -a
Linux demo.bubba.local 2.6.32-696.23.1.el6.x86_64 #1 SMP Wed Mar 14 13:49:54 PDT 2018 x86_64 x86_64 x86_64 GNU/Linux

Next, you can move to the Unbreakable Enterprise Kernel (UEK)  kernel. The UEK kernel is where all the next features come into play.  These features include performance enhancements for both memory management and NVME storage. Docker enhancements, Linux Container enhancements and more. Even Security fixes for the latest CVE, smaller attack profiles via Address Space Layout Randomization and signed kernl modules using kexec.

If you look in /etc/yum.repos.d/public-yum-ol6 you will see that the OUK_latest repo is enabled. This will allow for the latest UEK kernel to be access by yum for installation.

[public_ol6_UEK_latest]
name=Latest Unbreakable Enterprise Kernel for Oracle Linux $releasever ($basearch)
baseurl=
https://yum.oracle.com/repo/OL6/UEK/latest/$basearch/
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-oracle
gpgcheck=1
enabled=1

Next, lets make sure that UEK is the default kernel going forward,  update the file /etc/sysconfig/kernel to make UEK the default kernel. Edit the DEFAULTKERNEL line to use “kernel-uek” instead of “kernel” and save the file.

# UPDATEDEFAULT specifies if new-kernel-pkg should make
# new kernels the default
UPDATEDEFAULT=yes

# DEFAULTKERNEL specifies the default kernel package type
DEFAULTKERNEL=kernel-uek

Now we use yum to install the UEK R4 kernel, the installer will also add UEK to the grub configuration. As a note, you can see what kernel options are available running “yum list kernel*”, this should also force yum to update it’s package list.

Next install the uek kernel “yum install kernel-uek –y” and reboot.

As in the upgrade to Oracle Linux, this will take some time, depending on your Internet bandwidth 5-10 minutes from a US based system. Grab a final  cup of coffee, because you’ll soon you patching using ksplice and reboots will be a thing of the past!

When you OS comes back up, log in and take a look at the kernel name with uname –a

[root@demo ~]# uname -a
Linux demo.bubba.local 2.6.39-400.298.3.el6uek.x86_64 #1 SMP Mon Feb 26 09:51:27 PST 2018 x86_64 x86_64 x86_64 GNU/Linux

You should see the text uek in the build name. Congrats your now running a fast and more secure Linux! Stay tuned for an upcoming post on ksplice!

2 thoughts on “Migrating your Linux Distro from RHEL to Oracle!

Leave a Reply

Your email address will not be published. Required fields are marked *

*