Introduction
Hello. This post mainly relates to the RHCSA course titled “Linux Academy Red Hat Certified Systems Administrator Prep Course”. I noticed in the intro video that it is mentioned that the Linux Academy based servers may not sufice for working with KVM and it seems to also say that working with KVM would require a physical machine.

At the time of the recording, that may have been true. Its also possible I am misunderstading the message of that video. However, if like me you are interested in working with KVM directly but do not or cannot use a physical machine dedicated solely to the task, this guide should provide information for how it can be done using a VM inside another VM.

What is this guide about?

This guide will detail how to run a KVM guest in a CentOS host that is also a VM guest in its own right. The software used in this guide is all freely and legally available (at least for personal use).

I hope this guide allows people to take an existing physical host, and without altering its OS, install a CentOS VM that will run KVM and host another CentOS VM inside of it.

This can be done using VMWare Workstation Player (I have also done this using ESXi’s free version, but thats beyond the scope of this guide). While it may be possible to do the same using other VM platforms, I will go forward with what I know and have tested.

To visualize this:

Physical Host >> VMWare Workstation >> CentOS (1)>> KVM >> CentOS (2)

Getting Started

How do we get started?

To do this you will need:

  • A physical host machine thats relatively modern, ie: 64 bit CPU and supporting virtualization extensions (Intel VT-x or AMD-V).
  • Physical host machine should have Windows or Linux installed
  • A CentOS ISO (I have tested with 7.3 and 7.4)
  • VMWare Workstation Player (12.5 as of this writing) installed on the host machine (or the paid version, Pro) *I will call this VMWS from now on to make it shorter.
  • A basic understanding of or the ability to lookup how to install VMWare Worstation and the basics of setting up a VM within it.
The process is simple:
  1. If it is not already, install VMWS. I will not explain how as there are plenty of resources describing this.
  2. Once installed, open VMWS.
  3. In the middle, there should be a button to create a new VM.
  4. Select the Custom option
  5. Set/leave hardware compatibility to 12.0 (or matching the version installed)
  6. For guest OS install, point to your CentOS install media (ISO, DVD or USB drive)
  7. On the next screen name the VM whatever you like and the location to your choosing.
  8. Set the number of CPU’s and cores as needed.
  9. Set memory/RAM as needed.
  10. Set desired networking type (leave NAT if unsure)
  11. Set I/O as desired
  12. Set disc type as desired
  13. Create a new virtual disk (change only if you know what you are doing)
  14. Set amount of space and allocation method as desired.
  15. Set disk file as desired.
  16. On the last dialog, before hitting finish, click the Customize Hardware button.
  17. Select Processors on the left of the dialog that comes up.
  18. On the right check off “Virtualize Intel VT-x/EPT or AMD-V/RVI”
  19. Optionally, enable “Virtualize CPU performance counters” (may not be required but I enabled it).
  20. Click close button
  21. Now hit finished.
Step #18 allows the VM you just created to leverage the hardware assisted virtualization extensions of the CPU which is required by KVM.
While installing CentOS be sure to pick something like Server with GUI and check the options for KVM/Virtualization. If you do not you may install it and its dependancies later.
Once it is installed, you should be able to open the virtualization manager in the CentOS guest and create a CentOS VM within it.
Thats it, you should now have a KVM guest inside a VMWS guest on whatever host machine you have without needing to wipe or reconfigure the physical host itself.
If anything is unclear let me know and I can edit/tweak this guide. Hope it helps.
Sources / Resources

Where can we go for more information?

https://www.vmware.com/products/player/playerpro-evaluation.html

https://www.centos.org/

Comments are disabled for this guide.