1.去官網下載deb包,例如包名:linux
virtualbox-5.2_5.2.18-124319_Debian_stretch_amd64.deb
2.安裝web
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-amd64 There 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-amd64ui
咱們只須要安裝便可:spa
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
最後執行:code
sudo /sbin/vboxconfig
至此Virtual Box應該無大問題。blog
另外Virtual Box還有USB的拓展包能夠去官網查看安裝。get