Vagrant is a tool for building and managing virtual machine environments. Combined with VirtualBox as the hypervisor, Vagrant lets developers spin up reproducible development environments from a simple Vagrantfile configuration. This guide installs Vagrant and VirtualBox on Ubuntu 26.04 LTS.
Tested and valid on:
- Ubuntu 26.04 LTS
Prerequisites
- Ubuntu 26.04 LTS (desktop or server with hardware virtualisation support)
- A user with sudo privileges
- VT-x/AMD-V enabled in BIOS
Step 1 – Install VirtualBox
sudo apt update
sudo apt install virtualbox -y
vboxmanage --version
Step 2 – Add User to vboxusers Group
sudo usermod -aG vboxusers $USER
newgrp vboxusers
Step 3 – Install Vagrant
wget -O- https://apt.releases.hashicorp.com/gpg |
gpg --dearmor |
sudo tee /usr/share/keyrings/hashicorp-archive-keyring.gpg > /dev/null
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg]
https://apt.releases.hashicorp.com $(lsb_release -cs) main" |
sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant -y
vagrant --version
Step 4 – Create a Vagrantfile
mkdir ~/vagrant-demo && cd ~/vagrant-demo
vagrant init ubuntu/jammy64
Step 5 – Start the Virtual Machine
vagrant up
vagrant ssh
Step 6 – Common Vagrant Commands
vagrant status # show VM status
vagrant halt # gracefully stop VM
vagrant reload # restart and apply Vagrantfile changes
vagrant destroy -f # destroy the VM
vagrant snapshot save # take a snapshot
Step 7 – Multi-Machine Vagrantfile
cat > Vagrantfile << 'EOF'
Vagrant.configure('2') do |config|
config.vm.define 'web' do |web|
web.vm.box = 'ubuntu/jammy64'
web.vm.network 'private_network', ip: '192.168.56.10'
end
config.vm.define 'db' do |db|
db.vm.box = 'ubuntu/jammy64'
db.vm.network 'private_network', ip: '192.168.56.11'
end
end
EOF
vagrant up
Conclusion
Vagrant and VirtualBox are installed on Ubuntu 26.04 LTS. Share Vagrantfiles with your team to ensure everyone develops against identical environments, eliminating ‘works on my machine’ issues.