Skip to content

Instantly share code, notes, and snippets.

@queirozfcom
Last active August 29, 2015 14:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save queirozfcom/42877fdb2ec6dc2573df to your computer and use it in GitHub Desktop.
Save queirozfcom/42877fdb2ec6dc2573df to your computer and use it in GitHub Desktop.
Simple Vagrantfile that can be used to set up a simple Ubuntu 12.04 LTS box with XFCE GUI.
# Simplest possible Ubuntu 12.04 box with a GUI
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.provider "virtualbox" do |vb|
# Don't boot with headless mode
vb.gui = true
# Set a name that you can remember
vb.name = "ubuntu_vm_with_xfce_gui_by_queirozfcom"
# Set 1024M of RAM
vb.memory = 1024
# And one processor
vb.cpus = 1
end
# This next bit fixes the 'stdin is not a tty' error when shell provisioning Ubuntu boxes
config.vm.provision :shell,
#if there a line that only consists of 'mesg n' in /root/.profile, replace it with 'tty -s && mesg n'
:inline => "(grep -q -E '^mesg n$' /root/.profile && sed -i 's/^mesg n$/tty -s \\&\\& mesg n/g' /root/.profile && echo 'Ignore the previous error about stdin not being a tty. Fixing it now...') || exit 0;"
# update definitions
config.vm.provision "shell", inline: "apt-get update"
# just the basic desktop environment. if you want the addons, you can install them later
config.vm.provision "shell", inline: "apt-get install xubuntu-desktop --no-install-recommends --assume-yes"
# otherwise icons don't get loaded
config.vm.provision "shell", inline: "apt-get install xubuntu-icon-theme --assume-yes"
#activate logon with gui and reboot
config.vm.provision "shell", inline: "dpkg-reconfigure lightdm"
config.vm.provision "shell", inline: "reboot"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment