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
Software Requirements and Conventions Used
|Category||Requirements, Conventions or Software Version Used|
|Software||KVM, Virt-Manger, VirtualBox|
|Other||Privileged access to your Linux system as root or via the
# – requires given linux commands to be executed with root privileges either directly as a root user or by use of
$ – 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 up Virt-Manager on your workstation. Click the “New Virtual Machine” icon in the upper left of the window.
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.
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.
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.
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.
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 firstname.lastname@example.org -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
Open up VirtualBox on your host computer. Near the upper left of the window, click the “New” button.
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.
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.
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.
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.
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.
With that all set, you can set your hard drive size. Pick something that gives you enough space to install everything you need.
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.
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.
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.