Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

Install Vagrant on Ubuntu

Install Vagrant with apt or with the official .deb package, then create your first Vagrantfile.

VPS and Cloud Servers1 min read8 screenshots

Method 1: apt

Step 1: Update the system

sudo apt update && sudo apt upgrade -y
Updating the system

Step 2: Install Vagrant

sudo apt install vagrant
Installing Vagrant

Step 3: Check it

vagrant --version
The Vagrant version

Method 2: The official package

Step 1: Download the package

wget https://releases.hashicorp.com/vagrant/2.4.1/vagrant_2.4.1-1_amd64.deb
Downloading the Vagrant package

Step 2: Install it

sudo dpkg -i vagrant_2.4.1-1_amd64.deb
Installing the package

Step 3: Check it

vagrant --version
The Vagrant version

Which version to use

The version in the Ubuntu repository is often older. The package from HashiCorp is newer and has the latest fixes and features.

Vagrant also needs a provider, such as VirtualBox, to run the machines.

Start a project

Step 1: Create a folder

mkdir my-vagrant-project
cd my-vagrant-project
Creating the project folder

Step 2: Create a Vagrantfile

vagrant init
Creating the Vagrantfile

Edit the Vagrantfile to set the box, for example config.vm.box = "ubuntu/jammy64", then run vagrant up.

Benefits of Vagrant

  • Portable and repeatable. The same setup on every computer.
  • Flexible. Many boxes and providers.
  • Efficient. Use disposable machines for testing.
  • Team friendly. Share the Vagrantfile.

Quick recap

  • Install with apt or the .deb package.
  • Use vagrant init and vagrant up.