Skip to content

Instantly share code, notes, and snippets.

@xairy
Last active December 8, 2020 15:44
Show Gist options
  • Save xairy/40e340db65b32c4fb407b92e75b24a61 to your computer and use it in GitHub Desktop.
Save xairy/40e340db65b32c4fb407b92e75b24a61 to your computer and use it in GitHub Desktop.
Vagrantfile for VirtualBox-based custom Ubutu Bionic box with GUI
Vagrant.configure(2) do |config|
# VM name for vagrant management.
config.vm.define "my-vm"
# Base VM image.
config.vm.box = "ubuntu/bionic64"
# Enlarge disk (will also convert the format from VMDK to VDI).
# Requires: vagrant plugin install vagrant-disksize
config.disksize.size = "50GB"
config.vm.provider "virtualbox" do |vb|
# Display the VirtualBox GUI when the machine is powered on.
vb.gui = true
# Set video memory size to 128 MB.
vb.customize ["modifyvm", :id, "--vram", "128"]
# Set RAM size to 4096 MB.
vb.memory = 4096
end
# Sync the dir with shared files.
config.vm.synced_folder './shared', '/home/vagrant/shared', SharedFoldersEnableSymlinksCreate: false
# https://askubuntu.com/questions/1067929/on-18-04-package-virtualbox-guest-utils-does-not-exist
config.vm.provision "shell", inline: "sudo apt-add-repository multiverse && sudo apt-get update"
# Install xfce and virtualbox additions.
config.vm.provision "shell", inline: "sudo apt-get install -y xfce4 virtualbox-guest-dkms virtualbox-guest-utils virtualbox-guest-x11"
# Permit anyone to start the GUI.
config.vm.provision "shell", inline: "sudo sed -i 's/allowed_users=.*$/allowed_users=anybody/' /etc/X11/Xwrapper.config"
# Use LightDM login screen (=> not required to run "startx").
config.vm.provision "shell", inline: "sudo apt-get install -y lightdm lightdm-gtk-greeter"
# Install a more feature-rich applications menu.
config.vm.provision "shell", inline: "sudo apt-get install -y xfce4-whiskermenu-plugin"
# Other setup goes here...
# Reboot.
# Requires: vagrant plugin install vagrant-reload
config.vm.provision :reload
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment