方法一:php
參考:python
https://www.virtualbox.org/wiki/Linux_Downloadslinux
更新sources.listc++
deb http://download.virtualbox.org/virtualbox/debian wheezy contrib
執行命令
wget -q http://download.virtualbox.org/virtualbox/debian/oracle_vbox.asc -O- | sudo apt-key add -
執行命令
sudo apt-get update
sudo apt-get install virtualbox-4.2
安裝時若是出現依賴問題能夠執行 sudo apt-get -f install
方法二 安裝開源版本的VirtualBox,通常發行的光盤鏡像中都有。web
下載地址:http://download.virtualbox.org/virtualbox/redis
若是想本身編譯請參考:https://www.virtualbox.org/wiki/Linux%20build%20instructionsshell
我已經把改網頁的內容copy過來了:跳轉oracle
pengdl@debian:~$ sudo apt-get install virtualbox-ose Reading package lists... Done Building dependency tree Reading state information... Done The following extra packages will be installed: libvncserver0 virtualbox-ose-dkms virtualbox-ose-qt Suggested packages: libvncserver0-dbg virtualbox-guest-additions vde2 The following NEW packages will be installed: libvncserver0 virtualbox-ose virtualbox-ose-dkms virtualbox-ose-qt 0 upgraded, 4 newly installed, 0 to remove and 134 not upgraded. Need to get 0 B/14.7 MB of archives. After this operation, 51.9 MB of additional disk space will be used. Do you want to continue [Y/n]?
爲了保證可以安裝成功,須要安裝一下其餘的軟件包:app
sudo apt-get install module-assistant sudo apt-get install dkms sudo apt-get install build-essential sudo apt-get install linux-headers-`uname -r`
While we try to not favor any distribution, we only build with certain distributions. This includes Debian, Ubuntu, Gentoo and Red Hat Enterprise Linux. Things should not be much different for other distributions though. If you want to supply specific build instructions (especially package names) for other distributions, please contact the VirtualBox team.less
You need:
On 64-bit systems you need the following packages as well:
On Debian-based systems, the following command should install the required packages:
apt-get install gcc g++ bcc iasl xsltproc uuid-dev zlib1g-dev libidl-dev \ libsdl1.2-dev libxcursor-dev libasound2-dev libstdc++5 \ libhal-dev libpulse-dev libxml2-dev libxslt1-dev \ python-dev libqt4-dev qt4-dev-tools libcap-dev \ libxmu-dev mesa-common-dev libglu1-mesa-dev \ linux-kernel-headers libcurl4-openssl-dev libpam0g-dev \ libxrandr-dev libxinerama-dev libqt4-opengl-dev makeself \ libdevmapper-dev default-jdk python-central \ texlive-latex-base \ texlive-latex-extra texlive-latex-recommended \ texlive-fonts-extra texlive-fonts-recommended
apt-get install ia32-libs libc6-dev-i386 lib32gcc1 gcc-multilib \ lib32stdc++6 g++-multilib
On Fedora (tested with 17), the following should do:
yum install gcc-c++ libcap-devel libcurl-devel libIDL-devel libstdc++-static \ libxslt-devel libXmu-devel openssl-devel pam-devel pulseaudio-libs-devel \ python-devel qt-devel SDL_ttf-devel SDL-static texlive-latex wine-core \ device-mapper-devel wget subversion subversion-gnome kernel-devel \ glibc-static zlib-static glibc-devel.i686 libstdc++.i686 libpng-devel
To get the beramono.sty LaTeX style which is missing in Fedora (thanks to Perry):
cd /usr/share/texmf/tex/latex/ mkdir bera cd bera/ wget http://www.tug.org/texlive/devsrc/Master/texmf-dist/tex/latex/bera/beramono.sty texhash
On Gentoo, the following should do:
emerge -av sys-devel/bin86 sys-devel/dev86 sys-power/iasl libxslt xerces-c \ xalan-c libXcursor =qt-3* libIDL libsdl hal alsa-lib pulseaudio
Note that VirtualBox makes use of YASM as its assembler which is part of the source repository as the currently available releases of YASM contain various bugs. As soon as a working release becomes officially available, we will add YASM to the list of prerequisites.
Building on a 64bit host still requires 32bit libraries and build tools as the Guest Additions which are part of the build process are 32bit. Note that on 64bit Ubuntu systems some links to shared libraries are missing. This can be fixed with
ln -s libX11.so.6 /usr/lib32/libX11.so ln -s libXTrap.so.6 /usr/lib32/libXTrap.so ln -s libXt.so.6 /usr/lib32/libXt.so ln -s libXtst.so.6 /usr/lib32/libXtst.so ln -s libXmu.so.6 /usr/lib32/libXmu.so ln -s libXext.so.6 /usr/lib32/libXext.so
./configure --disable-hardeningIf it finds everything it needs, it will create a file called 'AutoConfig.kmk' containing paths to the various tools on your system. Also, it will create an environment setup script called env.sh. This step only has to be done once (if something changes in your build tool setup, you might have to repeat it but keep in mind that both output files will be overwritten).
The switch --disable-hardening should not be used for building packages for redistribution or for production use.
source ./env.sh
kmk allThis produces the required binaries in out/linux.x86/release/bin/. If you want to build a debug version, type
kmk BUILD_TYPE=debugIn case you have more than one CPU core, kmk will automatically do a parallel build.
cd out/linux.x86/release/bin/components ln -s ../VBoxDDU.so . ln -s ../VBoxREM.so . ln -s ../VBoxRT.so . ln -s ../VBoxVMM.so . ln -s ../VBoxXPCOM.so .
Never disable hardening (see previous section) when creating packages for redistribution.
To be more LSB-compliant, change the default pathes which are used by the VirtualBox binaries to find their components. Add the following build variables to LocalConfig.kmk:
You can run VirtualBox directly from the build target directory (out/linux.x86/release/bin/). But first of all, you must build and install the VirtualBox kernel module, whose sources will have been copied to the build target directory.
So, issue the following:
cd out/linux.x86/release/bin/src make sudo make install cd ..
Then it should have been installed to your modules directory and you can load it using modprobe vboxdrv. Make sure you give yourself read and write access to /dev/vboxdrv.
If you made a hardened build, make sure that the setuid stubs have the correct permissions:
for f in VirtualBox VBoxHeadless VBoxSDL VBoxBFE VBoxNetDHCP VBoxNetAdpCtl; do chown root.root $f chmod 4511 $f done
Finally, you can start one of the frontends, e.g.
./VirtualBox