← all builds

From-Scratch Build · Dev Environment

Dev VM Bootstrap

A set of shell scripts that spin up a clean Linux virtual machine and provision it into a ready-to-work development box — the same way, every time, so "set up my dev environment" becomes one command instead of a lost afternoon.

Linux VMShell scriptsProvisioning SSHIdempotent

What it is

A dev machine on demand

A virtual machine is a whole computer running as software inside your real one — its own operating system, isolated from the host. It's the cleanest place to develop: you can install anything, break anything, and throw the whole thing away without touching your actual laptop. The catch is setup. A fresh VM is an empty Linux box, and turning it into a usable workspace — users, keys, packages, Docker, language tools — is tedious and easy to get subtly wrong.

I built this to automate that turning-into-a-workspace step. A handful of scripts create a lightweight Linux VM and then provision it: every package, permission and tweak applied in a defined order, described in code rather than typed by hand. Run it on an empty VM and you get a complete dev environment; run it again and nothing breaks.

The core idea I wanted to learn: a development environment should be disposable. If provisioning is fully scripted, a broken VM isn't a crisis — you delete it and rebuild an identical one in minutes, because the machine is defined by code you can re-run.

The stack

What does the provisioning

The build is a thin orchestration script wrapped around a few well-chosen tools. Here's the role each one plays.

virtualisation

Lightweight VM

A small, fast Linux virtual machine that runs on the host. It's the disposable box everything else is built on top of.

orchestration

Setup script

The single entry point. A shell script that starts the VM, gathers connection details, and kicks off provisioning in the right sequence.

provisioning

Config management

A provisioning tool runs ordered, declarative tasks over SSH — create the user, install packages, set permissions — so the setup is repeatable and auditable.

access

SSH keys

Key-based login wired up automatically, so connecting to the VM is passwordless and a friendly ssh alias just works.

containers

Docker + sudo

The target user is added to the Docker and sudo groups, so the dev box can build and run containers out of the gate.

language tools

Python tooling

A fast Python toolchain and per-directory environment loading, so projects pick up their own settings the moment you cd in.

How it works

From empty VM to ready box

The setup runs as an ordered sequence, and every step is written to be safe to repeat. That property — idempotence — is what lets you re-run the whole thing without fear.

  1. Start the VM live

    Boot a fresh Linux virtual machine, or reuse the existing one if it's already up.

  2. Find the connection live

    Retrieve the VM's SSH connection details automatically, so no address or port is ever copied by hand.

  3. Set up the key live

    Ensure an SSH key exists and install the public half into the VM for passwordless login.

  4. Create the user live

    Add a dedicated non-root user and grant it sudo and docker access.

  5. Run the playbook live

    Hand off to the provisioning tool, which installs packages, language tooling and system tweaks in declarative, ordered tasks.

  6. Snapshot & restore future

    Saved VM snapshots for instant rollback are left as future work — ambitious builds are never quite finished.

How it runs

One script, one alias

Bootstrapping is the whole point. The promise of the build is that the entire path from nothing to a working dev box is a single command — and the result is reachable by a single alias:

In my rebuild I focused on the provision-and-connect path: one ./setup.sh takes an empty VM to a Docker-and-Python-ready box you reach with a plain ssh.

Reflection

What rebuilding it taught me