vagrant/docs/getting-started/setup.md

1.9 KiB

layout title
getting_started Getting Started - Project Setup

Project Setup

The remainder of this getting started guide is written as a walkthrough. As the reader, you are encouraged to follow along with the samples on your own personal computer. Since Vagrant works with virtual machines, there will be no "cruft" left over if you ever wish to stop (no extraneous software, files, etc) as Vagrant will handle destroying the virtual machine if you so choose.

Vagrant Project Setup

The first step for any project which uses Vagrant is to mark the root directory and setup the basic required files. Vagrant provides a handy command-line utility for just that. In the terminal transcript below, we create the directory for our project and initialize it for Vagrant:

{% highlight bash %} $ mkdir vagrant_guide $ cd vagrant_guide $ vagrant init {% endhighlight %}

vagrant init creates an initial Vagrantfile. For now, we'll leave this Vagrantfile as-is, but it will be used extensively in future steps to configure our virtual machine.

Web Project Setup

With Vagrant now ready for the given directory, let's create a quick "web project" which we'll use later to showcase your VM. Run the following command in your project directory (the directory with the Vagrantfile):

{% highlight bash %} $ echo "

Hello from a Vagrant VM

" > index.html {% endhighlight %}

The above steps could have been run in any order. Vagrant can easily be initialized in pre-existing project folders.

What about PHP? Python? Java?

To keep this getting started guide simple and as general as possible, uses an HTML-based project as an example, but Vagrant doesn't make any assumptions about the type of project you're developing. It should be clear after going through the getting started guide on how to use Vagrant with other types of web projects.