sq.

Build your first homelab

Start with a fresh Linux machine, then run, inspect, and restore a small Compose project.

Published:

What you will build

A small web application, a Traefik gateway, Prometheus metrics, and a restic backup exercise. The files follow the apps, core, ops grouping used in my repository. They are separate teaching examples with fictional names, not exports of my live configuration.

The first result is deliberately local. You do not need a domain, a VPN subscription, router port forwarding, or cloud credentials. Public access comes later, after you can manage and recover a private service.

Start with an empty practice machine

Use a spare computer or a new virtual machine (a computer simulated inside your existing computer). For this small exercise, allocate 2 CPU cores, 4 GB RAM, and 25 GB disk space. Photo processing, local AI, and large media libraries need additional resources; these figures are not sizing advice for the entire catalog.

Install Ubuntu Server 24.04 LTS from the official Ubuntu download, following the installation tutorial. Choose only the empty disk assigned to this exercise: installation can erase it. Create your own user and password, enable OpenSSH if you want remote terminal access, and record the machine's address from its console. Do not forward router ports to it.

You can run all commands from the machine's console. Alternatively, on your own computer open a terminal and use ssh learner@YOUR_SERVER, replacing both placeholders with your new user and address. Accept a first-time host key only after checking it against the server console. An SSH connection gives you a shell on that other machine; 127.0.0.1 inside it means that machine, not your laptop.

Read in this order

  1. Install Docker and Compose: prepare the host and verify the runtime.
  2. Run the practice lab: download the files, start three containers, and open the application.
  3. Read the Compose settings: understand images, networks, storage, permissions, and limits.
  4. Follow a request through DNS and the gateway: separate name resolution from routing and authorization.
  5. Find a failure with logs and metrics: stop the example application, diagnose it, and bring it back.
  6. Back up and restore a file: verify recovery before storing anything valuable.
  7. Add a real stack: choose one application and work through its configuration, access, data, and recovery needs.

Which commands belong where?

Unless a step says otherwise, commands run on the practice server, inside ~/homelab-practice. Commands that open an SSH tunnel run on your own computer. YAML is configuration to save in a file, not a terminal command. Replace uppercase placeholders before running a command. Do not paste terminal prompt characters such as $.

What is verified?

The practice download contains the configuration and a README with setup and recovery commands. Its routing, metrics, stopped-application recovery, and file restore were checked in a separate practice project. Fresh OS installation and the other stack installations were not part of that test. A working example does not prove the security of your host or later applications.

Keep notes of your own changes: date, image version, changed setting, expected result, actual result, and recovery steps. Those records are what make a homelab reproducible.

All notes →