Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Install the latest Linux Guest Additions from command-line
#!/usr/bin/env bash
# Run as root
# Use the '--no-xorg' option for install without all xorg dependencies.
echo "Installing dependencies..."
apt-get update
if [ "$1" = "--no-xorg" ]; then
apt-get -y install build-essential dkms linux-headers-generic curl
else
apt-get -y install build-essential dkms linux-headers-generic curl xorg
fi
echo "downloading Guest Additions..."
urlBase=download.virtualbox.org/virtualbox;
version=$(curl -s $urlBase/LATEST.TXT);
urlFull=$urlBase/$version/VBoxGuestAdditions_$version.iso;
request=$(curl -Is $urlFull | grep '200 OK');
echo "Installing Linux Guest Additions..."
if [ -n "$request" ]; then
wget --no-verbose $urlFull;
else
wget --no-verbose http://dlc.sun.com.edgesuite.net/virtualbox/$version/VBoxGuestAdditions_$version.iso;
fi
mount VBoxGuestAdditions_$version.iso /mnt;
/mnt/VBoxLinuxAdditions.run
echo "Linux Guest Additions just installed!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.