This article will cover installing Vagrant on Linux Mint, but what is Vagrant? Vagrant is a useful tool for setting up testing and development virtual machines on Linux. Setting it up on Debian and Ubuntu based distributions like Linux Mint is quite straight forward and the following guide will go over the main steps. For further information, Vagrant itself has some great docs http://docs.vagrantup.com/v2/. It covers installation of Vagrant on various Linux distros as well as more advanced management and configuration, but here’s a quick start:
Installing Vagrant on Linux Mint
First, open up a terminal and install virtual box, the kernel sources and vagrant all in one neat step:
sudo apt-get install virtualbox virtualbox-dkms vagrant
Please note that the version in Mint/Ubuntu’s repositories is not the latest one. If you’ve using tools such as PuPHPet you’ll need to grab the latest version of Vagrant from the Vagrant downloads page.
Make a new sub directory in your home folder for your Vagrant machines files to be stored in:
mkdir ~/vagrant
Now lets get create a VM. Pick what machine you want from the Vagrant Boxes (http://www.vagrantbox.es/). I’m going to use Debian 7.3. You need to copy the box URL.
Make sure you’re in your vagrant directory:
cd ~/vagrant
Initialise the vagrant box. This creates a configuration file for it which you can use to change key settings before you start it up
vagrant init debs http://puppet-vagrant-boxes.puppetlabs.com/debian-73-x64-virtualbox-nocm.box
Make configuration changes if you want to. I like to set a hostname and have the machine appear on my main network so I can access it from other computers
nano Vagrantfile
These are the additional lines I put in:
# Set the machines hostname
config .vm.hostname = "debs7"
# Setup a network bridge
config.vm.network :public_network
Now you can start the vagrant box. It’ll download the image first time so it might be a little slow to get going.
vagrant up
Once done, you can access it using
vagrant ssh