Skip to content

Instantly share code, notes, and snippets.

@matthewcosgrove
Created November 13, 2018 19:56
Show Gist options
  • Save matthewcosgrove/f0204d82a66d780241ee169acf41de03 to your computer and use it in GitHub Desktop.
Save matthewcosgrove/f0204d82a66d780241ee169acf41de03 to your computer and use it in GitHub Desktop.
Install VirtualBox 5.0.x in CentOS 7
Goal
----
Install VirtualBox 5.0.x in a CentOS 7 workstation.
Pre-requisites
--------------
1) Using a user in sudo privileges
2) Start a root shell (e.g.: sudo -i)
3) EPEL repository needed:
$ rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm
Installation
------------
Just run the provided install_virtualbox5_centos7.sh script
Post-installation steps
-----------------------
Check the installation log file: /var/log/vbox-install.log
Run VirtualBox
--------------
If you have a GUI, tnen just run "VirtualBox", but if your host is a headless Linux server, then you need to use "VBoxHeadless"
More info about headless servers: https://www.virtualbox.org/manual/ch07.html#vboxheadless
Tip 1: do not forget to add your user to the 'vboxusers' group.
$ usermod -a -G vboxusers your_user_here
Tip 2: install the extension pack in order to enable a remote display
$ wget http://download.virtualbox.org/virtualbox/5.0.6/Oracle_VM_VirtualBox_Extension_Pack-5.0.6-103037.vbox-extpack
$ VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-5.0.6-103037.vbox-extpack
References:
----------
https://www.virtualbox.org/manual/UserManual.html
specially:
https://www.virtualbox.org/manual/ch02.html#install-linux-host
https://www.virtualbox.org/manual/ch02.html#install-linux-host
http://www.tecmint.com/install-virtualbox-on-redhat-centos-fedora/
http://www.if-not-true-then-false.com/2010/install-virtualbox-with-yum-on-fedora-centos-red-hat-rhel/
http://www.itzgeek.com/how-tos/linux/centos-how-tos/install-virtualbox-4-3-on-centos-7-rhel-7.html
https://fedoraproject.org/wiki/Common_F20_bugs#RPM_scriptlets_fail_during_updates
#!/bin/sh
echo ">>>> System update and get minimal required modules to use vboxdrv kernel <<<<"
yum update -y
yum install -y binutils qt gcc make patch libgomp glibc-headers glibc-devel
echo ">>>> Getting kernel headers and DKMS to favour future VirtualBox kernel Updates <<<<"
yum install -y kernel-headers kernel-devel dkms
repoFile="/etc/yum.repos.d/virtualbox.repo"
if [ -e $repoFile ]
then
echo ">>>> Repo file is already in yum repos. Skipping this step. <<<<"
else
echo ">>>> Repo file is not in yum repos. Downloading it. <<<<"
wget http://download.virtualbox.org/virtualbox/rpm/el/virtualbox.repo -O $repoFile
fi
# Next is to avoid "Error in PREUN scriptlet in rpm package VirtualBox-5.0-5.0.6_103037_el7-1.x86_64"
KERN_DIR=/usr/src/kernels/`uname -r`-`uname -m`
export KERN_DIR
echo ">>>> Getting VirtualBox 5.0.x from repo <<<<"
yum install -y VirtualBox-5.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment