In this tutorial, you will create your first development environment with Vagrant. This quick start provides a brief introduction to Vagrant, its prerequisites, and an overview of three of the most important Vagrant commands to understand.
Vagrant isolates dependencies and their configuration within a single disposable, consistent environment, without sacrificing any of your existing tools. To learn more about the benefits of Vagrant, read the "Why Vagrant?" introduction page.
- Install the latest version of Vagrant.
- Install a virtualization product such as; VirtualBox, VMware Fusion, or Hyper-V.
With the two commands below, you will have a fully usable virtual machine with Ubuntu 18.04 LTS 64-bit.
$ vagrant init hashicorp/bionic64
A `Vagrantfile` has been placed in this directory. You are now ready to `vagrant up` your first virtual environment! Please read the comments in the Vagrantfile as well as documentation on `vagrantup.com` for more information on using Vagrant.
Before you can continue to the next step, ensure that Vagrant has created a
$ ls -al -rw-r--r-- 1 kaitlincarter staff 3024 13:07 Vagrantfile
Now that you have a
Vagrantfile that configures your deployment, you can start the virtual machine.
$ vagrant up
When the virtual machine is successfully deployed, there will be a message stating that it is booted and ready.
==> default: Machine booted and ready! ==> default: Configuring network adapters within the VM... ==> default: Waiting for HGFS to become available... ==> default: Enabling and configuring shared folders...
Connect to the machine with
vagrant ssh and explore your environment.
Leave the SSH session with
When you are done, be sure to terminate the virtual machine. Confirm when the CLI prompts you by typing
$ vagrant destroy
==> default: Stopping the VMware VM... ==> default: Deleting the VM...
Vagrant allows you to work on any project, to install every dependency that project needs, and to set up any networking or synced folders, so you can continue working from the comfort of your own machine.
You have just created your first virtual environment with Vagrant. Read on to learn more about project setup.