Debian

如何在 Debian 10 上安裝 virtualbox 5.2 或 6.0?

  • June 9, 2021

我遵循了各種指南,例如

https://computingforgeeks.com/install-virtualbox-ubuntu-debian/

https://tecadmin.net/install-virtualbox-on-debian-10-buster/

在步驟:

apt install virtualbox-6.0

它失敗了:

root@debian:~# apt-get update
Hit:1 http://deb.debian.org/debian buster InRelease
Hit:2 http://deb.debian.org/debian-security buster/updates InRelease              
Hit:3 http://deb.debian.org/debian buster-updates InRelease                       
Hit:4 http://download.virtualbox.org/virtualbox/debian stretch InRelease                                  
Get:5 https://download.virtualbox.org/virtualbox/debian buster InRelease [7,733 B]                        
Get:6 https://download.virtualbox.org/virtualbox/debian buster/contrib amd64 Packages [1,521 B]
Fetched 9,254 B in 2s (4,145 B/s)    
Reading package lists... Done
root@debian:~# apt-get install virtualbox-6.0
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
virtualbox-6.0 : Depends: libcurl3 (>= 7.16.2) but it is not installable
                 Depends: libvpx4 (>= 1.6.0) but it is not installable
                 Recommends: libsdl-ttf2.0-0 but it is not going to be installed
                 Recommends: linux-headers-generic but it is not installable or
                             linux-headers-generic-pae but it is not installable or
                             linux-headers-686-pae but it is not installable or
                             linux-headers-amd64 but it is not going to be installed or
                             linux-headers-2.6-686 but it is not installable or
                             linux-headers-2.6-amd64 but it is not installable or
                             linux-headers but it is not installable
                 Recommends: linux-image but it is not installable
E: Unable to correct problems, you have held broken packages.

我嘗試手動安裝這些依賴項,但如果我嘗試安裝 libcurl3,它會告訴我只能安裝 libcurl4。如果我安裝 libcurl4,它似乎不會影響任何東西,因為它需要 libcurl3 而不是 4。

我想你可能需要deb http://download.virtualbox.org/virtualbox/debian bionic contrib. 以下對我有用:

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

   echo "deb http://download.virtualbox.org/virtualbox/debian bionic contrib" >> /etc/apt/sources.list

   apt update
   apt install virtualbox-6.0

當您嘗試它時,最好刪除/etc/apt/sources.list在遵循其他指南時所做的任何更改。

引用自:https://unix.stackexchange.com/questions/549043