如何通过命令行在 ubuntu 中安装 virtualbox?

如何通过命令行在 ubuntu 中安装 virtualbox?

我在 Windows 10 家庭版上使用 WSL。

Ubuntu版本是16.04 LTS。

我做了这些:

$ sudo apt-get install virtualbox

然后运行:

$ VBoxManage --version

错误是:

WARNING: The character device /dev/vboxdrv does not exist.
     Please install the virtualbox-dkms package and the appropriate
     headers, most likely linux-headers-3.4.0+.

     You will not be able to start VMs until this problem is fixed.
5.0.36_Ubuntur114008

跑步:

$ sudo apt-get install virtualbox-dkms

信息:

Reading package lists... Done
Building dependency tree
Reading state information... Done
virtualbox-dkms is already the newest version (5.0.36-dfsg-0ubuntu1.16.04.2).
virtualbox-dkms set to manually installed.
0 upgraded, 0 newly installed, 0 to remove and 3 not upgraded.

那么,如何安装呢?

答案1

如果你想拥有最新版本的 VirtualBox,请查看官方文档

根据您的发行版,添加以下其中一行/etc/apt/sources.list

deb http://download.virtualbox.org/virtualbox/debian xenial contrib
deb http://download.virtualbox.org/virtualbox/debian trusty contrib
deb http://download.virtualbox.org/virtualbox/debian precise contrib

或者,您可以使用 add-apt-repository 添加到您的 /etc/apt/sources.list:

sudo apt-add-repository "deb http://download.virtualbox.org/virtualbox/debian $(lsb_release -sc) contrib"

添加安全密钥:

wget -q https://www.virtualbox.org/download/oracle_vbox.asc -O- | sudo apt-key add -

安装 VirtualBox:

sudo apt-get update
sudo apt-get install virtualbox

相关内容