Skip to content

Instantly share code, notes, and snippets.

@gotev
Last active April 27, 2016 06:45
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 gotev/10ab85f2a40b8f62597e57b1dfea34ca to your computer and use it in GitHub Desktop.
Save gotev/10ab85f2a40b8f62597e57b1dfea34ca to your computer and use it in GitHub Desktop.
VirtualBox Guest Additions automated web installer for CentOS 6/7
#!/bin/bash -e
# Utility script to install latest VirtualBox Guest Additions for CentOS 6/7
# @author Alex Gotev
#
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root" 1>&2
exit 1
fi
VBOX_GUEST_INSTALLED=$(modprobe vboxguest 2>/dev/null; echo $?)
if [ "$VBOX_GUEST_INSTALLED" == "0" ]
then
echo "VirtualBox Guest Additions already installed"
else
echo "Installing latest VirtualBox Guest Additions..."
yum -y install kernel-devel gcc* dkms bzip2
GUEST_ADDITIONS_VERSION=$(curl -s http://download.virtualbox.org/virtualbox/LATEST.TXT)
DOWNLOAD_URL="http://download.virtualbox.org/virtualbox/${GUEST_ADDITIONS_VERSION}/VBoxGuestAdditions_${GUEST_ADDITIONS_VERSION}.iso"
curl -L -# -o /tmp/guestadditions.iso "${DOWNLOAD_URL}" 2>&1
mkdir /tmp/isoinstall
mount /tmp/guestadditions.iso /tmp/isoinstall
cd /tmp/isoinstall
./VBoxLinuxAdditions.run 2>&1 || true
fi
@gotev
Copy link
Author

gotev commented Apr 27, 2016

To download & run it, open a terminal as root and execute:

curl -L https://gist.github.com/gotev/10ab85f2a40b8f62597e57b1dfea34ca/raw/5407c59e323781df30e379f0e6c260c0d2f7e302/vboxguestinstaller.sh | bash

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