Vagrant
Install Vagrant
To get started with Vagrant, download the appropriate installer or package for your platform from our Vagrant downloads page. Install the package with the standard procedures for your operating system.
The installer automatically adds vagrant
to your system path
so that it is available in terminals. If it is not found,
log out and back into your system; this is a common issue for Windows.
Rubygem installation is unsupported Vagrant 1.0.x has the option to be installed as a RubyGem. However, this installation method is no longer supported. If you have an old version of Vagrant installed via Rubygems, remove it prior to installing newer versions of Vagrant.
First development environment
If you are new to Vagrant, the next step to set up a development environment is to install a box.
How to use multiple hypervisors
Hypervisors often do not allow you to bring up virtual machines if you have more than one hypervisor in use.
Below are a couple of examples to allow you to use Vagrant and VirtualBox if another hypervisor is present.
Linux, VirtualBox, and KVM
If you encounter the following error message, it is because another hypervisor, like KVM, is in use.
There was an error while executing `VBoxManage`, a CLI used by Vagrant for controlling VirtualBox. The command and stderr is shown below.
Command: ["startvm", <ID of the VM>, "--type", "headless"]
Stderr: VBoxManage: error: VT-x is being used by another hypervisor (VERR_VMX_IN_VMX_ROOT_MODE).
VBoxManage: error: VirtualBox can't operate in VMX root mode. Please disable the KVM kernel extension, recompile your kernel and reboot
(VERR_VMX_IN_VMX_ROOT_MODE)
VBoxManage: error: Details: code NS_ERROR_FAILURE (0x80004005), component ConsoleWrap, interface IConsole
You must add the additional hypervisors to the deny list in order for VirtualBox to run correctly.
First, find out the name of the hypervisor.
$ lsmod | grep kvm
kvm_intel 204800 6
kvm 593920 1 kvm_intel
irqbypass 16384 1 kvm
Use the blacklist
command to add the hypervisor to your denylist.
$ echo 'blacklist kvm-intel' >> /etc/modprobe.d/blacklist.conf
Restart your machine and try the vagrant
command again.
Windows, VirtualBox, and Hyper-V
If you encounter an issue with Windows, you will get a blue screen if you attempt to bring up a VirtualBox VM with Hyper-V enabled.
If you wish to use VirtualBox on Windows, you must ensure that Hyper-V is not enabled on Windows. You can turn off the feature with the following Powershell command for Windows 10.
Disable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V-All
For Windows 11, you can use an elevated Powershell.
bcdedit /set hypervisorlaunchtype off
You can also disable Hyper-V in the Windows system settings.
- Right click on the Windows button and select ‘Apps and Features’.
- Select Turn Windows Features on or off.
- Unselect Hyper-V and click OK.
You might have to reboot your machine for the changes to take effect. More information about Hyper-V can be read here.