Vagrant: Working with Reproducible Development Environments | WebStorm (original) (raw)

Vagrant is a command-line utility used to manage the lifecycle of virtual machines.

WebStorm provides full integration with Vagrant allowing you to configure the Vagrant virtual environment, control the behavior of virtual machines, and execute Vagrant commands from within your project.

In the context of working with Vagrant, you will meet the following definitions:

Prerequisites

  1. Make sure the Vagrant plugin is enabled in the settings. Press Ctrl+Alt+S to open settings and then select . Click the Installed tab. In the search field, type Vagrant. For more information about plugins, refer to Managing plugins.
  2. Install Vagrant and Oracle's VirtualBox applications.
  3. Make sure virtualization is enabled on your computer.

Initialize the Vagrantfile

To start working with Vagrant, you need to initialize the Vagrantfile.

Do one of the following:

In the Project tool window Alt+1, switch to the Project files view and double-click the Vagrantfile to open it in the embedded editor.

You will see that Vagrantfile already has a predefined configuration. The config.vm.box = "..." line specifies the virtual box that will be used in a project.

Specify the virtual box

As an example, we will specify the ubuntu/trusty64 box. It contains a basic Ubuntu virtual machine. You can specify any other virtual box based on your needs. To find a list of available virtual boxes, refer to Discovering Vagrant Boxes.

Do one of the following:

Once the Vagrantfile initialization is completed, and virtual box is specified, you are ready to deploy and run the virtual machine.

Launch an instance

Do one of the following:

SSH into a running machine

When the virtual machine is launched, it runs on a backend. To SSH into a running machine:

Vagrant commands to control an instance

To control an instance, use Vagrant commands. They can be run either from Terminal (Alt+F12) or from the main menu.

In this article, we show only the most important commands to work with the virtual machine. To find a full list of available Vagrant commands, refer to Command-Line-Interface.

Last modified: 26 March 2025