External Documentation

The best documentation on learning and using Vagrant is going to be at the Vagrant Documentation website.

Installation at ICS

Vagrant is installed on ICS instructional Linux systems. It can be added to any research Linux system as well.

  • CentOS 6: Vagrant-2.2.4
  • CentOS 7: Vagrant-2.2.4
  • CentOS 8: Vagrant-2.2.9
  • Ubuntu 18_04 LTS: Vagrant-2.2.4

Running Vagrant

There are no special privileges required. From any managed Linux host where virtualbox is installed, you may run `vagrant`.

Start a Vagrant VM

The following steps are an example for running an Ubuntu 18.04 host via Vagrant. It will run on any host that has Vagrant and VirtualBox packages installed.

Create a folder to hold the vagrant file and cd to it. It can be any folder you want. We recommend that you organize all of your vagrant hosts in your home directory underneath vagrant:

mkdir -p ~/vagrant/trusty64
cd ~/vagrant/trusty64

The vagrant box add command depends on the public catalog of available Vagrant images, such as “hashicorp/bionic64”. The example installs the ubuntu/trusty64 vagrant box. In the public catalog, choose one that works with virtualbox.

vagrant box add ubuntu/trusty64

The vagrant box add commands downloads the image to ~/.vagrant.d/boxes folder.

vagrant init ubuntu/trusty64

You will now see the message:

A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`` for more information on using Vagrant.

You can bring up the vagrant VM and ssh to it:

vagrant up 
vagrant ssh

The vagrant machine will have just a private address. There are examples below to configure your VM so that it receives a public DHCP address. If you wish to have a permanent public address, please request on from

Multiple Vagrant VM's and Vagrant SSHD Ports

By default, a Vagrant VM uses port 2222 on the localhost ( in the output of `netstat -pna`). If you run multiple Vagrant VM's on a single machine, you will need to change this port. Add the following to your Vagrantfile: :forwarded_port, guest: 22, host: 2223, id: 'ssh'

Change 2223 to the next available port.

Running Docker with Vagrant

Follow the instructions above to start a ubuntu vagrant vm and ssh in. Now that we are in the Vagrant VM, docker can be run with full root access.

Follow these instructions to install the docker engine on ubuntu.

CPU and memory

To change the core and memory to say 2 CPU and 2GB RAM, add this to the VagrantFile:

config.vm.provider :virtualbox do |v|
   v.customize ["modifyvm", :id, "--cpus", 2, "--memory", 2048]


Uses and Limitations


Set your VAGRANT_HOME enviroment variable to change the destination of your Vagrant downloads. Mosts users will want to set this to a subdirectory in scratch:


VirtualBox VMs Directory

The directory that vagrant stores your VirtualBox VM's in may be changed by changing the file ~/.config/VirtualBox/VirtualBox.xml. The string“<username>” should be replaced with a valid user name:

    <SystemProperties defaultMachineFolder="/scratch/<username>/VirtualBox VMs" defaultHardDiskFormat="VDI" VRDEAuthLibrary="VBoxAuth" webServiceAuthLibrary="VBoxAuth" LogHistoryCount="3" exclusiveHwVirt="true"/>


Sample vagrant setup files can be found at

Assigning a public IP

You can get a public IP from DHCP, by setting the VM's MAC address in the Vagrantfile:

Vagrant.configure("2") do |config| "public_network",
    use_dhcp_assigned_default_route: true,
                :mac => "060080c30d65"

In this case, we get the MAC address from an IP to hex converter and then prefixing that address with 0600 (the 06 designates a special locally administered mac address). The DHCP server will see the VM's MAC address, and then assign the corresponding IP. We can now ping and access the VM from it's IP address:

Please email to register your host and receive MAC and IP addresses for your use.


Using Alternate Storage

Vagrant virtual machines typically run out of a user home directory. This usage can be shifted to un-quota'd grad or ugrad space by setting the VAGRANT_HOME environment variable:

export VAGRANT_HOME=/auto/vagrant_space/$USER

Make sure the $VAGRANT_HOME directory exists:

[ -d  $VAGRANT_HOME ]  || mkdir -p $VAGRANT_HOME

Create a directory for your new Vagrant Box and download the source using the `vagrant add` command

mkdir $VAGRANT_HOME/bionic64
cd $VAGRANT_HOME/bionic64
vagrant box add ubuntu/bionci64

Initialize the Vagrantfile

vagrant init ubuntu/disk64

Create your Vagrantfile by adding the following into

cat << EOL >  $VAGRANT_HOME/bionic64/Vagrantfile
Vagrant.configure("2") do |config| = "ubuntu/bionic64"

Afterwards, run vagrant up to bring up the vm.

Use the `vagrant global-status` commend to identify your running vagrant machines:

vagrant global-status 
id       name    provider   state   directory                           
9810c2e  default virtualbox running /auto/vagrant_space/flukban/ics53    

Connect to your vagrant VM. Note that the second argument to vagrant is the ID of your vagrant VM. We used the above example in the next:

# vagrant ssh 9810c2e

Also you can just type in vagrant ssh if you are in the same directory as your vagrant file. For a list of other settings you can modify, please check


Launching Services After Vagrant Mount


Q There are no active Vagrant environments

A If you are sure that you have a running vagrant on the computer, please make sure your VAGRANT_HOME variable is set correctly (see above for more info).

export VAGRANT_HOME=/path/to/your/vagrant/box

Q On the same subnet, pinging the vagrant machine comes back with (DUP!) responses back.

A There may be lingering vagrant processes running with the same IP. Search for any lingering vagrant processes and stop them.

virtual_environments/vagrant.txt · Last modified: 2021/05/25 18:18 by Hans
CC Attribution-Noncommercial-Share Alike 4.0 International
Driven by DokuWiki Recent changes RSS feed Valid CSS Valid XHTML 1.0