Workshops
Book a 90-minute product workshop led by HashiCorp engineers and product experts during HashiConf Digital Reserve your spot

Getting Started

Project Setup

The first step in configuring any Vagrant project is to create a Vagrantfile. The Vagrantfile allows you to:

  • Mark the root directory of your project. Many of the configuration options in Vagrant are relative to this root directory.

  • Describe the kind of machine and resources you need to run your project, as well as what software to install and how you want to access it.

Vagrant has a built-in command for initializing a directory for use with Vagrant: vagrant init.

Make a new directory for this getting started guide.

$ mkdir vagrant_getting_started

Move into your new directory.

$ cd vagrant_getting_started

Initialize the directory for use with Vagrant.

$ vagrant init hashicorp/precise64

You now have a Vagrantfile in your current directory. You can take a look at the Vagrantfile if you want, it is filled with comments and examples. Do not be afraid if it looks intimidating, we will modify it soon enough.

You can also run vagrant init in a pre-existing directory to set up Vagrant for an existing project.

The Vagrantfile is meant to be committed to version control with your project, if you use version control. This way, every person working with that project can benefit from Vagrant without any upfront work.

You have successfully created your first project environment.