Last active
April 27, 2016 06:45
-
-
Save gotev/10ab85f2a40b8f62597e57b1dfea34ca to your computer and use it in GitHub Desktop.
VirtualBox Guest Additions automated web installer for CentOS 6/7
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To download & run it, open a terminal as root and execute: