1. Home
  2. /
  3. Vagrantfile
  4. /
  5. Simple Vagrantfile

Simple Vagrantfile - Vagrantfile Typing CST Test

Loading…

Simple Vagrantfile — Vagrantfile Code

A simple Vagrantfile to create a single Ubuntu VM with forwarded port 8080.

# vagrant/demo/Vagrantfile
Vagrant.configure("2") do |config|
	config.vm.box = "ubuntu/focal64"
	config.vm.network "forwarded_port", guest: 80, host: 8080
	config.vm.provider "virtualbox" do |vb|
		vb.memory = "1024"
	end
end

Vagrantfile Language Guide

Vagrant is an open-source tool for building and managing virtualized development environments. It uses a Ruby-based Vagrantfile to define the configuration of virtual machines, enabling reproducible and portable development setups.

Primary Use Cases

  • ▸Provisioning portable development VMs
  • ▸Testing infrastructure automation scripts
  • ▸Simulating production environments locally
  • ▸Multi-VM networked environments for complex apps
  • ▸CI/CD pipelines requiring consistent build environments

Notable Features

  • ▸Multi-provider virtualization support
  • ▸Declarative Ruby-based configuration
  • ▸Integration with configuration management
  • ▸Portable and reproducible environments
  • ▸Automated VM lifecycle management (up, halt, destroy)

Origin & Creator

Created by HashiCorp in 2010 to simplify the setup of development environments and eliminate 'it works on my machine' issues.

Industrial Note

Vagrant is widely used in DevOps, cloud-native development, testing, CI/CD pipelines, and hybrid environments where reproducible VMs are critical for collaboration.

Practice Other Languages

CReactPythonC++RustTypeScriptKotlinPHPJavaC#RubyMqlCqlN1qlCypher