1.去官网下载deb包,例如包名:
virtualbox-5.2_5.2.18-124319_Debian_stretch_amd64.deb
2.安装
sudo dpkg -i virtualbox-5.2_5.2.18-124319_Debian_stretch_amd64.deb
3.可能会出现如下问题:
root@debian:/home/kevin/下载# dpkg -i virtualbox-5.2_5.2.18-124319_Debian_stretch_amd64.deb (正在读取数据库 ... 系统当前共安装有 159348 个文件和目录。) 正准备解包 virtualbox-5.2_5.2.18-124319_Debian_stretch_amd64.deb ... 正在将 virtualbox-5.2 (5.2.18-124319~Debian~stretch) 解包到 (5.2.18-124319~Debian~stretch) 上 ... 正在设置 virtualbox-5.2 (5.2.18-124319~Debian~stretch) ... addgroup: 组"vboxusers"已经是系统组。退出。 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 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:linux-headers-amd64 linux-headers-4.9.0-8-amd64 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:linux-headers-amd64 linux-headers-4.9.0-8-amd64There were problems setting up VirtualBox. To re-start the set-up process, run/sbin/vboxconfig as root. 正在处理用于 systemd (232-25+deb9u4) 的触发器 ... 正在处理用于 mime-support (3.60) 的触发器 ... 正在处理用于 hicolor-icon-theme (0.15-1) 的触发器 ... 正在处理用于 shared-mime-info (1.8-1+deb9u1) 的触发器 ... Unknown media type in type 'all/all' Unknown media type in type 'all/allfiles'
上面已经提示我们缺少gcc make perl 包,linux的内核头文件:linux-headers-amd64 linux-headers-4.9.0-8-amd64
我们只需要安装即可:
sudo apt-get install gcc sudo apt-get install make sudo apt-get install perl sudo apt-get install linux-headers-amd64 sudo apt-get install linux-headers-4.9.0-8-amd64
最后执行:
sudo /sbin/vboxconfig
至此Virtual Box应该无大问题。
另外Virtual Box还有USB的拓展包可以去官网查看安装。