Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Run Octave using Vagrant


  1. Download and install Vagrant
  2. Download and install Virtual Box
  3. Download the file bellow; name must be "Vagrantfile"


Go to the folder where your "Vagrantfile" in your terminal/shell. Run the following commands:

vagrant up
vagrant ssh
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Boostrap Script
$script = <<SCRIPT
# Update & Install
apt-get update
apt-get install -y octave gnuplot
echo "cd /vagrant" >> /home/vagrant/.bashrc
Vagrant.configure("2") do |config|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at
# Every Vagrant virtual environment requires a box to build off of. = "precise32"
# The url from where the '' box will be fetched if it
# doesn't already exist on the user's system.
config.vm.box_url = ""
# A Vagrant plugin that helps you reduce the amount of coffee you drink while
# waiting for boxes to be provisioned by sharing a common package cache among
# similiar VM instances. Kinda like vagrant-apt_cache or this magical snippet
# but targetting multiple package managers and Linux distros.
if Vagrant.has_plugin?("vagrant-cachier")
config.cache.auto_detect = true
# For VirtualBox, we want to enable NFS for shared folders
# config.cache.enable_nfs = true
# The shell provisioner allows you to upload and execute a script as the root
# user within the guest machine.
config.vm.provision :shell, :inline => $script
# Provider-specific configuration so you can fine-tune various
# backing providers for Vagrant. These expose provider-specific options.
# Example for VirtualBox:
config.vm.provider :virtualbox do |vb|
vb.customize ["modifyvm", :id, "--memory", "256", "--cpus", "2"]
Copy link

dpsutton commented Sep 9, 2014

Hi. this looks perfect. Can i ask you two questions though? Why did you go the 32bit route? And also, how does this handle plots. For class I must generate some plots and I was wondering how this handled generating plots and windows.

Copy link

zanders3 commented Mar 1, 2017

Great script! I suggest adding config.ssh.forward_x11 = true to enable X11 forwarding which allows GNU Plot to work correctly

Copy link

TiBag93 commented Mar 19, 2019


I just tried your Vagrantfile. They changed their url to:
config.vm.box_url = "" // I'm using 64 bit

Have fun using octave :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment