Debian虚拟机安装Virtualbox增强功能(Guest Additions)具体步骤

在这篇文章中,我将展示如何在Debian虚拟机中安装Virtualbox增强功能(Guest Additions).增强功能可以让虚拟机全屏显示.这样使用虚拟机就跟使用物理机一样方便.我使用elementary OS作为宿主机(Host OS),Debian是客户机(Guest OS).但下面的方法适用于任何Linux宿主机.

在Debian虚拟机中安装Virtualbox增强功能

以root用户登录Debian,更新软件.

apt-get update && apt-get upgrade

安装内核模块编译时所需要的软件包.如果没有发现这两个软件包,请先配置好软件源

apt-get install build-essential module-assistant

在编译内核模块前准备好系统

m-a prepare

在虚拟机窗口中,选择设备 > 插入增强功能CD镜像

Debian虚拟机安装Virtualbox增强功能

它将询问你是否要下载增强功能iso镜像.选择下载

Debian虚拟机安装Virtualbox增强功能

Debian虚拟机安装Virtualbox增强功能

如果在上面的窗口中下载不了,那么前往 http://download.virtualbox.org/virtualbox 下载.选择你自己的版本,下载VBoxGuestAdditions iso镜像.保存在用户的home目录下.

如果以上方法都下载不了,那么你可以在宿主机终端里运行下面命令

sudo apt-get install virtualbox-guest-additions-iso

下载完后,插入iso镜像.如果你看见下面的错误,点击强制卸载

VirtualBox-Question_003

在Debian的终端里运行命令:

mount /media/cdrom

/media/cdrom目录下有一个VBoxLinuxAdditions.run文件,这是一个shell脚本文件.执行这个脚本文件.

sh /media/cdrom/VBoxLinuxAdditions.run

输出:

Verifying archive integrity... All good.
Uncompressing VirtualBox 4.3.34 Guest Additions for Linux............
VirtualBox Guest Additions installer
Copying additional installer modules ...
Installing additional modules ...
Removing existing VirtualBox DKMS kernel modules ...done.
Removing existing VirtualBox non-DKMS kernel modules ...done.
Building the VirtualBox Guest Additions kernel modules ...done.
Doing non-kernel setup of the Guest Additions ...done.
You should restart your guest to make sure the new modules are actually used

Installing the Window System drivers
Installing X.Org Server 1.16 modules ...done.
Setting up the Window System to use the Guest Additions ...done.
You may need to restart the the Window System (or just restart the guest system)
to enable the Guest Additions.

Installing graphics libraries and desktop services components ...done.

编译内核模块的这一行的结果一定要显示成功(done).编译完成后,重启Debian虚拟机.现在你可以使用右Ctrl + F键进入全屏模式.

有童鞋反映最后一步执行脚本时出错,具体错误如下:

The headers for the current running kernel were not found. If the module compilation fails then this could be the reason.

Building the main Guest Additions module ...done.
Building the shared folder support module ...fail!
(Look at /var/log/vboxadd-install.log to find out what went wrong)
Installing the Window System drivers ...fails!
(Could not find the X.Org or XFree86 Window System).

这是说未找到当前运行内核的头文件.可尝试安装linux-header和dkms

sudo apt-get install linux-headers-`uname -r` dkms

然后再执行VBoxLinuxAdditions.run脚本文件.

如果还是出错,那么更新virtualbox软件.

本文翻译自我的英文博客 How to Install Virtualbox Guest Additions on Debian Step by Step – linuxbabe.com.

 

为这篇文章评分
[Total: 5 Average: 3.2]

“Debian虚拟机安装Virtualbox增强功能(Guest Additions)具体步骤”的一个回复

  1. 新装了debian 8 jessie做宿主机,在vbox 客户机elementary /win7中,安装增强功能包一直没能成功,不知有什么解决办法。

发表评论

电子邮件地址不会被公开。 必填项已用*标注