There are a ton of ways that you can install RHEL 8 on a virtual machine. This guide will cover using KVM with and without virt-manager as well as VirtualBox.

In this tutorial you will learn:

  • How to Install RHEL 8 on KVM With Virt-Manager
  • How to Set Up Your VM in Virt-Manager
  • How to Install RHEL 8
  • How to Install RHEL 8 on KVM Via the CLI
  • How to Create Your VM
  • How to Connect to Your VM Over VNC
  • How to Install RHEL 8 on VirtualBox
  • How to Set Up Your VM on VirtualBox
  • How to Install RHEL 8
Install RHEL 8 on a VM
Install RHEL 8 on a VM.

Software Requirements and Conventions Used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System RHEL 8
Software KVM, Virt-Manger, VirtualBox
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # - requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ - requires given linux commands to be executed as a regular non-privileged user

How to Install RHEL 8 on KVM With Virt-Manager

Virt-Manager is a really simple way to create and manage virtual machines with KVM. If you're running your virtual machines on a workstation, the convenience is unbeatable. Plus, you get the native compatibility and stability that come from KVM, as opposed to external solutions like VirtualBox. Setting your RHEL 8 VM with Virt-Manager is a breeze.

How to Set Up Your VM in Virt-Manager

Open Virt-Manager
Open Virt-Manager.

Open up Virt-Manager on your workstation. Click the "New Virtual Machine" icon in the upper left of the window.

Select Install Type on Virt-Manager
Select Install Type on Virt-Manager.

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


A new window will open to begin the setup process. It will start by asking where you're going to be installing from. Select the first option, "Local install media," and continue.

Choose Install ISO on Virt-Manager
Choose Install ISO on Virt-Manager.

Use the "Browse" field at the top of the window to locate your RHEL install ISO. If you don't see the directory where your file is, use the plus sign(+) button in the bottom left of the window to add the directory.

At the bottom of the window, Virt-Manager should automatically detect RHEL 8 as your operating system. If not, you can try searching for it or enter "Generic." Continue to the next step.

Set VM CPU and RAM on Virt-Manager
Set VM CPU and RAM on Virt-Manager.

This screen allows you to set the allocated memory and number of CPU cores for your virtual machine. While you can change these later, try to pick something reasonable for your machine now.

Set VM HDD on Virt-Manager
Set VM HDD on Virt-Manager.


Next, set the amount of hard drive space you would like to give your VM. Be sure to give it enough for whatever you would like to install on it.

Set VM Name on Virt-Manager
Set VM Name on Virt-Manager.

Finally, give your VM a name, and get ready to kick off the install.

How to Install RHEL 8

A new window will open and launch the RHEL 8 Anaconda installer. You'll be able to run through the install like you would on a normal computer. For assistance, refer to our install guide.

How to Install RHEL 8 on KVM Via the CLI

If you're installing your RHEL 8 VM on a server, or you just prefer to work in the CLI, there's absolutely an option for you with KVM too. You are going to need a client to complete the install over VNC, but after that, you can run your server entirely headless.

How to Create Your VM

Open a terminal on the host machine or SSH into one. You can construct a single install command to spin up your virtual machine. In the end, it should looks something like this:

$ sudo virt-install \
--virt-type=kvm \
--name RHEL8 \
--ram 4096 \
--vcpus=4 \
--os-variant=rhel8.0 \
--cdrom=/path/to/install.iso \
--network=bridge=br0,model=virtio \
--graphics vnc \
--disk path=/var/lib/libvirt/images/rhel8.qcow2,size=20,bus=virtio,format=qcow2

You can probably copy most of that exactly. Remember to set your memory allotment with --ram and your CPU cores with --vcpus. The paths both to your disk and to the --cdrom should point to the place where you want to install RHEL and the install ISO respectively. Also, the size under the --disk flag refers to the size of your virtual drive in gigabytes.

How to Connect to Your VM Over VNC

After you run the command, you'll be informed that the VM is running and waiting for you to connect and complete the install. Run dumpxml with your VM's name to find the VNC port.



# virsh dumpxml RHEL8 | grep vnc

When you have your port, head to your client machine, and tunnel that port over SSH. You don't need to do this part if you're connecting from the same machine.

$ ssh user@192.168.1.110 -L 5901:127.0.0.1:5901

Finally, open your preferred VNC client, and connect. Complete the install as usual.

How to Install RHEL 8 on VirtualBox

VirtualBox is another popular way to set up virtual machines on a workstation. It's a fully graphical option that comes complete with a simple setup process to get your VMs up and running. It's fairly straightforward to get your RHEL 8 VM started on VirtualBox too.

How to Set Up Your VM on VirtualBox

Launch VirtualBox
Launch VirtualBox.

Open up VirtualBox on your host computer. Near the upper left of the window, click the "New" button.

Set OS Type on VirtualBox
Set OS Type on VirtualBox.

SUBSCRIBE TO NEWSLETTER
Subscribe to Linux Career NEWSLETTER and receive latest Linux news, jobs, career advice and tutorials.


The setup will start by asking you to name your VM and select the OS type. Try to match RHEL as closely as possible. Your version of VirtualBox may only support 32bit virtual machines, so keep that in mind when downloading your ISO.

Set RAM Amount on VirtualBox
Set RAM Amount on VirtualBox.

After that, you can set the amount of RAM to allocate for your machine. Choose an amount that you feel will be enough for the machines use.

Create HDD on VirtualBox
Create HDD on VirtualBox.

Next, you'll where you want to create your virtual hard drive. Chances are, the recommended size is way too small. Don't worry, you can change that later. The default location is fine in most cases.

Set HDD Type on VirtualBox
Set HDD Type on VirtualBox.

Then, you'll be asked which type of virtual hard drive you would like. Again, if you don't know the difference, the default option works well.

Set HDD Allocation on VirtualBox
Set OS Type on VirtualBox.

The setup will ask you how you would like to allocate your hard drive space, either dynamically or all at once. This is up to you, but allocating it at once helps reduce the chance of a conflict.

Set HDD Size on VirtualBox
Set HDD Size on VirtualBox.

With that all set, you can set your hard drive size. Pick something that gives you enough space to install everything you need.



VM Added on VirtualBox
VM Added on VirtualBox.

VirtualBox will drop you back to the main window. Now, you'll see your VM listed. Select it, and press the "Start" button at the top of the window.

Select the ISO on VirtualBox
Select the ISO on VirtualBox.

VirtualBox will open a new window and ask you where your install disk is. Use the window's browse function to locate your install ISO. When you're ready, press "Start" to begin.

How to Install RHEL 8

VirtualBox will provide you with a window to the RHEL 8 Anaconda installer. From here, you can follow the regular install process.

Conclusion

Whichever procedure you followed, you should now have a working RHEL 8 install on your virtual machine. From here, your RHEL 8 install is nearly identical to one on bare metal.

ARE YOU LOOKING FOR A LINUX JOB?
Submit your RESUME, create a JOB ALERT or subscribe to RSS feed on LinuxCareers.com.
LINUX CAREER NEWSLETTER
Subscribe to NEWSLETTER and receive latest news, jobs, career advice and tutorials.
DO YOU NEED ADDITIONAL HELP?
Get extra help by visiting our LINUX FORUM or simply use comments below.

You may also be interested in:



Comments and Discussions