Fun with Vagrant


Vagrant version:

$ vagrant -version
Vagrant 2.2.7

To create a Vagrantfile in the project directory using HashiCorp’s official “box”:

cd /path/to/the/project/directory/; vagrant init hashicorp/bionic64

In case of any edits, use vagrant reload.

Getting into your Ubuntu box; i.e., a VM:

vagrant up
vagrant ssh

There is suspend, resume, halt <--force>, and destroy, among many other CLI commands to manage the entire lifecycle of a box.

If defined, vagrant up will use the configured provisioner to bootstrap your VM to its desired state; e.g.,

$ cat Vagrantfile
  config.vm.provision "shell", inline: <<-SHELL
    apt-get update
    apt-get install -y php
    php -v