作者:醉龙凌云 时间:2007.5.13 首发:中国虚拟化先锋网 说明:转载请注明所有信息 功夫不负有心人啊,经过长久的摸索,终于为fedora系统安装vmware tools找到了一条最佳途径。 曾经,我找遍网络,找到了最专业最实际也曾经是最简单的办法为fedora(fedora 6以前版本叫fedora corelinux,7.0后就叫fedora linux)系统安装vmwaretools,具体如下:(如果大家已经了解这个方法或不想了解这个老方法可以跳过这节) ———————————————————————————————————————————————————————————————————— 1,安装GCC开发工具 # Install software called by by VMware Tools yum install gcc 2,安装内核文件 # Install kernel header files yum install kernel-devel 3.检查内核文件的版本是否匹配,如果不匹配需要进行升级 # Check it matches the running kernel uname -r # running kernel rpm -q kernel-devel # installed kernel headers 4,第3不中如果不匹配,则需要升级内核文件,升级完后,重新启动系统 # It the two versions do not match, run yum -y upgrade kernel kernel-devel # then reboot (but only if they did not match). 5,查找内核文件的位置,安装VMware-tool工具时候需要(我装的时候,会自动查找到,不需要手工指定) # Find out where the kernel headers are ls -d /usr/src/kernels/$(uname -r)*/include # You may need this later. 6,下载虚拟机工具安装包,即:VMware-tool安装包,并解压(具体就是在虚拟机工具栏上,点击"VM"->"Install VMware Tools",会出现安装包,选择*.gz的文件,解压到一个目录下就可以) 以下是命令行中具体实现方法,我是在图形界面下实现的 # If you already have VMwareTools-5.5.2-29772.tar.gz on disk, SKIP THIS STEP! # Download VMware-workstation-5.5.2-29772.tar.gz from vmware.com # Extract the VMware Tools iso from it tar --strip-components=3 -zxvf VMware-workstation-5.5.2-29772.tar.gz \ vmware-distrib/lib/isoimages/linux.iso # Create a temporary mount point mkdir /mnt/vmtools-temp # Mount the image mount -o loop linux.iso /mnt/vmtools-temp # Copy VMware Tools from the mount cp /mnt/vmtools-temp/VMwareTools-5.5.2-29772.tar.gz /tmp/ # Unmount the image and tidy up umount /mnt/vmtools-temp rmdir /mnt/vmtools-temp rm linux.iso # Unpack VMware Tools to a temporary directory cd /tmp/ tar zxvf VMwareTools-5.5.2-29772.tar.gz 7.进入解压目标目录,执行以下代码,一路回车按下来 cd /tmp/vmware-tools-distrib/ ./vmware-install.pl 8.直到该步骤,拷贝粘贴第5步的路径,然后一直按回车,直到选择屏幕分辨率。 What is the location of the directory of C header files that match your running kernel? [/usr/src/kernels/2.6.18-1.2849.fc6-i686/include] 提示信息显示hgfs模块安装有问题,没关系,下一篇文章中解决。 9.到了该步骤,问你是否改变X-window的设置,选y,就可以改变分辨率。 Do you want to change your guest X resolution? (yes/no) [no] y Please choose one of the following display sizes (1 - 13): [1] "640x480" [2]< "800x600" [3] "1024x768" [4] "1152x864" [5] "1280x800" [6] "1152x900" [7] "128024" [8] "137632" [9] "140050" [10] "1680x1050" [11] "1600x1200" [12] "1920x1200" [13] "2364x1773" Please enter a number between 1 and 13: [3] 还不行呢,再跟着下边的走吧! 10, I keep several Linux distributions running on VMware Workstation due tomy work. Unfortunately, due to recent changes in the Linux kernel, youcannot properly compile the vmhgfs driver on Fedora Core 6.Fortunately, I have a workaround until VMware releases a proper fix. First, go to /usr/lib/vmware-tools/modules/source and unpack vmhgfs.tar like this: ******************ggggggggggg************************ tar -xf vmhgfs.tar ******************************************************** Now you should have a new directory called vmhgfs-only. You need to get the following patch to make it work: vmhgfs-i_node-fix.patch(http://home.sztoltzteixeira.com/vmhgfs-i_node-fix.patch) To apply it, simply run: patch -p1 < /wherever/you/saved/it/vmhgfs-i_node-fix.patch This will patch vmhgfs-only/driver.c to conform with the kernelchanges. Now you will have to repack it and reconfigure the VMwareTools. Simply run the following two commands: tar -cf vmhgfs.tar vmhgfs-only ************************ggggggggggggggg******************* run the command: /usr/bin/vmware-config-tools.pl ********************************************************** If all you want is to get the module compiled, you're all set. If youactually need to access a shared folder, then you should know that thisworkaround will not work while SELinux is enabled. If you want to usethe files, you will have to disable SELinux by going to System ->Administration -> Security Level and Firewall. You will have toreboot, but after that, everything should work fine. One more thing. If your host is Windows, you may notice that the fileson the shared folders will appear as only accessible by root (they arein fact fully modifiable by everyone, but GNOME won't see it and thiscan be an annoyance.) If you want, the patch below will make all filesappear with proper permissions (all permissions for everyone.) Apply itusing the same steps used for the patch above. vmhgfs-perm-fix.patch (http://home.sztoltzteixeira.com/vmhgfs-perm-fix.patch) Now,all the ok. 下面是两个patch文件的内容: 1 diff -Naur vmhgfs-only/driver.c vmhgfs-only-new/driver.c --- vmhgfs-only/driver.c 2006-08-04 14:25:52.000000000 -0300 +++ vmhgfs-only-new/driver.c 2006-10-28 15:26:14.000000000 -0300 @@ -41,8 +41,8 @@ #define HGFS_SB_TO_COMMON(sb) ((HgfsSuperInfo *)(sb)->s_fs_info) #endif -#define INODE_SET_II_P(inode, info) do { (inode)->u.generic_ip = (info); } while (0) -#define INODE_GET_II_P(inode) ((HgfsInodeInfo *)(inode)->u.generic_ip) +#define INODE_SET_II_P(inode, info) do { (inode)->i_private = (info); } while (0) +#define INODE_GET_II_P(inode) ((HgfsInodeInfo *)(inode)->i_private) /* * 2.5.x kernels support nanoseconds timestamps. @@ -760,7 +760,6 @@ inode->i_uid = 0; /* This is bogus, should be the mount owner. */ inode->i_gid = 0; /* This is bogus, should be the mount owner. */ inode->i_rdev = 0; /* Device nodes are not supported */ - inode->i_blksize = HGFS_BLOCKSIZE; inode->i_blocks = (attr->size + HGFS_BLOCKSIZE - 1) / HGFS_BLOCKSIZE; inode->i_size = attr->size; HGFS_SET_TIME(inode->i_atime, attr->accessTime); 2 --- vmhgfs-only/driver.c 2006-10-28 15:26:14.000000000 -0300 +++ vmhgfs-only/driver.c-new 2006-10-28 15:34:07.000000000 -0300 @@ -755,7 +755,7 @@ /* Set the access mode. */ inode->i_mode &= ~S_IRWXUGO; - inode->i_mode |= (attr->permissions << 6); /* Only applies to owner. */ + inode->i_mode |= attr->permissions * 0111; /* Only applies to owner. */ inode->i_nlink = 1; /* Bogus? */ inode->i_uid = 0; /* This is bogus, should be the mount owner. */ inode->i_gid = 0; /* This is bogus, should be the mount owner. */ 最后修改xorg config设置,不然重启后会报X-WINDOWS出错。 进入/etc/X11/,用文本打开xorg.conf,加上以下几段: 1、Section "Monitor" Identifier "vmware" EndSection Section "InputDevice" Identifier "Mouse0" Driver "vmmouse" Option "Protocol" "Auto" Option "Device" "/dev/input/mouse0" EndSection 2、Section "Monitor" Identifier "Monitor0" ModelName "LCD Panel 1280x1024" HorizSync 31.5 - 67.0 VertRefresh 50.0 - 75.0 Option "dpms" EndSection 然后找到 含有"ServerLayout" 的section, 在Section跟EndSection之间加上以下一行。 InputDevice "Mouse0" "CorePointer" ————————————————————————————————-—————————————————————— 呵呵,仔细算一下吧,一般安装好系统的话,总是可以在网上找到更新包的,所以进行前面几步更新的话,你需要一个可以联网的fedora,由于是连接到外国的服务器,又由于没有迅雷可以用,所以:gcc安装更新的话,有16M之多,kernel-devel安装的话有60M的文件要下载,这个在网络好的情况下也大概要折腾整个白天吧。安装完了,还要修改配置,才能正常使用!累啊。 我可受不了的哦。 fedora这么优秀的系统就是为了方便我们的学习,方便我们的使用,方便我们的操作啊!为什么要这么复杂呢! 现在在fedora下安装vmware tools就改用下面的方法吧: ******************************************************************************************************** 第一步:为此客户机(GUEST OS)选择插入了此fedora系统的安装光盘的光驱。 第二步:启动此客户机,在图像模式下(图形模式比较方便,如果你喜欢在文本模式下操作只能说明你是高手哦)挂载光盘,打开/Media/disk/Fedora/RPM,也就是光盘里的fedora文件夹下的rpm文件夹,里面有kenel-devel-(版本号)-i586.RPM和一个i686的RPM文件,根据你的系统选择一个,安装就可以了。然后弹出光盘。(i386、i586、i686指的是适用于intel i386、 i586、i686兼容指令集的微处理器。一般来说,等级愈高的机器可接受较低等级的rpm文件。你可以透过/proc/cpuinfo这个档案查询你的CPU等级。) 这一步是核心,这一步就代替了老方法的前7部,就给你省了整个白天的时间。第三步:选择在虚拟机的菜单vm下选择install vmware tools,在客户机fedora里面挂载光盘。解压VMwareTools-(版本号).tar.gz的文件到/tmp中。以上的步骤在图像模式下很简单,文本模式下的命令方式就不讲了。 第四步:在fedora系统下按ctrl+alt+F1进入虚拟平台1,以root帐户登录,运行一下命令:/tmp/vmware-tools-distrib/vmware-install.pl 回车就开始安装了,如果找不到这个文件则用cd和ls查看刚才解压的目录下的PL文件的文件名。 第五步:一路回车,选择默认的即可。 特别说明:在 What is the location of the directory of C header files that match your running 这一步时,系统会给你自动选择正确的文件夹位置,不用改了,直接回车。一般是/lib/modules/(版本号)/build/include 第六步:在分辨率选择界面按数字选择分辨率。所以操作都是自动的,一直到安装完成,回到$的输入提示符下。 第七步:输入reboot。成功 ********************************************************************************************************* 现在,你就可以自由的将鼠标移进移出虚拟机了,共享文件夹仍然在/mnt/hgfs下面,访问windows的共享文件夹非常快。感觉真的很爽啊。 然后可以把tmp下解压出来的文件夹给删了,给自己的硬盘省点空间嘛,本来fedora就够大的了。 在终端下使用 $vmware-toolbox 打开vmware tools配置对话框。 光盘里的kernel-devel只有几M,比你用迅雷下源码40多M也小多了吧,一切都是那么的简单,原理呢,也就省略 了。 我也查看了solaris,debian等系统下vmware tools的安装方法,我想应该跟这个差不多吧。也希望给使用其他linux系统的朋友做个参考。redhat的当然就更简单了,直接安装vmware tools就好了。希望linux越来越普及。 |
[转] fedora linux下安装vmware tools的最好方法
最新推荐文章于 2023-10-10 10:06:23 发布