Debian/Linux装上VMware-tools

作者: zbatecn   发布日期: 2008-4-02    查看数: 398   出自: http://www.linuxdiyf.com  

最近一直想在Linux中开发S1mp3项目,可是我在VMware中装上 Debian/Linux后就是装不上VMware-tools,在网上搜集了一下资料没有一个适合我的,而且讲的都是很简单就装上来,没办法,只能自己 下手,经过几个小时的努力终于解决了,现在把自己的方法公布给大家,防止大家走弯路。

用到了以下几个命令apt-get、apt-cache、uname-a

首先检查的Debian在安装时,根本就没有安装gcc、内核头文件也没有。

执行步骤如下:

1.在vmware的菜单中选择Vm->install vmware-tools,这个时候vmware就会把安装文件映射到你的cdrom。

2.进入你的cdrom,点右键复制VMwareTools-5.5.0-18463.tar.gz到/tmp目录下,右键单击选择解压。当然这两步你也可以使用命令行方式,我对命令行不熟悉。详细的命令行方式,大家自己在网上就能搜到资料。

3.安装c编译器(前提没有安装gcc,可以通过which gcc命令来查看是否已安装)。

a.在命令行中键入:su (进入root进行程序安装,普通用户不能使用apt-get install),输入root的密码即可此时命令行从qinfengling@debian:$变为debian:/home/qinfengling#

b:接着在命令行中键入apt-get install gcc,选择默认就可顺利装上著名的gcc编译器

4.安装kernel-header (主要是为了解决What is the location of the directory of C header files that match your running kernel?问题),步骤如下:

a.在命令行中键入:uname -a 查看版本我的版本是:Linux debian 2.6.18-4-686

b.接着键入:apt-cache search headers 2.6.18-4-686(然后搜一下内核的头文件)

c.键入命令安装:apt-get install Linux-headers-2.6.18-2-686

5.之后你就顺利了,首先在命令行中进入/tmp/vmware-tools-distrib文件夹下,之后输入./vmware-install.pl,选择默认安装就行了,遇到[yes]就输入yes或者y。

 

 

 

dddddddddddddddddddddddddddddddddddddddddddddd

http://techguru.cn/tag/linux

dddddddddddddddddddddddddddddddddddddddddddddd

Posted in linux on 03/01/2009 09:03 下午 by tunpishuang

需要软件:
Vmware Workstation 6.5.1 (到Verycd下载
debian-500-amd64-DVD-1.iso (推荐个快的镜像
安装并打开Vmware Workstation,Help->About Wmware Workstation看看版本:

snap1

File->New->Virtual Machine->Typical->Installer disk image file(iso)指定为Debian-500-amd64-DVD-1.iso所在位置->Next->Linux->Version选择Other Linux 2.6.x kernel 64-bit(因为我是64位的机子:))->Virtual machine name:debian5 ->Location:D:/vmdebian5 ->Next->Maximum disk size:10GB->Next->Finish。这样我们的虚拟机就配置好了。

重启动按ESC,启动设备选择CD-ROM,这就我们就进了debian的安装界面了:

snap2

有Install和Graphical Install两种安装模式,机子猥琐点的就Install,牛X点的就Graphical Install , 我自认为4200+还不是很猥琐,且适合我这种newbie。

snap3

很久没有玩Lin,发现自己落后了,debian的界面真TM让人倍感亲切啊~Holy Awesome~~语言选择 简体中文 -> 继续 -> Choose Language(中文) ->继续 ->键盘布局(美国英语) -> 然后系统自动探测和挂载CD-ROM,查看里面的套件库(repository)  -> 主机名(刚才看了电影Sex Drive,就叫stiff-cock吧) ->继续 -> 域名(localdomain) -> 继续->这个时候系统正在获取服务器时间,由我校的网络情况来看,直接点“取消”-> 接下来是比较关键的分区了,选择“手动”用Diskdruid来分区,貌似没有必要用LVM(Logical Volume Management),如果不是用来做服务器的话。->继续。

snap4

选中SCSI1那个,继续,是否创建新的分区表(是) -> 继续 -> 选中空闲空间 继续, 具体的分区方法不讲了,我分了2个区:1GB的Swap和剩下所有分区作为根分区(Ext3 FS),如图:

snap5

“分区设定结束并将写入磁盘” ->继续 ->“将改动写入磁盘(是)” ->继续 ,根据我的经验来看,10GB的主分区也不显得多,因为所有debian的套件加起来有4.5个4.37左右的大小,也就是4.5 X 4.37 约=20GB ,囧~ 以后不出意外不会进X-Window,除非有时间研究gtk~ (废话一句,现在俺在学MFC),

接下来设置root的密码和自己创建一个普通用户和密码,一般我都这样设置:
username: root   password:x
username:tps     password:x
有些人觉得不安全,我觉得无所谓,反正都是做实验用,被黑了那是RPWT。

接下来问你时候扫描其他的CD/DVD媒介来安装,如果你就Debian-500-amd64-DVD-2.iso到Debian-500-amd64-DVD-5.iso 就一个一个的加载进去吧,

我就点否了,继续 ,接下来问俺们是否使用网络镜像,饿,Drcom的朋友直接“否” 继续 ->接下来点虚拟机的网卡托盘,Disconnect掉,否则会循环询问“是否用网络镜像”-> 接下来询问“是否参加软件包流行度调查?”->“否”,继续。

snap6

接下来选择要安装的软件,默认“桌面环境”和“标准系统” 已经勾选,我再添加个“Web服务器” “SQL数据库” ,免得以后安装apache,mysql麻烦。

snap8

接下来就是不长不短的安装时间,以安装套件数量而定。我突然发现左下角有个:

snap7

挺方便那些做安装教程,和安装的时候碰到问题的人。在安装的过程中,我吃上了“阿明菊花香瓜子”,比恰恰的烂瓜子少,且颗粒饱满,推荐食用,不要记错牌子哦,不是“菊爆香瓜子”哈~

好了安装的尾声叫我们是否GRUB安装到MBR,习惯性的我喜欢用GRUB引导其他系统,所以选“是”,重启动,来到登陆界面:

snap9

只能用普通用户登陆,要获得root权限,自己sudo,su

进来了:

snap10

为了达到更好的显示效果,需安装Vmware Tools,VM->Install Vmware Tools,然后Guest OS以CD的形式自动挂载到/media/cdrom0

Alt+F2 输入gnome-terminal
$cd /media/cdrom
$ cp *.tar.gz /home/tps/
$cd /home/tps
$tar zxvf *.tar.gz
$su 输入root密码
#apt-get -y install binutils kernel-package  linux-headers-2.6.26-1-amd64
#./vmware-tools-distrib/vmware-install.pl
接下来运行Vmware公司为咋们提供的傻瓜perl安装脚本,一路敲Enter,输入yes

当出现”What is the location of the directory of C header files that match your running kernel?” 输入/usr/src/linux-headers-2.6.26-1-amd64/include/
(kernel版本可以通过uname -a得到),接下来到了这样的提示:

None of the pre-built vmmemctl modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vmmemctl module
for your system (you need to have a C compiler installed on your system)?
[yes]

Using compiler “/usr/bin/gcc”. Use environment variable CC to override.

Your kernel was built with “gcc” version “4.1.3″, while you are trying to use
“/usr/bin/gcc” version “4.3.2″. This configuration is not recommended and
VMware Tools may crash if you’ll continue. Please try to use exactly same
compiler as one used for building your kernel. Do you want to go with compiler
“/usr/bin/gcc” version “4.3.2″ anyway? [no]

大概意思就是说没有找到适合俺们2.6.26-1-amd64内核的vmmemctl模块,需要自己编译,但是编译内核的gcc版本必须要和编译这个模块的版本符合,2.6.26-1-amd64用的是gcc 4.1.3编译的,而当前系统默认使用4.3.2,因为/usr/bin/gcc 是/usr/bin/gcc-4.3的软链接:
stiff-cock:/usr/bin# file /usr/bin/gcc
/usr/bin/gcc: symbolic link to `gcc-4.3′
在这里找到解决办法:
http://yuanfarn.blogspot.com/2008/10/debian-testing-on-vmware-workstation.html

所以不要使用4.3强制编译,因为我尝试了,会出现两个make的错误,所以运行这个先定义CC变量:
#CC=/usr/bin/gcc-4.1 ./vmware-tools-distrib/vmware-install.pl

接下来自动编译vmmemctl ,vmhgfs,vmxnet modules,然后更新initramfs:
update-initramfs: Generating /boot/initrd.img-2.6.26-1-amd64
然后系统再编译了一个叫vmblock.o的非内核模块~
然后:
[EXPERIMENTAL] The VMware FileSystem Sync Driver (vmsync) is a new feature that
creates backups of virtual machines. Please refer to the VMware Knowledge Base
for more details on this capability. Do you wish to enable this feature?
[yes]

Vmware文件系统同步驱动,实验性的东西,可以尝试,yes~
接下来vmci,vsock。

None of the pre-built vsock modules for VMware Tools is suitable for your
running kernel.  Do you want this program to try to build the vsock module for
your system (you need to have a C compiler installed on your system)? [yes]

Extracting the sources of the vsock module.

Building the vsock module.

Using 2.6.x kernel build system.
make: Entering directory `/tmp/vmware-config0/vsock-only’
make -C /lib/modules/2.6.26-1-amd64/build/include/.. SUBDIRS=$PWD SRCROOT=$PWD/. modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.26-1-amd64′
CC [M]  /tmp/vmware-config0/vsock-only/linux/af_vsock.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/driverLog.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/util.o
CC [M]  /tmp/vmware-config0/vsock-only/linux/vsockAddr.o
LD [M]  /tmp/vmware-config0/vsock-only/vsock.o
Building modules, stage 2.
MODPOST 1 modules
WARNING: “VMCIDatagram_CreateHnd” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIDatagram_DestroyHnd” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIEvent_Subscribe” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCI_DeviceGet” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIMemcpyFromQueueV” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIQueuePair_Detach” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCI_GetContextID” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIDatagram_Send” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIQueuePair_Alloc” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIEvent_Unsubscribe” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
WARNING: “VMCIMemcpyToQueueV” [/tmp/vmware-config0/vsock-only/vsock.ko] undefined!
CC      /tmp/vmware-config0/vsock-only/vsock.mod.o
LD [M]  /tmp/vmware-config0/vsock-only/vsock.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.26-1-amd64′
cp -f vsock.ko ./../vsock.o
make: Leaving directory `/tmp/vmware-config0/vsock-only’
Unable to make a vsock module that can be loaded in the running kernel:
insmod: error inserting ‘/tmp/vmware-config0/vsock.o’: -1 Unknown symbol in module

There is probably a slight difference in the kernel configuration between the
set of C header files you specified and your running kernel.  You may want to
rebuild a kernel based on that directory, or specify another directory.

The VM communication interface socket family is used in conjunction with the VM
communication interface to provide a new communication path among guests and
host.  The rest of this software provided by VMware Tools is designed to work
independently of this feature.  If you wish to have the VSOCK feature  you can
install the driver by running vmware-config-tools.pl again after making sure
that gcc, binutils, make and the kernel sources for your running kernel are
installed on your machine. These packages are available on your distribution’s
installation CD.
[ Press the Enter key to continue.]

接下来选择分辨率”[19]   1440×900″(19寸宽屏最佳resolution)
然后自动重启动X,使用这个config:”/tmp/vmware-config1/XF86ConfigLog.5435″

打开Iceweasel ,字体默认sans-serif 改为WenQuanYi Bitmap,效果(1400×900):

snap_screenpng

然后重启动一下机子,点VM->Setting ->Option ->Shared Folders(Always Enable) ->Add一个 ,
Name:share
Host path:D:/vmdebian5/share
然后在debian里面sudo mount -t vmhgfs .host:/  /mnt/hgfs/
D:/vmdebian5/share和/mnt/hgfs/就是同一个目录~可以用来在Host OS和Guest OS中传文件,同步文件~

为了对Debian GNU/Linux 5.0 有更加深入的了解,翻译了一下这个:
http://debian.org/News/2009/20090214

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值