RousselTMLEARNING

TP · Vagrant: From Discovery to Expertise

Lab: My first virtual machine with Vagrant

What you will learn in this TP
  • Create a VM from a Vagrantfile
  • Use the shared folder and port forwarding
  • Destroy cleanly

Creating the machine #

What you will learn in this section
  • Create a VM from a Vagrantfile
  • Use the shared folder and port forwarding
  • Destroy cleanly

Context. You join a project whose dev environment is installed from a 40-line wiki page nobody can follow. Vagrant describes the machine in a file and recreates it identically with one command: you start with the simplest machine.

Prerequisites: VirtualBox (or libvirt) and Vagrant installed  ·  Estimated time: 25 min

From Vagrantfile to a running machine.
  1. 1. Initialise the project

    Why? The Vagrantfile is the single source of truth: the whole team gets the same machine from the same versioned file.

    Create a working folder and generate a Vagrantfile based on the bento/ubuntu-24.04 box.
  2. 2. Start and connect

    Why? Starting then connecting checks the box, provider and network work before investing time in configuration.

    Start the machine, open an SSH session and check the system.
  3. 3. Shared folder and network

    Why? The shared folder avoids copying code into the VM, and port forwarding lets you test from your browser like a real application.

    Serve a file from the project folder inside the VM and expose port 8080 on the host.
  4. 4. Clean up

    Why? Destroying the machine is normal: reproducibility means you can recreate it anytime, the downloaded box staying cached.

    Stop then remove the machine. What remains on disk?

Difficulty level : ●○○○○ (1/5)

My progress

  • ⏱ Estimated time : ≈ 25 min

Sign in to track your progress and take notes. Sign in

💬 Questions about this lesson

No questions yet: be the first to ask for help or share your configuration.

Ask a question about this lesson →

Recommended Articles

Machine learning in Elastic: anomaly detection and AIOps

Automatically detect abnormal behaviour: anomaly detection jobs, datafeeds, detectors, influencer...

The Dynatrace QuickStart app: getting your first data in minutes

Discover the QuickStart app: add data with Auto Discovery or a dedicated tile, read Findings, exp...

Installing OpenObserve and ingesting your first data

Install OpenObserve with Docker Compose or the binary, configure it with its ZO_* variables, send...

Installing Phoenix and tracing your first LLM application

Install Arize Phoenix (pip, Docker), send your first OpenInference traces from an OpenAI applicat...

Installing Zabbix and monitoring your first host

Install Zabbix with Docker Compose (server, PostgreSQL, web interface), install agent 2 on a Linu...

Traefik: overview, architecture and first deployment

Discover Traefik: a cloud-native reverse proxy and load balancer, entrypoints, routers, services,...

Ansible: structuring your code with roles

Create, organize and reuse Ansible roles: directory layout, defaults, tasks, handlers, templates,...

Ansible: generating dynamic files with Jinja2 and facts

Create dynamic configuration files: Jinja2 templates, variables, facts, filters, loops, condition...

Decisions, profiles, allowlists and AppSec in CrowdSec

Manage decisions with cscli, adapt block duration and type with profiles, avoid false positives w...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!