Creating an Ubuntu Virtual Machine

To create an Ubuntu virtual machine (VM) qcow2 disk image:
  1. Download Ubuntu server 16.04 LTS or 18.04 LTS:
  2. Use virt-manager on a Linux system to create a VM with 2 CPUs, 4 GB RAM and 32 GB hard disk of qcow2 format. Select the option customize configuration before install.
  3. Customize the configuration to change the hard disk bus type to VirtIO.
  4. Start the VM.
  5. Follow the prompts to complete the Ubuntu installation.
  6. Enable the serial console:
    1. Edit the file /etc/default/grub to have the following settings:
      GRUB_CMDLINE_LINUX="console=tty1 console=ttyS0,115200"
      GRUB_TERMINAL="console serial"
      GRUB_SERIAL_COMMAND="serial --speed=115200 --unit=0 --word=8 --parity=no --stop=1"
    2. Update /boot/grub/grub.cfg: update-grub.
  7. (Optional) Update the system and install additional software:
    1. Enable all repositories for apt:
      • apt-add-repository restricted
      • apt-add-repository universe
      • apt-add-repository multiverse
      • apt update
    2. Upgrade Ubuntu and software: apt upgrade.
    3. Reboot if required.
    4. Install additional software:
      • apt install build-essential
      • apt install checkinstall
      • apt install iperf apt install mtools
      • apt install netperf
      • apt install qemu-guest-agent
      • apt install tshark
      • apt install valgrind
      • apt install vim-gnome
      • apt install wireshark
      • apt install xterm
  8. Fill the unused disk space with zeros so that the image interacts well with compression: dd if=/dev/zero of=/mytempfile (will eventually error out with 'out of space', but may take a while):
    rm -f /mytempfile
  9. Shutdown the VM.
  10. Copy the qcow2 disk image onto an ExtremeXOSswitch and install it as a VM. The image is located at /var/lib/libvirt/images/.
    Note

    Note

    If you do not have root access, you the following command to create a copy of the disk image: virsh vol-download --pool default disk_name.qcow2 my_copy.qcow2.
    Note

    Note

    The image size can be reduced substantially because of all the adjacent zeroes: qemu-img convert -O qcow2 my_copy.qcow2 my_reduced_copy.qcow2.