In previous post, I shared how to install VirtualBox on Windows 10. To continue the tutorial series about VirtualBox, I ‘d like to share how to install VirtualBox on CentOS 7.
You will need to be root or can be executed by root right (Using sudo)
1. Setup VirtualBox Repository
1 2 |
cd /etc/yum.repos.d wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo |
1 |
sed -i "s/gpgkey=https/gpgkey=http/" /etc/yum.repos.d/virtualbox.repo |
1 |
rpm -Uvh http://ftp.jaist.ac.jp/pub/Linux/Fedora/epel/7/x86_64/e/epel-release-7-5.noarch.rpm |
2. Install required package
1 2 |
yum install gcc make patch dkms qt libgomp yum install kernel-headers kernel-devel fontforge binutils glibc-headers glibc-devel |
3. Install VirtualBox on CentOS 7
Firstly, we can check what versions of VirtualBox are available.
1 2 3 4 |
[root@localhost ~]# yum list VirtualBox* Available Packages VirtualBox-5.0.x86_64 5.0.16_105871_el7-1 virtualbox VirtualBox-4.3.x86_64 4.3.36_105129_el7-1 virtualbox |
There are 2 versions of VirtualBox are available currently. We will install version 5.0
1 |
yum -y install VirtualBox-5.0 |
4. Rebuild kernel modules.
After installing VirtualBox, we have to rebuild the kernel modules.
Firstly, we need to check current kernel version.
1 2 |
[root@localhost ~]# uname -r 3.10.0-327.10.1.el7.x86_64 |
Then we will set the environment KERN_DIR to the source of current kernel so that during the rebuilding, the source can be used/referenced
1 |
export KERN_DIR=/usr/src/kernels/3.10.0-327.10.1.el7.x86_64/ |
Note that the path is combined by: [/usr/src/kernels/] and kernel version: [3.10.0-327.10.1.el7.x86_64]
The next is rebuild the kernel module:
1 |
systemctl start vboxdrv |
5. Start VirtualBox
We have just finished to install VirtualBox on CentOS 7 and now we can start VirtualBox by using command:
1 |
virtualbox & |
Or simply open Applications –> System Tools –> Oracle VM VirtualBox
The VirtualBox after started can be seen as below:
6. Conclusions.
We have tried to install VirtualBox on CentOS 7. On next post, I’d like to share how to install VirtualBox on other Linux distros like Ubuntu, Debian, etc.