Skip to content
DevOps devops cloud 5 min read

Virtual Machines

A virtual machine (a VM — a complete computer that runs as software inside your real computer) is the safest place to learn DevOps. You get a real Ubuntu server you can break, reset, and rebuild without touching your laptop or paying a cloud bill. This page shows you the three best ways to run Ubuntu VMs locally — VirtualBox, KVM/QEMU, and Multipass — so you can follow along with the rest of these docs even if you have never opened a cloud account.

Why run VMs locally

When you are starting out, you will run commands as root (the all-powerful admin user), edit system files, and occasionally make a mistake that bricks the machine. On a local VM that is fine — you delete it and make a new one in seconds. On your main laptop, the same mistake could cost you a weekend.

Local VMs are also free, work offline, and let you practice the exact same apt, systemd, and ufw commands you would later run on a real cloud server. The skills transfer directly.

When NOT to use a local VM: if you need a public IP address that the internet can reach (for a real website, a webhook, or a TLS certificate), a local VM is the wrong tool — rent a small VPS instead (see Renting a VPS). Local VMs live on your private network and are not reachable from outside.

The three options

ToolBest forSpeed to first VMHas a GUI?Cost
MultipassQuick headless Ubuntu servers for practiceSeconds (one command)No (terminal only)Free
VirtualBoxBeginners who want a clickable windowA few minutesYes, full desktop windowFree
KVM/QEMULinux hosts wanting near-native speedMinutesOptional (virt-manager)Free

A quick way to choose:

  • You are on Windows or macOS and want to click buttons: use VirtualBox.
  • You just want an Ubuntu terminal to practice on and you are on any OS: use Multipass (recommended for these docs).
  • You are already on a Linux desktop and want the fastest VMs: use KVM.

Multipass is a tool from Canonical (the company behind Ubuntu) that spins up a ready-to-use Ubuntu VM with a single command. There is no installer wizard and no disk to download manually — it does everything for you. This is the fastest path to a working server.

Install Multipass on Ubuntu

If your host machine is already Ubuntu, install Multipass with snap (Ubuntu’s built-in app installer):

sudo snap install multipass

Output:

multipass 1.14.0 from Canonical✓ installed

On Windows or macOS, download the installer from multipass.run instead — the commands below are identical afterward.

Launch an Ubuntu VM

This creates a VM named lab running Ubuntu 24.04 LTS (LTS means Long-Term Support — the stable release supported for five years), with 2 CPUs, 2 GB of memory, and a 10 GB disk:

multipass launch 24.04 --name lab --cpus 2 --memory 2G --disk 10G

Output:

Launched: lab

Open a shell inside the VM

multipass shell lab

Output:

Welcome to Ubuntu 24.04 LTS (GNU/Linux 6.8.0-31-generic x86_64)
ubuntu@lab:~$

You are now inside a real Ubuntu server. Try the package manager:

sudo apt update && sudo apt install -y nginx

Type exit to leave the VM (it keeps running in the background).

Manage the VM

multipass list          # show all VMs and their IPs
multipass stop lab      # power it off
multipass start lab     # power it back on
multipass delete lab    # mark it for deletion
multipass purge         # permanently free the disk space

Output of multipass list:

Name      State     IPv4             Image
lab       Running   10.230.45.12     Ubuntu 24.04 LTS

The IPv4 address shown is reachable from your host, so you can ssh [email protected] from your laptop terminal.

Option 2: VirtualBox

VirtualBox is a free virtualization app from Oracle with a graphical window — you literally see the Ubuntu desktop in a box on your screen. It is the friendliest option for total beginners because everything is point-and-click.

Install on Ubuntu

sudo apt update
sudo apt install -y virtualbox

Then download the Ubuntu Server or Desktop .iso file (the disk image) from ubuntu.com/download. In the VirtualBox window:

  1. Click New, name it lab, pick type Linux and version Ubuntu (64-bit).
  2. Give it 2048 MB of memory and create a 15 GB virtual disk.
  3. Under Settings → Storage, attach the Ubuntu .iso to the virtual CD drive.
  4. Click Start and follow the Ubuntu installer on screen.

Gotcha: if VirtualBox says “VT-x is disabled” or only offers 32-bit options, your CPU’s virtualization feature is turned off. Reboot into your BIOS/UEFI settings and enable Intel VT-x or AMD-V. Without it, VMs run extremely slowly or not at all.

Option 3: KVM/QEMU

KVM (Kernel-based Virtual Machine) is virtualization built directly into the Linux kernel, so VMs run at nearly the speed of the real hardware. QEMU is the program that runs the VM, and virt-manager is a graphical app to manage it. This is the professional choice on Linux hosts.

Install KVM on Ubuntu

sudo apt update
sudo apt install -y qemu-kvm libvirt-daemon-system virt-manager
sudo adduser "$USER" libvirt

Log out and back in so the group change takes effect. Then check that virtualization is healthy:

kvm-ok

Output:

INFO: /dev/kvm exists
KVM acceleration can be used

Launch the virt-manager app from your menu, click Create a new virtual machine, point it at your Ubuntu .iso, and follow the wizard. KVM is also what most cloud providers run under the hood, so practicing here mirrors production closely.

Best Practices

  • Snapshot before risky changes. In VirtualBox and virt-manager you can take a snapshot (a saved point you can roll back to). Snapshot a clean Ubuntu install so you can reset in one click.
  • Use Multipass for throwaway labs. It is the fastest to create and delete, which encourages you to experiment fearlessly.
  • Match the cloud you will use. Practice on the same Ubuntu LTS version (24.04) your future VPS will run, so commands behave identically.
  • Give VMs enough RAM. 2 GB is the comfortable minimum for Ubuntu Server with Nginx or a database; the desktop edition wants 4 GB.
  • Stop VMs you are not using. Idle VMs still hold memory and CPU; multipass stop or shut them down to keep your laptop responsive.
  • Enable VT-x/AMD-V in BIOS. Hardware virtualization is what makes VMs fast — turn it on once and forget it.
  • Keep one “golden” VM clean. Never install junk on your base image; clone it for each new experiment.
Last updated June 15, 2026
Was this helpful?