方法一:

参考:

https://www.virtualbox.org/wiki/Linux_Downloads

   更新sources.list

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
 
  • virtualbox-4.2 to install VirtualBox 4.2.18
  • virtualbox-4.1 to install VirtualBox 4.1.28
  • virtualbox-4.0 to install VirtualBox 4.0.20
  • virtualbox-3.2 to install VirtualBox 3.2.18
安装时如果出现依赖问题可以执行 sudo apt-get -f install

 方法二   安装开源版本的VirtualBox,一般发行的光盘镜像中都有。

下载地址:http://download.virtualbox.org/virtualbox/

如果想自己编译请参考:https://www.virtualbox.org/wiki/Linux%20build%20instructions

我已经把改网页的内容copy过来了:跳转

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
upgraded, newly installed, to remove and not upgraded.
Need to get 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]?

为了保证能够安装成功,需要安装一下其他的软件包:

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`

 


Linux build instructions

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.

Prerequisites

You need:

  • GCC 3.3.3 or later (except for the GCC 4.0.x series). GCC 4.4.1 is recommended.
  • as86 (real mode assembler, usually part of the dev86 or bin86 package.)
  • bcc (Bruce Evans C Compiler; often part of the dev86 package; only required for VBox < 4.2) 
    Note: The bcc compiler contained in openSUSE10.2 as part of dev86-0.16.0-218 is known to generate broken code. Unfortunately, bcc -v is not supported.
  • IASL (Intel ACPI compiler)
  • xsltproc (libxslt, XML style sheet processor)
  • libxml2 (required for VBox version >= 1.6, XML file handling)
  • libxslt1 (required for VBox version >= 1.6, XML file transformation)
  • libXcursor (required to support color mouse pointers in the guest)
  • libxinerama
  • librandr
  • Qt 4.x.y (with x >= 4, including the OpenGL part, required for VBox version > 3.0)
  • libIDL
  • libSDL (SDL frontend)
  • ALSA (audio backend)
  • PulseAudio (audio backend)
  • libhal (detect host floppy/DVD)
  • libcap (CAP_NET_RAW for ICMP sockets in NAT)
  • libdevmapper
  • libpam0g (PAM support for the guest additions, required for VBox version >= 3.2)
  • python-dev (Python bindings)
  • gsoap (webservice API, version 2.7.9f or higher)
  • Java SE 6 JDK (Java API bindings, both webservice and XPCOM)
  • Xmu (for OpenGL)
  • Mesa (for OpenGL)
  • cURL (version 7.16.1 or higher, required for VBox version >= 3.0)
  • Java JDK (required to generate the Java bindings)
  • makeself (for creating the generic installer package, required for VBox version >= 4.0)
  • pdflatex (normally provided by texlive-latex-base)

On 64-bit systems you need the following packages as well:

  • ia32-libs (various libraries needed for compiling the 32-bit guest additions)
  • libc6-dev-i386 (libc6 i386 development headers)
  • lib32gcc1 (gcc support for i386)
  • gcc-multilib (gcc support for i386)
  • lib32stdc++6 (libstdc++ for i386)
  • g++-multilib (g++ support for i386)

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
  • On 64-bit Debian-based systems, the following command should install the required additional packages:

    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.

Special tweaks for 64 bit binaries

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

Building VirtualBox

  1. Change to the root directory of the sources and execute the configure script:

    ./configure --disable-hardening
    

    If 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.

  1. Whenever you want to build VirtualBox, you have to open a shell and source the generated environment setup script 'env.sh', i.e. do

    source ./env.sh
  1. To build a release package, type

    kmk all
    

    This produces the required binaries in out/linux.x86/release/bin/. If you want to build a debug version, type

    kmk BUILD_TYPE=debug
    

    In case you have more than one CPU core, kmk will automatically do a parallel build.

  1. If you made a hardened build (that is, you omitted the --disable-hardened switch from configure) you have to set some symbolic links manually to be able to start VMs from the bin/ directory:

    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 .

Building VirtualBox packages for distribution

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:

VBOX_PATH_APP_PRIVATE_ARCH := /usr/lib/virtualbox
This is the application's private directory, architecture-dependent.
VBOX_PATH_SHARED_LIBS := $(VBOX_PATH_APP_PRIVATE_ARCH)
Where to put the shared libraries, usually the same directory as the private path as the VirtualBox shared libraries are normally not used by any other application.
VBOX_WITH_ORIGIN :=
Disable RPATH=$ORIGIN and use a fixed RUNPATH.
VBOX_WITH_RUNPATH := $(VBOX_PATH_APP_PRIVATE_ARCH)
Set RUNPATH to the directory where our shared libraries can be found.
VBOX_PATH_APP_PRIVATE := /usr/share/virtualbox
This is the applications's private directory, not architecture-dependent.
VBOX_PATH_APP_DOCS := /usr/share/doc/virtualbox
Set the directory containing the documentation. The file VirtualBox.chm and UserManual.pdf are searched within this directory.
VBOX_WITH_TESTCASES :=
Save compile time by not building the testcases.
VBOX_WITH_TESTSUITE :=
Save compile time by not building the testsuite. 

Running your build

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

debian6 安装VirtualBox的方法的更多相关文章

  1. VirtualBox内刚刚安装完Debian9系统,也无法设置共享文件夹。解决的方法就是安装VirtualBox客户端增强包。

    VirtualBox内刚刚安装完Debian9系统,也无法设置共享文件夹.解决的方法就是安装VirtualBox客户端增强包. 1.若直接安装客户端增强包会得到如下提示:root@debian:/op ...

  2. VirtualBox内刚刚安装完CentOS6.9和7系统,无法调整屏幕的分辨率,也无法设置共享文件夹。解决的方法就是安装VirtualBox客户端增强包。

    VirtualBox内刚刚安装完CentOS6.9和7系统,无法调整屏幕的分辨率,也无法设置共享文件夹.解决的方法就是安装VirtualBox客户端增强包. 1.若直接安装客户端增强包会得到如下提示: ...

  3. 安装 VirtualBox 出现回滚,无法安装及解决方法

    原文:安装 VirtualBox 出现回滚,无法安装及解决方法 缘由:打算安装 Vagrant,因此打算安装 VirtualBox. 现象:安装 VirtualBox,进度快到最后的时候,安装程序执行 ...

  4. 安装virtualbox出现2503、2502的错误提示解决方法

    安装virtualbox右键选择以管理员的身份打开即可

  5. 使用 yum 安装 virtualbox 虚拟机

    我的环境是centos7,所以也可以说是在centos7下使用yum安装virtualbox,不过对于其他的LINUX发行版方法都一样. 下面的操作都是在命令行中进行的. 1.首先需要配置yum的源. ...

  6. Ubuntu 12.04 下安装 VirtualBox 及虚拟机winxp的安装

    参考文档: http://wenku.baidu.com/view/a51ac26c9b6648d7c1c746d7.html 1.首先,先去官网(http://www.virtualbox.org) ...

  7. Ubuntu 14.04 安装 VirtualBox

    参考: ubuntu14.04,安装VirtualBox 5.0(虚拟机软件)! 由于Vagrant工具的需要,安装了一下VirtualBox. 使用参考链接的法一居然在软件中心里面报错,我想可能是没 ...

  8. 在VirtualBox中安装了Ubuntu后,Ubuntu的屏幕分辨率非常小,操作非常不便。通过安装VirtualBox提供的“增强功能组件”,-摘自网络

    在VirtualBox中安装了Ubuntu后,Ubuntu的屏幕分辨率非常小,操作非常不便.通过安装VirtualBox提供的“增强功能组件”,可以解决这一问题,并且使用非常方便. 一.环境 | En ...

  9. 在Ubuntu 18.04系统上安装Systemback的方法(抄)

    在Ubuntu 18.04系统上安装Systemback的方法 2018-12-26 21:39:05作者:林莉稿源:云网牛站 本文介绍如何在Ubuntu 18.04或者Ubuntu 18.10系统上 ...

随机推荐

  1. js删除一个父元素下面的所有子元素

    比如<div id="ok"><button tpye='button'>111111</button><p>22222</p ...

  2. pageContext对象的用法详述

    pageContext对象  这个对象代表页面上下文,该对象主要用于访问JSP之间的共享数据. pageContext是PageContext类的实例,使用pageContext可以访问page.re ...

  3. 【BZOJ】1770 [Usaco2009 Nov]lights 燈

    [算法]高斯消元-异或方程组 [题解]良心简中题意 首先开关顺序没有意义. 然后就是每个点选或不选使得最后得到全部灯开启. 也就是我们需要一种确定的方案,这种方案使每盏灯都是开启的. 异或中1可以完美 ...

  4. sql注入预防

    在我们登陆验证时会发现sql注入的现象. 1.sql注入发生原因 因为如果用户在用户名上输入的是' or 1=1 # 时,我们得到的sql语句是select * from shop_user wher ...

  5. [bzoj1588][HNOI2002]营业额统计——splay

    题目大意 你被要求编写一个数据结构,支援以下操作,操作在线. 插入一个元素 查询一个元素与之前插入元素的最小差值. 题解 一道模板题.我是写了一个pre和succ函数水过的.1A,比较高兴. 代码 # ...

  6. vc6.0里使用lib(静态库)的方法

    vc6.0 中使用lib文件 使用库的方法如下:1. 包含库的头文件(把库的头文件包含到项目中)在应用程序工程中使用#include "file path"file path可以为 ...

  7. Splunk笔记

    学习Splunk Fundamentals Part 2 (IOD) 和 Splunk Fundamentals Part 1课程的笔记. Chart Over By Tips: ….|chart c ...

  8. C++ 异常~一 转

    C++ 异常机制分析   阅读目录 C++异常机制概述 throw 关键字 异常对象 catch 关键字 栈展开.RAII 异常机制与构造函数 异常机制与析构函数 noexcept修饰符与noexce ...

  9. js异步实现checkbox选中

    参考:https://blog.csdn.net/long19901216/article/details/51374064 https://blog.csdn.net/hahei2020/artic ...

  10. Linux音频编程

    1. 背景 在<Jasper语音助理介绍>中, 介绍了Linux音频系统, 本文主要介绍了Linux下音频编程相关内容. 音频编程主要包括播放(Playback)和录制(Record), ...