Back to Vagrant

Source

website/content/docs/installation/source.mdx

2.4.92.8 KB
Original Source

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

[!IMPORTANT]
Documentation Update: Product documentation previously located in /website has moved to the hashicorp/web-unified-docs repository, where all product documentation is now centralized. Please make contributions directly to web-unified-docs, since changes to /website in this repository will not appear on developer.hashicorp.com. ⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

Install Vagrant from source

Vagrant installations from source is an advanced operation. We only recommended if you cannot use the official installer. This page details the prerequisites and three steps to install Vagrant from source.

  1. Install Ruby
  2. Clone Vagrant
  3. Configure locally

Install Ruby

To develop and build Vagrant, you must install a specific version of Ruby. The specific Ruby version that you will need is documented in vagrant.gemspec, located in the repository on GitHub. It contains the most up-to-date requirements.

You will also need to be aware of plugin compatibility between Vagrant source installations and package based installations. Since Vagrant plugins are configured based on the current environment, plugins installed with Vagrant from source will not work with the package based Vagrant installation.

Clone Vagrant

Clone Vagrant's repository from GitHub into the directory where you keep code on your machine.

shell-session
$ git clone https://github.com/hashicorp/vagrant.git

Next, cd into that path. You must initiate all commands from this directory.

shell-session
$ cd /path/to/your/vagrant/clone

Use the bundle command with a required version* to install the requirements.

shell-session
$ bundle install

You can now start Vagrant with the bundle command.

shell-session
$ bundle exec vagrant

Configure locally

In order to use your locally-installed version of Vagrant in other projects, you will need to create a binstub and add it to your path.

First, use the bundle command from your Vagrant directory.

shell-session
$ bundle --binstubs exec

This will generate files in exec/, including vagrant. You can now specify the full path to the exec/vagrant anywhere on your operating system.

shell-session
$ /path/to/vagrant/exec/vagrant init -m hashicorp/bionic64

-> Tip: Warning messages are expected when you use a local Vagrant from source installation, since it is not supported or recommended.

If you do not want to specify the full path to Vagrant (i.e. you just want to run vagrant), you can create a symbolic link to your exec.

shell-session
$ ln -sf /path/to/vagrant/exec/vagrant /usr/local/bin/vagrant

When you want to switch back to the official Vagrant version, remove the symlink.