Install Vagrant
https://www.vagrantup.com/docs/installation/
-
Install VirtualBox
-
Install Vagrant
sudo apt install vagrant
Set up a new vagrant box
-
See if hashicorp has a box for the latest Ubuntu LTS: https://app.vagrantup.com/hashicorp
If not, check here: https://app.vagrantup.com/ubuntu
-
Initialize the Vagrant box
vagrant init ubuntu/focal64
(this will create a Vagrantfile in the local directory)
-
(Optional) Customize the Vagrantfile
For example, if you wish to specify the amount of CPUs or memory:
Vagrant.configure("2") do |config| config.vm.provider "virtualbox" do |vb| vb.memory = 1024 vb.cpus = 1 end end
Start a vagrant box
vagrant up
Mount a local folder inside the vagrant box
The local folder is automatically mounted inside the running vagrant box under /vagrant
Connect to a running vagrant box
vagrant ssh
If it asks for a password, use: vagrant
Shut down a vagrant box
vagrant halt
Delete a vagrant box
vagrant destroy