注意这里是virtualbox,不是vmware。

安装vmware的请参考我的博文:​​debian9.6安装vmware15教程​

1,下载

 官网:​​https://www.virtualbox.org/wiki/Linux_Downloads​

我的是debian9.6,所以下载debian9,

debian9.6安装virtualbox_linux

 2,验证下载的包是不是正确的

guoyanzhang@bogon:~/下载$ sha256sum virtualbox-6.0_6.0.0-127566~Debian~stretch_amd64.deb 
57bf19d6bbd61a87d02b653dd7ba066fdfcdaf12d489815aeaf172e8b2d55057 virtualbox-6.0_6.0.0-127566~Debian~stretch_amd64.deb

原sha256码:

debian9.6安装virtualbox_linux_02

 没问题,继续。

3,第一次安装

guoyanzhang@bogon:~/下载$ sudo dpkg -i virtualbox-6.0_6.0.0-127566~Debian~stretch_amd64.deb

发现问题

dpkg: 依赖关系问题使得 virtualbox-6.0 的配置工作不能继续:
virtualbox-6.0 依赖于 libcurl3 (>= 7.16.2);然而:
未安装软件包 libcurl3。
virtualbox-6.0 依赖于 libqt5opengl5 (>= 5.0.2);然而:
未安装软件包 libqt5opengl5。
virtualbox-6.0 依赖于 libqt5printsupport5 (>= 5.0.2);然而:
未安装软件包 libqt5printsupport5。

dpkg: 处理软件包 virtualbox-6.0 (--install)时出错:
依赖关系问题 - 仍未被配置

 解决依赖性,

guoyanzhang@bogon:~/下载$ sudo apt --fix-broken install

4,第二次安装

guoyanzhang@bogon:~/下载$ sudo dpkg -i virtualbox-6.0_6.0.0-127566~Debian~stretch_amd64.deb

又出现问题,

This system is currently not set up to build kernel modules.
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 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

There were problems setting up VirtualBox. To re-start the set-up process, run
/sbin/vboxconfig
as root.

安装header,

guoyanzhang@bogon:~/下载$ sudo apt-get install linux-headers-4.9.0-8-amd64

 有两个选项 linux-headers-amd64和linux-headers-4.9.0-8-amd64,为什么选这个,是因为:

guoyanzhang@bogon:~/下载$ uname -a
Linux bogon 4.9.0-8-amd64 #1 SMP Debian 4.9.130-2 (2018-10-27) x86_64 GNU/Linux

5,第三次安装

guoyanzhang@bogon:~/下载$ sudo dpkg -i virtualbox-6.0_6.0.0-127566~Debian~stretch_amd64.deb

就没有问题了,在搜索栏,有一个virtualbox图标:

debian9.6安装virtualbox_依赖关系_03

6,打开,如下:

debian9.6安装virtualbox_linux_04

7,设置“桥接”

在“设置”里面,

debian9.6安装virtualbox_依赖关系_05