Navigation Menu
Setting Up RHEL 8 on Linode

Setting Up RHEL 8 on Linode

By on Jul 22, 2019 in Article | 0 comments

Background

I have used Linode for about 10 years now because the service and price are great. They are one of the most automated cloud providers and they invest in tools to do things like resizing existing VMs. It’s super useful for lab environments and experiments.  As such, I wanted to use Linode for my new containers running Red Hat UBI on RHEL 8 and eventually OpenShift. There’s just one problem –  no RHEL 8 on Linode, and CentOS 8 isn’t out yet, so Linode hasn’t developed a working process yet.

So, I decided to draw my sysadmin katana and reverse engineer the Linode tools to make it work. Following these instructions, it should take you 5 or 10 minutes to create a RHEL 8 golden image.  Hopefully, this will save you the 10 hours of work it took me to figure out all of the nuances.

Enjoy 🙂

Process

This process will leave you with a fully working RHEL 8 virtual machine image on Linode. You can shrink and expand it, deploy from it, snapshot it for backups just like you would be able to do with an official Linode image. Let’s get started.

On cloud.linode.com

Create a Linode (they call virtual machines Linodes) from the provided Fedora image (Fedora 30 at the time of this writing):

Shutdown the Linode, shrink the root disk (Fedora 30 Disk) to 30GB so that you have room to create another disk. Then, add a 2GB disk (RHEL 8 Grub) which we will use for the image template. Note, you must create the ext4 filesystem with the Linode tools because the mkfs.ext4 in RHEL 8 is too new and won’t work with Linode’s tooling (I just saved you a two hour rat hole):

Modify the Fedora boot configuration so that the newly created volume (RHEL 8 Grub) is accessible as /dev/sdc:

Add another boot configuration which we can use to to test our newly created volume (RHEL 8 Grub). Notice that we specify the RHEL 8 volume as /dev/sda and also boot from /dev/sda with Grub2:

Boot the Linode up in the Fedora boot profile. Now, we have enough room on our root disk to do our work, and also a 2GB volume which we will use for our golden image.

 

At access.redhat.com/downloads

Copy the download link for the RHEL 8 KVM image:

On the Fedora Virtual Machine

Connect to the new Linode instance with SSH:

 

Download the RHEL 8 KVM image using the link from the last section. These instructions were developed using (Red Hat Access 29815 – How to download install disc iso images from RHN using wget or curl?):

 

Now, convert it to an img file so that we can mount it. These instructions were developed using (Red Hat Access 3214311 – Convert raw VM image (img) to qcow2 using qemu-img):

 

Mount the RHEL 8 Grub disk, the RHEL 8 img file, and copy data from the XFS filesystem to the ext4 filesystem. This set of commands essentially copies the data from the RHEL 8 xfs filesystem to the slightly older Linode ext4 filesystem while preserving the SELinux labels:

 

Create a change root for the rest of our work:

 

Modify fstab. Change from UUID to device and critically, remember to change XFS to EXT4:

 

Modify it to look like this:

 

Modify grub2 to use the older boot method so that Linode tools will work with the image (resize, snapshots, imaging, etc). This will disable kernelopt and fall back to writing things out in the grub.cfg file. These instructions were developed using Red Hat KB 3710121 and Install a Custom Distribution on a Linode:

 

Modify it to look like this:

 

Build a new grub.cfg file:

 

Rebuild initrd image. Careful, you may have to modify the kernel version depending on the patch level of the KVM image. Built with instructions from Red Hat KB 1958:

 

Force an SELinux relabeling on first boot:

Disable cloud-init:

 

Disable kdump:

 

Set root password:

 

Unmount everything:

Results

 

On cloud.linode.com

Power the Linode down, and reboot into the RHEL 8 Grub profile to test the image and cause the SELinux relabel:

Power off the RHEL 8 VM, and snap an image of it. Right click on the RHEL 8 Grub disk and select Imagize:

You will now have a new Image (RHEL 8 Core Build) available in Linode:

Results

You now have an image set up on Linode which can be used to deploy as many RHEL 8 instances as you have subscriptions for. This set up is not supported by Red Hat, but nonetheless, I use it because $10/mo for a small instance on Linode is a much better value than almost any other cloud provider. Combined with the fact that their tools allow you to do things like what’s described in this how-to make it an extremely attractive option for power users.

Post a Reply

Your email address will not be published.