在VMWARE里面安装Archlinux

From ArchWiki

Jump to: navigation, search
i18n
English
简体中文
Español
Image:Tango-preferences-desktop-locale.png This page (or parts of it) was marked to be translated.
If you speak the original and target languages of the page, feel free to finish the translation. After you have finished the translation, remove the {{translateme}} flag from the document.

在一个虚拟机(比如xp,macos上运行的vmware虚拟机里)安装Arch Linux 一点问题都没有,但是Vmware提供的的linux客户端的Vmware-tools不能被安装到archlinux上。

提示:你可能根本不需要VMWare-tools,这个取决于你想要干嘛. 如果你想要更高的屏幕分辨率,与主机共享文件夹或者其他特殊功能,你才需要安装VMWare-tools。

Contents

[edit] 过程

注意:现在你可以安装open-vm-tools这个包,这个包可以从Community源里面获得. 所以只需要输入:

pacman -Sy open-vm-tools

开启VMware tools:

/etc/rc.d/open-vm-tools start

或者在启动时候自动加载,加入到/etc/rc.conf里面deamon一行:

DEAMONS=(.... ... .... open-vm-tools ...)

注意:x86_64没有open-vm-tools包

所以所有下面的工作就不需要啦! : )

大多数操作都需要root权限。

写本文时候所用软件版本:

  • ArchLinux with kernel 2.6.17-3 & 2.6.18-2 / Xorg 7.1 installed on VMWare Workstation 5.5.2 build-29772 running on a Archlinux host
  • ArchLinux (Duke) with kernel 2.6.21.1-8 installed on VMWare Workstation 6.0.0 build-45731 running on a Windows XP host
  • ArchLinux (Don't Panic) with kernel 2.6.22.6-2 installed on VMWare Workstation 6.0.1 build-55017 running on a Windows XP host

警告

  • VMWare Workstation 6.0.0 build-45731 的客户端程序 不能 在kernel 2.6.22上工作!
  • 要解决这个问题,保证你的系统(除了内核)升级到最新,即执行下面的,进行系统升级(来获取Don't Panic 2007.08):
pacman -Su --ignore kernel-headers --ignore kernel26 --ignore glibc --ignore binutils --ignore gcc

为 KERNELS >= 2.6.22 升级

  • VMWare Workstation 6.0.1 build-55017 完美运行kernel 2.6.22和更高版本。
  • 只需要简单的根据这个文档的描述,除了一个必须的补丁(改变)来完成客户端工具的安装。在解压VMware的工具到/opt/vmware-tools后,进行如下操作:
cd /opt/vmware-tools/lib/vmware-tools/modules/source
tar -xvf vmhgfs.tar
cd vmhgfs-only
<编辑compat_slab.h> 然后应用下面写出的简单一行的补丁
cd ..
mv vmhgfs.tar vmhgfs.tar.orig
tar -cvf vmhgfs.tar vmhgfs-only
<根据文章描述继续>
compat_slab.h
@@ -24,7 +24,7 @@
/*
 * Destructor is gone since 2.6.23-pre1.
 */
-#if LINUX_VERSION_CODE < KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
+#if LINUX_VERSION_CODE <= KERNEL_VERSION(2, 6, 22) || defined(VMW_KMEMCR_HAS_DTOR)
#define compat_kmem_cache_create(name, size, align, flags, ctor) \
kmem_cache_create(name, size, align, flags, ctor, NULL)
#else

[edit] 准备工作

(Some important parts of this procedure were adapted from/inspired by a page called VMWare on Slackware Linux; more technical information that this author does not pretend to understand is there.)

(directory paths have been chosen similar to those used in the vmware-workstation AUR package)

This guide assumes the user is installing from the .tar.gz package (not the .rpm). see http://www.vmware.com/support/ws55/doc/ws_newguest_tools_linux.html for details

Problem #1: The VMWare-tools install script (vmware-install.pl) assumes that since the guest OS is Linux, the OS will be using sysV style init scripts. Since Arch uses BSD style init, VMWare needs to be given a directory containing the expected rc0.d to rc6.d and init.d. Running the following as root should give VMWare enough of a sysV interface to be satisfied:

mkdir -p /etc/vmware-tools/init.d
cd /etc/vmware-tools
mkdir rc0.d
mkdir rc1.d
mkdir rc2.d
mkdir rc3.d
mkdir rc4.d
mkdir rc5.d 
mkdir rc6.d

For the Bash power user: mkdir rc{0,1,2,3,4,5,6}.d

Create a link from /etc/rc.d/network to /etc/vmware-tools/init.d

ln -s /etc/rc.d/network /etc/vmware-tools/init.d/network

问题 #2:

The vmware-tools installer checks for an entry in the kernel header's version.h file, that does not exist there. We'll paste it into the file with the following command:

echo "#define UTS_RELEASE \"`uname -r`\"" >> /usr/src/linux-`uname -r`/include/linux/version.h

Check if it is done right (2.6.19-ARCH replaced with your kernel version):

cat /usr/src/linux-`uname -r`/include/linux/version.h

#define LINUX_VERSION_CODE 132627
#define KERNEL_VERSION(a,b,c) (((a) << 16) + ((b) << 8) + (c))
#define UTS_RELEASE "2.6.19-ARCH"

[edit] 开始安装程序

Expose the VMWare Tools iso by selecting VM -> Install VMWare Tool... from the VMWare Workstation menu.

Mount the VMWare Tools iso, copy the tar.gz, and extract:

mount /mnt/cdrom
cp /mnt/cdrom/VMwareTools-6.0.0-45731.tar.gz ~
umount /mnt/cdrom
cd ~
tar -zxvf VMwareTools-6.0.0-45731.tar.gz

Go to the place you extracted the installer and start the installer:

cd ~/vmware-tools-distrib
./vmware-install.pl

Specify the following answers:

"In which directory do you want to install the binary files?": /opt/vmware-tools/bin
"What is the directory that contains the init directories ... ?": /etc/vmware-tools
For the rest accept default locations and say yes when a directory creation is needed.
When the installer asks you to run vmware-config-tools.pl answer 'no' 

The installer part is done.

[edit] 运行配置脚本

运行 /opt/vmware-tools/bin/vmware-config-tools.pl

这个脚本提问 'What is the location of the directory of C header files that match your running kernel? [/usr/src/linux/include]'. 回答如下:

/usr/src/linux-`uname -r`/include

脚本将编译一些东西,选择Xorg,提示选择一个X屏幕分辨率。你需要已经安装好Xorg在你的系统里面来让X配置正常工作。更多请看Xorg (简体中文)。At the very least you should run:

pacman -S xorg-server xorg-xkb-utils xorg-xauth xorg-server-utils xorg-xinit
pacman -S xf86-video-vesa xf86-input-mouse xf86-input-keyboard
pacman -S hwd
hwd -x
mv /etc/X11/xorg.conf.hwd /etc/X11/xorg.conf

[edit] 最后一步

pacman -S xf86-video-vmware xf86-input-vmmouse

编辑/etc/X11/xorg.conf,寻找

Section     "InputDevice"
Identifier  "Mouse1"

改成下面:

Driver      "vmmouse"
Option      "Device"   "/dev/psaux"

如果不能正常工作(比方在VMWare Fusion里面):

Section "InputDevice"

       Identifier  "Mouse1"
       Driver      "mouse"

EndSection

在MacOS里面你应该可以(当然在重启X之后)使用使用两个鼠标键还有双击。

在 rc.conf 里面迅早 MODULES= 这一行然后禁用 pcnet32 模块然后启用vmware模块,就类似下面的:

MODULES=(!pcnet32 vmblock vmxnet vmmemctl vmhgfs)

为了保证日期和时间能和主机同步,vmware-guestd程序必须在运行。这个程序可以在开机时候通过下面步骤开启:

cd /etc/rc.d 
ln -s /etc/vmware-tools/init.d/vmware-tools vmware-tools

然后在 rc.conf 里面寻找 DAEMONS= 这一行然后把 'vmware-tools' 添加进去

额外的,为了能复制/粘贴能在X和主机之间工作,你必须开启 'vmware-user' 程序。添加下面一行到你的配置文件中,.xinitrc 或者 .xsession (任何你的程序能在X启动的时候启动的地方):

/opt/vmware-tools/bin/vmware-user &

不过注意某些版本的VMWare (e.g. the tools shipped with Fusion) 位置在 /usr/lib/vmware-tools/bin32/.

如果你使用KDE,vmware-user必须从 Autostart 文件夹里启动. 创建一个名叫 vmware-user 的文件到 ~/.kde/Autostart 目录中。

内容如下:

#!/bin/bash
vmware-user &

重启,然后所有功能应该能正常工作了。

[edit] 与主机共享文件夹

创建一个新的共享文件夹,即选择VMware Workstation菜单上的VM -> Settings...。然后选择Options选项然后选Shared Folder。选中Always enabled选项然后创建一个新共享。对于XP,你可以创建一个用C当名字的共享,而主机地址为C:\

然后添加下面一行到/etc/fstab文件里(如果有需要就更改uid/gid):

.host:/ /mnt/hgfs vmhgfs defaults,user,ttl=5,uid=root,gid=root,fmask=0133,dmask=0022 0 0

创建一个文件夹来挂载:

mkdir /mnt/hgfs
mount /mnt/hgfs

现在你的共享文件夹都可以在/mnt/hgfs下看到

/mnt/hgfs/<Shared Folder Name>

以Windows XP C共享为例:

ls /mnt/hgfs/C
... all your Windows files under C:\ ...

[edit] 更多请看

Installing VMware and Installing vmware player -- the opposite of this ;)

To get vmxnet working with the current (as of mid DEC06) stuff, review this: vmware tools 5.5.3, linux 2.6.19, vmxnet compile fix

Personal tools