Nicholas Dodds

VMs with virt-manager

VMs with virt-manager

Create an Ubuntu Server virtual machine on a remote Linux host, using virt-manager's window forwarded to your Mac or Windows PC over SSH.

Recorded on a Gentoo Linux host with a Mac client and an Ubuntu Server 24.04 guest. Not rerun since; see Testing and references.

What you'll build

An Ubuntu Server VM bridged onto the host's network, with static IPv4 and IPv6 addresses and an SSH server. virt-manager runs on the host; only its window appears on your computer.

Before you start

On a Mac: XQuartz

  1. Download and install XQuartz.
  2. Log out and back in, or restart, so it runs correctly.

On Windows: MobaXterm

MobaXterm includes an SSH client and an X server, with X11 forwarding on by default.

  1. Download and install the Home Edition of MobaXterm.
  2. Start a new SSH session with the host's details.

1. Connect and open virt-manager

  1. Connect to the host from Terminal, or from MobaXterm on Windows. Replace user with your username and your-server-address with the host's name or IP address. The -X flag turns on X11 forwarding, which virt-manager's window needs.

    ssh -X user@your-server-address
  2. Start virt-manager:

    virt-manager

After a few moments the Virtual Machine Manager window appears on your computer. If it stops responding later, see Troubleshooting.

2. Create the VM

  1. Select File > New Virtual Machine.
  2. Select Local install media (ISO image or CDROM) and click Forward.
  3. Click Browse > Browse Local, select the Ubuntu Server ISO, and click Forward.
  4. Set the memory and CPUs, for example 4096 MiB and 4 CPUs, and click Forward.
  5. Create a virtual disk, for example 250 GiB, and click Forward.
  6. Name the VM (the recording used cs181au). Set Network selection to Bridge device, with Device name br0.

    Customize before installing

    Check Customize configuration before install. Without it, virt-manager starts the installation straight away and you miss step 3.

  7. Click Finish.

3. Customize the hardware

  1. On the Overview page, set Chipset to i440FX and Firmware to UEFI.
  2. Select and remove the Tablet and the Sound card.
  3. Select the Video device and set Model to Virtio.
  4. Check the settings and click Apply.

4. Start the installation

Click Begin Installation.

A console window opens and the VM boots from the ISO.

5. Install Ubuntu Server

These steps happen in the Ubuntu installer, in the VM's console.

  1. Edit the network interface: set its IPv4 and IPv6 methods to Manual and enter the VM's addresses, gateways, name servers and search domain. The netplan file in step 6 shows the recorded values. When the summary looks right, select Done.
  2. Choose Use an entire disk, with Set up this disk as an LVM group selected so partitions can be resized later.

    Review the proposed layout; optionally, edit the partitions. Select Done, then Continue to format the virtual disk.

  3. Enter your name, the server's name and a username (the recording used cs181au and ndodds), choose a password, and select Done.
  4. Skip Ubuntu Pro with Continue. Make sure Install OpenSSH server is checked.
  5. Skip the extra snaps with Done. When the installation finishes, select Reboot Now.

6. Finish and check the network

  1. Disconnect the ISO so the VM doesn't boot the installer again. In the VM's hardware details, select SATA CDROM 1, click Disconnect, then Apply. You may need to force the VM to reboot.

  2. Log into the new server from the VM console. The installer sometimes fails to apply both the IPv4 and IPv6 settings, so check the netplan file:

    sudo vim /etc/netplan/50-cloud-init.yaml

    It should hold the full configuration for both. This is the recorded file:

    network:
      version: 2
      ethernets:
        ens3:
          addresses:
            - "134.173.42.103/24"
            - "2620:102:2001:902::103/64"
          nameservers:
            addresses:
              - 134.173.42.2
              - "2620:102:2001:902::2"
            search:
              - cs.hmc.edu
          routes:
            - to: default
              via: "2620:102:2001:902::1"
            - to: default
              via: "134.173.42.1"

    Use your own values

    These addresses belong to the recorded VM. Substitute your assigned addresses, gateways and DNS servers, and your interface name if it isn't ens3.

  3. Validate the file, then try it. netplan try rolls back unless you confirm, so keep the VM console open:

    sudo netplan generate && sudo netplan try

    Confirm only after testing connectivity. If it times out or you cancel, check both the running network and the file from the console; netplan documents rollback caveats.

  4. Ping your IPv4 gateway from the VM:

    ping -c 4 <YOUR_IPV4_GATEWAY>

The ping gets replies. The VM is installed, configured and ready to use.

Troubleshooting

virt-manager stops responding

Force it to quit on the host:

  1. Check it's running; this prints its process ID:

    pgrep virt-manager
  2. Ask it to quit:

    pkill virt-manager
  3. If it's still stuck, force it:

    pkill -9 virt-manager

Testing and references

Recorded on a Gentoo Linux host with a Mac client, creating the cs181au VM. The original notes referred to screenshots of the installer's network screens that aren't included; the netplan file in step 6 shows the recorded values. Selected commands were checked against documentation in September 2026; the setup wasn't rerun.