vagrant/website/content/docs/installation/source.mdx

83 lines
2.5 KiB
Text
Raw Normal View History

2020-05-05 18:11:12 -04:00
---
2020-05-06 17:36:09 -04:00
layout: docs
page_title: Installing Vagrant from Source
2020-05-05 18:11:12 -04:00
description: |-
2022-10-05 12:42:00 -04:00
Vagrant installations from source is an advanced operation. It is only recommended
if you cannot use the official installer.
2020-05-05 18:11:12 -04:00
---
2022-10-05 12:42:00 -04:00
# Install Vagrant from source
2020-05-05 18:11:12 -04:00
Vagrant installations from source is an advanced operation. We only recommended
2022-10-05 12:42:00 -04:00
if you cannot use the official installer. This page details the prerequisites and three
steps to install Vagrant from source.
1. Install Ruby
1. Clone Vagrant
1. Configure locally
2020-05-05 18:11:12 -04:00
## 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.
2022-10-05 12:42:00 -04:00
2020-05-05 18:11:12 -04:00
2022-10-05 12:42:00 -04:00
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.
2020-05-05 18:11:12 -04:00
## Clone Vagrant
2022-10-05 12:42:00 -04:00
Clone Vagrant's repository from GitHub into the directory where you keep code on your machine.
2020-05-05 18:11:12 -04:00
2020-05-07 19:19:35 -04:00
```shell-session
2020-05-05 18:11:12 -04:00
$ git clone https://github.com/hashicorp/vagrant.git
```
Next, `cd` into that path. You must initiate all commands from this directory.
2020-05-05 18:11:12 -04:00
2020-05-07 19:19:35 -04:00
```shell-session
2020-05-05 18:11:12 -04:00
$ cd /path/to/your/vagrant/clone
```
2022-10-05 12:42:00 -04:00
Use the `bundle` command with a required version\* to install the requirements.
2020-05-05 18:11:12 -04:00
2020-05-07 19:19:35 -04:00
```shell-session
2020-05-05 18:11:12 -04:00
$ bundle install
```
2022-10-05 12:42:00 -04:00
You can now start Vagrant with the `bundle` command.
```shell-session
$ bundle exec vagrant
```
2020-05-05 18:11:12 -04:00
2022-10-05 12:42:00 -04:00
## Configure locally
2020-05-05 18:11:12 -04:00
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.
2022-10-05 12:42:00 -04:00
First, use the `bundle` command from your Vagrant directory.
2020-05-05 18:11:12 -04:00
2020-05-07 19:19:35 -04:00
```shell-session
2020-05-05 18:11:12 -04:00
$ bundle --binstubs exec
```
This will generate files in `exec/`, including `vagrant`. You can now specify
2022-10-05 12:42:00 -04:00
the full path to the `exec/vagrant` anywhere on your operating system.
2020-05-05 18:11:12 -04:00
2020-05-07 19:19:35 -04:00
```shell-session
2020-05-05 18:11:12 -04:00
$ /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.
2020-05-05 18:11:12 -04:00
If you do not want to specify the full path to Vagrant (i.e. you just want to
2022-10-05 12:42:00 -04:00
run `vagrant`), you can create a symbolic link to your exec.
2020-05-05 18:11:12 -04:00
2020-05-07 19:19:35 -04:00
```shell-session
2020-05-05 18:11:12 -04:00
$ ln -sf /path/to/vagrant/exec/vagrant /usr/local/bin/vagrant
```
2022-10-05 12:42:00 -04:00
When you want to switch back to the official Vagrant version,
2020-05-05 18:11:12 -04:00
remove the symlink.