在VirtualBox中安装Extension是一件非常简单的事,但从Oracle Linux 7开始,经常失败。
以下为安装过程以及处理方法,只解决How不解决Why:
- 下载Oracle Linux 7 ISO
- 在VirtualBox中安装,在Software Selection时选“Server With GUI”
- 安装完后,重启
- yum install gcc kernel-devel kernel-uek-devel
- yum -y update kernel-uek
- yum -y update kernel
- 重启,确认/lib/modules/ ( u n a m e − r ) 和 / u s r / s r c / k e r n e l s / (uname -r)和/usr/src/kernels/ (uname−r)和/usr/src/kernels/(uname -r)目录存在
我自己的一次处理过程,OS是OL 7U6,最小安装:
[root@mgmthost1 mnt]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.22 Guest Additions for Linux........
bzip2 not found. Please install: bzip2 tar; and try again.
[root@mgmthost1 mnt]# yum install bzip
[root@mgmthost1 mnt]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.22 Guest Additions for Linux........
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-uek-devel kernel-uek-devel-4.14.35-1818.3.3.el7uek.x86_64
VirtualBox Guest Additions: Starting.
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while.
This system is currently not set up to build kernel modules.
Please install the gcc make perl packages from your distribution.
Please install the Linux kernel "header" files matching the current kernel
for adding new hardware support to the system.
The distribution packages containing the headers are probably:
kernel-uek-devel kernel-uek-devel-4.14.35-1818.3.3.el7uek.x86_64
[root@mgmthost1 mnt]# yum install kernel-uek-devel kernel-uek-devel-4.14.35-1818.3.3.el7uek.x86_64
[root@mgmthost1 mnt]# ./VBoxLinuxAdditions.run
Verifying archive integrity... All good.
Uncompressing VirtualBox 5.2.22 Guest Additions for Linux........
VirtualBox Guest Additions installer
Removing installed version 5.2.22 of VirtualBox Guest Additions...
Copying additional installer modules ...
Installing additional modules ...
VirtualBox Guest Additions: Building the VirtualBox Guest Additions kernel modules. This may take a while.
VirtualBox Guest Additions: Starting.
[root@mgmthost1 mnt]# echo $?
0
# 在VirtualBox中创建Shared Folder
[root@mgmthost1 mnt]# mount -t vboxsf downloads /mnt
成功了,看来也没那么麻烦,按照提示一步一步做就好。主要是可以上网。
由于这个OS是最小安装,所以拷贝粘贴这些就用不了了,但共享目录是我需要的。
参考:
- http://www.dedoimedo.com/computers/virtualbox-compilation-errors.html (OL7U3参考)
- Unable to install VIrtualbox,
"Specify KERN_DIR=<directory>"
– installing Virtual Box to Debian? - Super User (OL7U4参考)