DEVOPS, SRE AND CLOUD · PART 0 · START HERE · SETUP · 7 OF 187

DevOps Lab Setup: A Free Linux VM on Any Laptop

Set up the free lab used for the whole track: an Ubuntu 24.04 virtual machine with Multipass (Mac, Windows, Linux) or WSL (Windows), the first commands to check it, Git, Python, curl and Docker inside it, ShopRung running and answering its health check, snapshots so you can break things safely, and what each later part adds (kind, Terraform, LocalStack, an optional AWS free-tier account with a budget alarm).

  1. 1
  2. 2
  3. 3
  4. 4
  5. 5
  6. 6
  7. 7
  8. 8
  9. 9
  10. 10
  11. 11
  12. 12
  13. 13
  14. 14
  15. 15
  16. 16
  17. 17
  18. 18
  19. 19
  20. 20
  21. 21
  22. 22
  23. 23
  24. 24
  25. 25
  26. 26
  27. 27
  28. 28
  29. 29
  30. 30
  31. 31
  32. 32
  33. 33
  34. 34
  35. 35
  36. 36
  37. 37
  38. 38
  39. 39
  40. 40
  41. 41
  42. 42
  43. 43
  44. 44
  45. 45
1 / 12

Press play to hear the narration, or step through at your own pace.

Key takeaways

  • Ubuntu VM (Multipass or WSL)
  • git, python, curl, docker
  • ShopRung healthy
  • snapshot taken

Notes

Why a VM

Why a virtual machine, and not just your laptop's terminal? A VM is a complete Linux computer running inside your laptop: real systemd, real users, disks and networking, exactly what servers run. It is isolated, so when a lab fills the disk or breaks the network, your laptop is fine. You can snapshot it and go back. And it costs nothing. A laptop with eight gigabytes of memory is enough; sixteen is comfortable.

Why a virtual machine
  • real Linux: systemd, users, disks, networking
  • isolated: break it, your laptop is fine
  • snapshots: undo in seconds
  • free: no cloud bill
  • needs: 8 GB RAM laptop (16 GB comfortable)

Mac and Linux

On a Mac or Linux, the simplest tool is Multipass, made by the company behind Ubuntu. Install it from its website, then one command launches Ubuntu twenty four point zero four with a name, two CPUs, four gigabytes of memory and a twenty gigabyte disk. Multipass shell drops you inside it, at a prompt that says ubuntu at devlab. Stop and start it whenever you like. It also works on Windows.

Multipass
# install from multipass.run
$ multipass launch 24.04 \
    --name devlab --cpus 2 \
    --memory 4G --disk 20G
$ multipass shell devlab
ubuntu@devlab:~$

$ multipass stop devlab
$ multipass start devlab

Windows

On Windows you can also use WSL, the Windows Subsystem for Linux. Open PowerShell as administrator, run wsl install with the Ubuntu twenty four point zero four distribution, restart when asked, and choose a username and password. WSL two runs a real Linux kernel, which uname confirms. A few labs about booting and systemd behave differently in WSL, and the lab pages say when, so Multipass is the better choice if you have both.

WSL 2
# PowerShell, as administrator
> wsl --install -d Ubuntu-24.04
# restart when asked
# set a username and password
$ uname -a
Linux ... microsoft-standard-WSL2

also fine: Multipass on
  Windows

Check it

Inside the VM, your first commands answer one question: what machine am I on? The os release file names the system, Ubuntu twenty four point zero four point five on ours. N proc counts CPUs, free shows memory, and d f shows disk space. These four commands are the start of every investigation on an unfamiliar server, and you will see them again in part one.

Look around (our machine)
$ cat /etc/os-release | head -1
PRETTY_NAME="Ubuntu 24.04.5 LTS"
$ nproc
2
$ free -h | head -2
Mem:  7.8Gi total  7.3Gi avail
$ df -h /
# size, used, available

Install tools

Now install the basics with apt, Ubuntu's package manager: Git, curl, Python with its virtual environments, and j q for reading JSON. Docker installs with its official script. Add yourself to the docker group, log out and back in, and run the hello world container to check it works. Part one explains what apt and sudo really do, and part six explains what Docker is doing underneath.

Install the basics
$ sudo apt update
$ sudo apt install -y git curl \
    python3 python3-venv jq
$ curl -fsSL https://get.docker
    .com | sh
$ sudo usermod -aG docker $USER
# log out and in again
$ docker run hello-world

Run ShopRung

Next, ShopRung, the small online shop every lab in this track deploys, monitors and breaks. Download it, unzip it, and start it with npm start. It needs Node twenty two or newer and no other packages. When it says it is running, ask its health check with curl. Status up, app ShopRung, version one point zero point zero. In later parts the same shop moves into containers, a cloud server and Kubernetes.

ShopRung in the VM
# Node.js 22 or newer
$ unzip shoprung.zip && cd shoprung
$ npm start
ShopRung is running at
  http://localhost:8080
$ curl localhost:8080/api/health
{"status":"UP","app":"ShopRung",
 "version":"1.0.0"}

Snapshots

Before a risky lab, take a snapshot. With Multipass, stop the VM and snapshot it with a name like clean; restore goes back to that moment, whatever you broke. With WSL, export the distribution to a file and import it again later. Being able to undo makes you braver, and breaking things on purpose is how you learn what the symptoms look like before you meet them at work.

Snapshots
$ multipass stop devlab
$ multipass snapshot devlab \
    --name clean
$ multipass restore \
    devlab.clean

WSL: export and import
> wsl --export Ubuntu-24.04
    devlab.tar

What comes later

Each later part adds its tools to this same lab. Docker and Compose in part six. In part eight, an optional AWS free-tier account, always with a budget alarm and a teardown step at the end of every lab, so nothing keeps charging you. Terraform and LocalStack, which imitates AWS on your laptop, in part nine. Kind or k three d for Kubernetes in part ten, and Prometheus and Grafana in part eleven.

Added later
  • part 6: Docker and Compose
  • part 8: an AWS free-tier account, with a budget alarm and a teardown step per lab
  • part 9: Terraform, LocalStack (AWS APIs on your laptop)
  • part 10: kind or k3d for Kubernetes
  • part 11: Prometheus, Grafana

Common mistakes

Mistakes. Practising on a work laptop or, worse, a work server. Skipping the snapshot before a risky lab. Giving the VM too little memory, so everything is slow and confusing. Running everything as root, which hides permission problems you need to learn. Cloud labs without a budget alarm or teardown. And pasting commands you have not read; every command in this track is explained so you never need to.

Avoid these
  • practising on your work laptop or a work server
  • no snapshot before a risky lab
  • a VM with 1 GB of memory
  • running everything as root
  • cloud labs with no budget alarm or teardown
  • copying commands you have not read

Say it like this

In the interview: I keep a home lab, an Ubuntu virtual machine with snapshots, Docker and a local Kubernetes cluster. I deploy a small app, break it on purpose, a full disk, bad DNS, a memory leak, and write down how I found and fixed each one. Cloud practice runs on a free tier with budget alarms and a teardown step.

In the interview
  • "I keep a home lab: an Ubuntu
  • VM with snapshots, Docker and a local Kubernetes cluster. I
  • deploy a small app, break it on purpose, and write down how I
  • found and fixed each fault.
  • Cloud work runs on a free tier
  • with budget alarms."

Interview questions

Q1Why practise DevOps in a virtual machine?

It is a real, isolated Linux system (systemd, users, disks, networking) that you can break safely and restore from a snapshot, at no cost.

Q2How do you create an Ubuntu VM with Multipass?

multipass launch 24.04 --name devlab --cpus 2 --memory 4G --disk 20G, then multipass shell devlab.

Q3How do you get Linux on Windows?

WSL 2: wsl --install -d Ubuntu-24.04 in an administrator PowerShell; or Multipass on Windows.

Q4Which commands describe an unfamiliar server first?

cat /etc/os-release, nproc, free -h and df -h: the system, CPUs, memory and disk.

Q5What is a snapshot?

A saved state of the VM you can restore later, undoing any change made after it.

Q6How do you keep cloud labs from costing money?

Use the free tier, set a budget alarm, and run each lab's teardown step; use LocalStack where possible.

Q7How much memory does the lab need?

A laptop with 8 GB of RAM works; 16 GB is comfortable once Kubernetes and monitoring run together.

Q8Why not run everything as root?

It hides permission problems and makes mistakes far more dangerous; use a normal user and sudo when needed.