Ubuntu cloud images with virt-install

Earlier we looked at how we could use Ubuntu cloud images with KVM. Now we will use the libvirt cli virsh and virt-install to do the same process. virt-install is a part of the virt-manager supporting tools.

Fetch the Ubuntu Cloud image

This only need to be done once, or when you want to update the cloud image.

  1. Download a Ubuntu Focal image from Ubuntu Cloud Images.
    wget https://cloud-images.ubuntu.com/focal/current/focal-server-cloudimg-amd64.img
    
  2. Create an empty image in the default storage pool. This is a storage space where we upload the cloud image. Note that we use the correct postfix on the name here.
    virsh vol-create-as default focal-server-cloudimg-amd64.qcow2 20G
    
  3. Upload the downloaded cloud image to the storage pool in the reserved spaced.
    virsh vol-upload focal-server-cloudimg-amd64.qcow2 focal-server-cloudimg-amd64.img --sparse --pool default
    

Create the VM

Now we use the cloud image as a template for all our new VMs. Change the size and virt-install parameters to make it your own.

[Read More]

Bootstrap Debian VM with virt-install

Installing a small Debian VM from scratch with only one partition. Makes later resizing easier. This was done on Fedora 32.

Preparations

Install software

libvirt is already installed on Fedora 32. It’s used in Gnome Boxes. We will not use that for this. We’ll do it the old fashioned way with virt-install.

sudo dnf install -y virt-manager virt-install

User access to libvirt

Add your user to the group libvirt.

sudo usermod -aG libvirtd $USER

Installation

  1. Create a default preseed.cfg file. It contain a random root password for this installation. We change the installation to be atomic layout, just one big partition. This file can be reused to your hearts desire.

    [Read More]

Libvirt and Vagrant

Libvirt is the default toolkit to manage virtualization platforms on Linux. Libvirt and qemu is a great combination with Vagrant. It’s the default combination on most Linux systems, also on my favorite - Fedora.

This combination allows for some awesome features and some restrictions. One of the restrictions is that Ubuntu isn’t available as a box, but Debian is. And Debian is the foundation of Ubuntu, and it’s more open than Ubuntu.

The biggest feature is that it allows for more permanent development environments and direct connection to already existing network bridges.

[Read More]