This article introduces how to download and install virtualbox
on centos 7.2 server
, and record the problems encountered:
yum install kernel-devel
And the process of solving problems by yourself.
cd /etc/yum.repos.d
wget http://download.virtualbox.org/virtualbox/rpm/rhel/virtualbox.repo
yum --enablerepo=epel install dkms
CentOS/RHEL 7,64Bit(x86_64):
# rpm -Uvh http://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-8.noarch.rpmCentOS/RHEL 6,64Bit(x86_64):
# rpm -Uvh http://epel.mirror.net.in/epel/6/x86_64/epel-release-6-8.noarch.rpm
An error was reported at this step: the url could not be found. The author copied the url to the browser and found that there is no such link. But I found another link under the warehouse:
http://epel.mirror.net.in/epel/7/x86_64/e/epel-release-7-9.noarch.rpm
Just replace it.
sudo yum install kernel-devel
Kernel-devel
is the kernel (kernel) source code and will be installed under the /usr/src/kernels
directory by default. The kernel source code is needed. It is because virtualbox needs to compile a specific kernel version module with the kernel source code.
The problem I encountered is that the version of yum install kernel-devel
is inconsistent with the version of the kernel on CentOS. As follows (the following results are listed after the author has solved all the problems, you can see that the uninstalled version 3.10.0-514.2.2.el7 is inconsistent with the host version):
➜ alpine uname -r
3.10.0- 327.36.3. el7.x86_64
➜ alpine sudo yum list kernel-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.0x.sg
* epel: mirror.smartmedia.net.id
* extras: mirror.0x.sg
* updates: mirror.0x.sg
Installed Packages
kernel-devel.x86_64 3.10.0-327.36.3.el7 installed
Available Packages
kernel-devel.x86_64 3.10.0-514.2.2.el7 updates
This leads to inconsistencies between the compiled and installed virtualbox module and the host kernel version and cannot run.
There are two broad categories of solutions:
software incompatibility problem
. The subsequent workload is huge.Finally, I decided to download the kernel source code of the version. Proceed as follows:
kernel-devel-3.10.0-327.36.3.el7.x86_64
sudo yum install kernel-devel-3.10.0-327.36.3.el7.x86_64.html
# export KERN_DIR=/usr/src/kernels/3.10.0-327.36.3.el7.x86_64
~ yum search virtualbox
Loaded plugins: fastestmirror
Determining fastest mirrors
* base: centos.usonyx.net
* epel: mirrors.tuna.tsinghua.edu.cn
* extras: centos.usonyx.net
* updates: centos.usonyx.net
virtualbox 31/31
VirtualBox-4.3.x86_64 : Oracle VM VirtualBox
VirtualBox-5.0.x86_64 : Oracle VM VirtualBox
VirtualBox-5.1.x86_64 : Oracle VM VirtualBox
yum install VirtualBox-5.1
Recommended Posts