一定要注意查看终端输出的安装日志
进入正文:
1>查看内核版本
uname -a
Linux ice 4.9.0-4-amd64 #1 SMP Debian 4.9.51-1 (2017-09-28) x86_64 GNU/Linux
我的是 4.9.0-4-amd64
2>下载VirtualBox
和我相同版本号的 直接使用如下语句就OK:
wget http://download.virtualbox.org/virtualbox/5.2.0/virtualbox-5.2_5.2.0-118431Debianstretch_amd64.deb
下面是官网下载地址
3>安装
cd到你的下载目录 笔者是使用 "新力得软件包管理工具" 安装的,如下: sudo gdebi virtualbox-5.2_5.2.0-118431Debianstretch_amd64.deb
你也可以选择使用其他的方法
4>查看日志
笔者的日志内容如下:
{
Reading package lists... DoneBuilding dependency tree Reading state information... DoneReading state information... Done
Oracle VM VirtualBox VirtualBox is a powerful PC virtualization solution allowing you to run a wide range of PC operating systems on your Linux system. This includes Windows, Linux, FreeBSD, DOS, OpenBSD and others. VirtualBox comes with a broad feature set and excellent performance, making it the premier virtualization software solution on the market.
您是否想安装这个软件包?[y/N]:y正在选中未选择的软件包 virtualbox-5.2。(正在读取数据库 ... 系统当前共安装有 256522 个文件和目录。)正准备解包 virtualbox-5.2_5.2.0-118431Debianstretch_amd64.deb ...正在解包 virtualbox-5.2 (5.2.0-118431Debianstretch) ...正在设置 virtualbox-5.2 (5.2.0-118431Debianstretch) ...正在添加组"vboxusers" (GID 127)...完成。
Created symlink /etc/systemd/system/multi-user.target.wants/vboxdrv.service → /lib/systemd/system/vboxdrv.service.Created symlink /etc/systemd/system/multi-user.target.wants/vboxballoonctrl-service.service → /lib/systemd/system/vboxballoonctrl-service.service.Created symlink /etc/systemd/system/multi-user.target.wants/vboxautostart-service.service → /lib/systemd/system/vboxautostart-service.service.Created symlink /etc/systemd/system/multi-user.target.wants/vboxweb-service.service → /lib/systemd/system/vboxweb-service.service.
This system is currently not set up to build kernel modules.Please install the Linux kernel "header" files matching the current kernelfor adding new hardware support to the system.The distribution packages containing the headers are probably: linux-headers-amd64 linux-headers-4.9.0-4-amd64
There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfigas root.
正在处理用于 systemd (232-25+deb9u1) 的触发器 ...正在处理用于 gnome-menus (3.13.3-9) 的触发器 ...正在处理用于 desktop-file-utils (0.23-1) 的触发器 ...正在处理用于 mime-support (3.60) 的触发器 ...正在处理用于 hicolor-icon-theme (0.15-1) 的触发器 ...正在处理用于 shared-mime-info (1.8-1) 的触发器 ...Unknown media type in type 'all/all'Unknown media type in type 'all/allfiles'
}END
5>完成安装
重点语句在这里:
The distribution packages containing the headers are probably: linux-headers-amd64 || linux-headers-4.9.0-4-amd64There were problems setting up VirtualBox. To re-start the set-up process, run /sbin/vboxconfig as root.
headers文件缺失, 系统输出了两个建议 , 选择第二个, 然后复制搜索下载,注意要对应哦
然后接下来就是安装 linux-headers-4.9.0-4-amd64 的deb包
接着在终端输入:
sudo /sbin/vboxconfig
大家的问题不尽相同, 核心的方法就是查看终端日志
THE ENNNNNNND ... 我是惜冰,祝安好!