Installing a Fedora KVM VM on a Fedora host

This might seem a little…redundant, but I wanted to be able to test some things on an installation mimicking a fresh installation on my laptop.  So here are some notes on what I’ve done in order to get this going.

If you do not care to read (or about) all the words and explanations, feel free to skip to the SHORT VERSION


I explored vagrant and think it is pretty awesome, but for my purposes, I really wanted to test what I would be doing on my laptop.  And since I am not 100% sure what is baked into any “box” and I didn’t want to dig in, I have decided to just create a VM and do a fresh/net install there.

I could do this with Virtualbox or one of many other virtualization solutions, but I would like to take advantage of KVM since that is the direction that Red Hat has chosen (at least as of this writing).  It should also be noted that Fedora now offers an “upgrade” path but I am too much of a skeptic to explore that at this time and will instead install fresh each time.

01 Requirements

There are some basic virtualization requirements that you need to meet found on the Fedora page below, but most modern processors have these capabilities.  You can ensure virtualization is enabled by running the following command:

egrep '^flags.*(vmx|svm)' /proc/cpuinfo

If that does not spew any output, then you will want to confirm in your BIOS that the virtualization features are enabled on your processor.

NOTE: you will also need a source ISO.  For this post I will be using the netinstall image for Fedora 25.  The purpose for the netinstall image are covered in this post.

02 Install virtualization packages

We will use the virtualization package group and some additional helpful utilities, so install them now:

sudo dnf install -y @virtualization virt-install virt-viewer \

03 Start and enable libvirtd

Start and enable the libvirtd service:

sudo systemctl start libvirtd
sudo systemctl enable libvirtd

You can ensure the service is started by running the following command:

sudo systemctl status libvirtd

NOTE:  you will also want to add your unprivileged user to the newly created libvirt group.  In the following command, replace USERNAME with the appropriate user name:

sudo usermod -a -G libvirt USERNAME

04 Create a VM and start the installation

There are various methods to create a VM but I will be using virt-install on the command line because, well, I like the command line.  It could just as easily be done via virt-manager, but what fun is that.  I will :

sudo virt-install --name f25 --ram 2048 --vcpus 2 --disk size=20,format=qcow2 \
  --cdrom /tmp/Fedora-Workstation-netinst-x86_64-25-1.3.iso \
  --virt-type kvm --os-variant fedora-unknown --graphics spice

NOTE:  I have opted to use os-variant “fedora-unknown” because Fedora 25 is not an option…  Also, the ISO I downloaded is located at /tmp/Fedora-Workstation-netinst-x86_64-25-1.3.iso.  Modify the command above as appropriate for your needs.

A new screen will pop up where you will need to go through the manual installation process unless you have already created and hosted a kickstart file for this version.  I don’t trust myself, so it seems I create myself a new kickstart file each time a version is released.  For this installation I chose Workstation and very generic options, just to get through it.  I did set the root password, but that is about it.

05 Enjoy your VM

After the installation completes you will have a working VM.  It will be sharing the host systems network connection via Network Address Translation (NAT) which might be fine.  You can manage this VM via virsh commands to start/stop and connect or with GUI’s such as virt-manager or even GNOME Boxes (you will need to import this VM).


I will probably only use this initial install to create a default kickstart script which I will modify for my own use.  That file is located in /root/anaconda-ks.cfg.


  • I messed up a few times when creating the VM and found that in addition to “destroying” the messed up VM, I needed to “undefine” it as well
    sudo virsh list --all
    sudo virsh destroy f25
    sudo virsh undefine f25
    sudo virsh vol-delete /var/lib/libvirt/images/f25.qcow2
  • Starting the VM with “Boxes” is different than with virsh; I have the VM started in Boxes, yet sudo virsh list --all tells me that the VM is shut off.  This is puzzling



To avoid tl;dr enjoy this instead:

## 01 Requirements
# ensure your CPU is capable of virtualization and it is enabled:
egrep '^flags.*(vmx|svm)' /proc/cpuinfo
# get the appropriate ISO
# yadda, yadda, yadda
## 02 Install virtualization packages
sudo dnf install -y @virtualization virt-install virt-viewer \
## 03 Start and enable libvirtd
sudo systemctl start libvirtd
sudo systemctl enable libvirtd
# check because you're obsessive:
sudo systemctl status libvirtd
# add normal user to appropriate group
sudo usermod -a -G libvirt USERNAME
## 04 Create a VM and start the installation
sudo virt-install --name f25 --ram 2048 --vcpus 2 --disk size=20,format=qcow2 \
  --cdrom /tmp/Fedora-Workstation-netinst-x86_64-25-1.3.iso \
  --virt-type kvm --os-variant fedora-unknown --graphics spice
# answer all the questions manually (a spice screen will pop up)
## 05 Enjoy your VM

[return to top of page]

Leave a Reply

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