标签:.net virtualbox 虚拟机
在 VirtualBox 4.1.10 软件中安装 openSUSE 12.1 操作系统后,它已经自带了 VBoxGuestAdditions 4.1.4,如下所示:
ben@vbox:~> zypper search virtualbox-guest Loading repository data... Reading installed packages... S | Name | Summary | Type --+------------------------------+--------------------------------------------+-------- | virtualbox-guest-kmp-default | Guest kernel modules for VirtualBox | package i | virtualbox-guest-kmp-desktop | Guest kernel modules for VirtualBox | package | virtualbox-guest-kmp-pae | Guest kernel modules for VirtualBox | package i | virtualbox-guest-tools | VirtualBox guest tools | package i | virtualbox-guest-x11 | VirtualBox X11 drivers for mouse and video | package ben@vbox:~> ben@vbox:~> zypper search -s virtualbox-guest-kmp-desktop Loading repository data... Reading installed packages... S | Name | Type | Version | Arch | Repository --+------------------------------+---------+------------------------+--------+----------------------- i | virtualbox-guest-kmp-desktop | package | 4.1.4_k3.1.0_1.1-3.2.3 | x86_64 | 163/Oss i | virtualbox-guest-kmp-desktop | package | 4.1.4_k3.1.0_1.1-3.2.3 | x86_64 | openSUSE-12.1-Oss i | virtualbox-guest-kmp-desktop | package | 4.1.4_k3.1.0_1.1-3.2.3 | x86_64 | openSUSE-12.1-12.1-1.4 v | virtualbox-guest-kmp-desktop | package | 4.1.4_k3.1.0_1.1-3.2.3 | i586 | 163/Oss v | virtualbox-guest-kmp-desktop | package | 4.1.4_k3.1.0_1.1-3.2.3 | i586 | openSUSE-12.1-Oss ben@vbox:~> ben@vbox:~> zypper info virtualbox-guest-kmp-desktop Loading repository data... Reading installed packages... Information for package virtualbox-guest-kmp-desktop: Repository: 163/Oss Name: virtualbox-guest-kmp-desktop Version: 4.1.4_k3.1.0_1.1-3.2.3 Arch: x86_64 Vendor: openSUSE Installed: Yes Status: up-to-date Installed Size: 413.0 KiB Summary: Guest kernel modules for VirtualBox Description: VirtualBox is an extremely feature rich, high performance product for enterprise customers, it is also the only professional solution that is freely available as Open Source Software under the terms of the GNU Public License (GPL).
这样的好处是不用在 VirtualBox 中另外安装增强功能了,坏处是这个增强功能的版本太低了,才 4.1.4,而最新版本是 4.1.10。
现在让我们开始安装 VBoxGuestAdditions 4.1.10 吧。
首先,使用 zypper 命令卸载 VBoxGuestAdditions 4.1.4:
ben@vbox:~> sudo zypper remove virtualbox-guest-kmp-desktop virtualbox-guest-tools virtualbox-guest-x11 Loading repository data... Reading installed packages... Resolving package dependencies... The following packages are going to be REMOVED: virtualbox-guest-kmp-desktop virtualbox-guest-tools virtualbox-guest-x11 3 packages to remove. After the operation, 6.1 MiB will be freed. Continue? [y/n/?] (y): Removing virtualbox-guest-tools-4.1.4-3.2.3 [done] Additional rpm output: redirecting to systemctl Warning: Unit file of created job changed on disk, ‘systemctl --system daemon-reload‘ recommended. insserv: warning: script ‘S01atop‘ missing LSB tags and overrides insserv: warning: script ‘atop‘ missing LSB tags and overrides Removing virtualbox-guest-x11-4.1.4-3.2.3 [done] Removing virtualbox-guest-kmp-desktop-4.1.4_k3.1.0_1.1-3.2.3 [done]
然后做一些准备工作:
ben@vbox:~> sudo zypper refresh Repository ‘163/NON-Oss‘ is up to date. Repository ‘163/Oss‘ is up to date. Repository ‘163/Update‘ is up to date. Repository ‘Updates for openSUSE 12.1 12.1-1.4‘ is up to date. Repository ‘openSUSE-12.1-Non-Oss‘ is up to date. Repository ‘openSUSE-12.1-Oss‘ is up to date. All repositories have been refreshed. ben@vbox:~> sudo zypper update Loading repository data... Reading installed packages... Nothing to do. ben@vbox:~> sudo zypper install make gcc Loading repository data... Reading installed packages... ‘gcc‘ is already installed. No update candidate for ‘gcc-4.6-15.1.3.x86_64‘. The highest available version is already installed. ‘make‘ is already installed. No update candidate for ‘make-3.82-147.1.2.x86_64‘. The highest available version is already installed. Resolving package dependencies... Nothing to do. ben@vbox:~> uname -a Linux vbox 3.1.9-1.4-desktop #1 SMP PREEMPT Fri Jan 27 08:55:10 UTC 2012 (efb5ff4) x86_64 x86_64 x86_64 GNU/Linux ben@vbox:~> sudo zypper install kernel-desktop-devel Loading repository data... Reading installed packages... ‘kernel-desktop-devel‘ is already installed. No update candidate for ‘kernel-desktop-devel-3.1.9-1.4.1.x86_64‘. The highest available version is already installed. Resolving package dependencies... Nothing to do.
也就是说要先安装好 make、gcc 和 kernel-desktop-devel 软件包,从上面可以看出,我的机器上以前已经安装过这些软件包了。
另外,需要先安装好 dkms 软件包:
Be sure to install DKMS before installing the Linux Guest Additions. If DKMS is not available or not installed, the guest kernel modules will need to be recreated manually whenever the guest kernel is updated using the command /etc/init.d/vboxadd setup as root.
但是 openSUSE 操作系统不支持 dkms,而其他主流的 Linux 操作系统基本上都支持 dkms。这是很糟糕的,如上所述,以后 openSUSE 操作系统的内核 kernel 有升级的话,每次都要手动运行一次 sudo /etc/init.d/vboxadd setup 命令了。
现在,把 VirtualBox 软件安装目录下的 VBoxGuestAdditions.iso 文件拷贝到 openSUSE 操作系统中,然后:
ben@vbox:~/repo/VBoxGuestAdditions> 7z x VBoxGuestAdditions.iso 7-Zip [64] 9.20 Copyright (c) 1999-2010 Igor Pavlov 2010-11-18 p7zip Version 9.20 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,1 CPU) Processing archive: VBoxGuestAdditions.iso Extracting 32Bit Extracting 32Bit/OS2 Extracting 32Bit/OS2/VBoxGuest.sys Extracting 32Bit/OS2/VBoxService.exe Extracting 32Bit/OS2/gengradd.dll Extracting 32Bit/OS2/libc063.dll Extracting 32Bit/OS2/readme.txt Extracting 32Bit/OS2/vboxmouse.sys Extracting 32Bit/Readme.txt Extracting 64Bit Extracting 64Bit/Readme.txt Extracting AUTORUN.INF Extracting VBoxLinuxAdditions.run Extracting VBoxSolarisAdditions.pkg Extracting VBoxWindowsAdditions-amd64.exe Extracting VBoxWindowsAdditions-x86.exe Extracting VBoxWindowsAdditions.exe Extracting autorun.sh Extracting runasroot.sh Everything is Ok Folders: 3 Files: 16 Size: 50349560 Compressed: 50751488 ben@vbox:~/repo/VBoxGuestAdditions> sudo ./VBoxLinuxAdditions.run Verifying archive integrity... All good. Uncompressing VirtualBox 4.1.10 Guest Additions for Linux......... VirtualBox Guest Additions installer insserv: warning: script ‘S01atop‘ missing LSB tags and overrides insserv: warning: script ‘atop‘ missing LSB tags and overrides insserv: warning: script ‘S01atop‘ missing LSB tags and overrides insserv: warning: script ‘atop‘ missing LSB tags and overrides Removing existing VirtualBox DKMS kernel modules done Removing existing VirtualBox non-DKMS kernel modules done Building the VirtualBox Guest Additions kernel modules Building the main Guest Additions module done Building the shared folder support module done Building the OpenGL support module done Doing non-kernel setup of the Guest Additions done You should restart your guest to make sure the new modules are actually used insserv: warning: script ‘S01atop‘ missing LSB tags and overrides insserv: warning: script ‘atop‘ missing LSB tags and overrides insserv: warning: script ‘S01atop‘ missing LSB tags and overrides insserv: warning: script ‘atop‘ missing LSB tags and overrides insserv: warning: script ‘S01atop‘ missing LSB tags and overrides insserv: warning: script ‘atop‘ missing LSB tags and overrides insserv: warning: script ‘S01atop‘ missing LSB tags and overrides insserv: warning: script ‘atop‘ missing LSB tags and overrides Installing the Window System drivers failed (Could not find the X.Org or XFree86 Window System.)
最后的 Installing the Window System drivers 失败是正常的,因为我安装 openSUSE 操作系统是文本模式的,根本没有安装 X-Window。
ben@vbox:~/repo/VBoxGuestAdditions> ll /opt
total 8
drwxr-xr-x 8 root root 4096 Mar 4 10:08 mono-2.10.9
drwxr-xr-x 8 root root 4096 Mar 17 16:20 VBoxGuestAdditions-4.1.10
可以看出,VBoxGuestAdditions 安装在 /opt 目录下。
最后,重启虚拟机以完成安装:
ben@vbox:~> sudo /sbin/shutdown -r now Broadcast message from ben@vbox on pts/0 (Sat, 17 Mar 2012 16:27:46 +0800): The system is going down for reboot NOW!
在 VirtualBox 中为 openSUSE 操作系统分配一个数据空间,名称是 ISO,并且设为 Auto-Mount,如下所示:
那么在启动 openSUSE 操作系统后,在 /media 目录下就有一个相应的以 sf_ 开头目录,如下所示:
ben@vbox:~> df -h Filesystem Size Used Avail Use% Mounted on rootfs 9.1G 2.7G 5.9G 32% / devtmpfs 242M 32K 242M 1% /dev tmpfs 246M 0 246M 0% /dev/shm tmpfs 246M 308K 245M 1% /run /dev/sda1 9.1G 2.7G 5.9G 32% / tmpfs 246M 0 246M 0% /sys/fs/cgroup tmpfs 246M 308K 245M 1% /var/run tmpfs 246M 308K 245M 1% /var/lock tmpfs 246M 0 246M 0% /media none 80G 42G 39G 53% /media/sf_ISO ben@vbox:~> ll /media total 4 drwxrwx--- 1 root vboxsf 4096 Mar 17 14:33 sf_ISO
这个目录是属于 vboxsf 用户组的,所以我们使用以下命令将自己加入这个用户组:
ben@vbox:~> sudo /usr/sbin/usermod -A vboxsf `whoami` ben@vbox:~> grep `whoami` /etc/group video:x:33:ben sudo:!:1000:ben vboxsf:!:1001:ben
如果这个数据空间不是 Auto-Mount 的,则可以用 sudo mount -t vboxsf ISO /mnt 命令手动安装。
版权声明:本文为博主http://www.zuiniusn.com 原创文章,未经博主允许不得转载。
为虚拟机中的 openSUSE 12.1 安装 VBoxGuestAdditions 4.1.10
标签:.net virtualbox 虚拟机
原文地址:http://blog.csdn.net/u013141940/article/details/47098789