VirtualBox is a cross-platform virtualization application. It installs on your existing Intel or AMD-based computers, whether they are running Windows, Mac, Linux or Solaris operating systems.
Step 1 – Add Required Yum Repositories
Firstly you are required to add yum repository to your system. Download repository file from its official site and place it under at /etc/yum.repos.d/virtualbox.repo .First navigate to /etc/yum.repos.d/ directory and use one of below commands as per your operating system.
cd /etc/yum.repos.d/ ### On CentOS/RHEL Systems: wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo ### On Fedora Systems: wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
CentOS and Red Hat users also need to add EPEL yum repository using one of the following commands.
### On CentOS/RHEL 7 ### rpm -Uvh http://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm ### On CentOS/RHEL 6 ### rpm -Uvh http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm
Step 2 – Install Required Packages
Before installing make sure to install all required packages like kernel-headers, kernel-devels etc. Use the following command to install the required packages.
yum install gcc make patch dkms qt libgomp yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel
After installing latest kernel and kernel headers, let’s reboot your system and start with Latest kernel.
Step 3 – Setup Environment Variable
Installation required kernel source code to install required modules, So we need to configure environment variable KERN_DIR to which VirtualBox get kernel source code. In my case, latest kernthe el source is available in 2.6.32-504.3.3.el6.x86_64 directory under /usr/src/kernels/ . Make sure you are using correct source path.
export KERN_DIR=/usr/src/kernels/`uname -r`
Step 4 – Install and Setup
Use the following command to install VirtualBox using yum command line tool. It will install the latest version of VirtualBox 5.2 on your system.
yum install VirtualBox-5.2
After installation, we need to rebuild kernel modules using the following command.
service vboxdrv setup
Step 5 – Launch
Use following command to start VirtualBox from X windows. You can switch to GUI mode using init 5 or startx commands from terminal.