步骤:
1.安装VMware tools
2.设置共享文件夹
3.在Ubuntu中设置。
在网上搜集前辈的总结,自己边实践。
期间遇到菜鸟问题:文件名带空格怎么办:在空格前加“\”,即"\ "代表一个空格,”\ \ “代表两个空格。
在最后安装VMware tools时,安装命令提示符【】中的”yes“或者”no“操作即可,一直到最后的Enjoy,initial done。
之前使用Linux环境使用的是Fodera + VMware,个人感觉还是比较好用,比Red Hat 或之后的N多版本都好用。由于各种原因,现在需要使用Ubuntu + VMware环境,这就牵涉到Windows 和 Ubuntu 共享的问题。试了N多种方法行的通,参考《win7与VMware ubuntu虚拟机实现文件共享(最后一定要装open-vm-dkms插件)》才行的通。下面总结如下:
1.按照VMtools.
启动Ubuntu系统,在VMware虚拟机界面下,点击VM->Install VMware Tools,点击Ubuntu窗口中主文件按钮然后再左边会看见设备里有VMware tools文件夹,双击之,并且解压其中的压缩文件,把它拷贝到主文件夹。打开Terminal终端,进入解压的文件夹中,输入以下命令:
a) sudo tar zxf VMwareTools-xxx.tar.gz (注:xxx为版本号)
b) cd /vmware-tools-distrib
c) sudo ./vmware-install.pl
安装过程中一直按enter即可,或者输入【】提示yes和no,直到安装完毕。
实在搞不定,可百度或Google之。
2.设置共享文件夹目录
1. 将Ubuntu关机(power off),否则不能添加共享文件夹
2. 在VMware虚拟机窗口,选择VM->Settings->Options->Shared Folders
3. 点右边的Add,点Next->选择Win7共享目录的路径,然后点Next->选中Enable this share->Finish
4. 在VM->Settings->Options->Shared Folders窗口的右边,Folder sharing栏里选择Always enabled
5. 点 OK 确定退出
但在这里还没有完成,一点要进行第三步才可以完成文件共享。
3.在Ubuntu虚拟机下安装插件
1. 执行 sudo apt-get install open-vm-dkms (注:如果安装过,以后就不用执行这一行)
2. 执行 sudo mount -t vmhgfs .host:/ /mnt/hgfs
3. cd /mnt/hgfs
VMware Tools的安装,VM官网:
对于 Linux 虚拟机,您可以使用命令行工具手动安装或升级 VMware Tools。
下面是我自己探索安装的过程:
wade@ubuntu:~$ sudo -i
[sudo] password for wade:
root@ubuntu:~# cd /home
root@ubuntu:/home# cd.
No command 'cd.' found, did you mean:
Command 'cdp' from package 'irpas' (multiverse)
Command 'cdi' from package 'cdo' (universe)
Command 'cdo' from package 'cdo' (universe)
Command 'cdb' from package 'tinycdb' (main)
Command 'cd5' from package 'cd5' (universe)
Command 'cdw' from package 'cdw' (universe)
Command 'cde' from package 'cde' (universe)
Command 'cdv' from package 'codeville' (universe)
cd.: command not found
root@ubuntu:/home# cd ..
root@ubuntu:/# cd /home/templates
-bash: cd: /home/templates: No such file or directory
root@ubuntu:/# cd /Home/Templates
-bash: cd: /Home/Templates: No such file or directory
root@ubuntu:/# cd /Home
-bash: cd: /Home: No such file or directory
root@ubuntu:/# cd /home
root@ubuntu:/home# ls
wade
root@ubuntu:/home# cd /wade
-bash: cd: /wade: No such file or directory
root@ubuntu:/home# cd /wade
-bash: cd: /wade: No such file or directory
root@ubuntu:/home# cd ..
root@ubuntu:/# ls
bin dev initrd.img lost+found opt run srv usr
boot etc lib media proc sbin sys var
cdrom home lib64 mnt root snap tmp vmlinuz
root@ubuntu:/# cd /tmp
root@ubuntu:/tmp# ls
config-err-rYu2ek
systemd-private-0799a101a7a042798c751f5215208d02-colord.service-fuDjIL
systemd-private-0799a101a7a042798c751f5215208d02-rtkit-daemon.service-JQ3JjX
systemd-private-0799a101a7a042798c751f5215208d02-systemd-timesyncd.service-mZNX1l
unity_support_test.0
VMwareDnD
vmware-root
root@ubuntu:/tmp# mount
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
udev on /dev type devtmpfs (rw,nosuid,relatime,size=996040k,nr_inodes=249010,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,noexec,relatime,size=203072k,mode=755)
/dev/sda1 on / type ext4 (rw,relatime,errors=remount-ro,data=ordered)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev)
tmpfs on /run/lock type tmpfs (rw,nosuid,nodev,noexec,relatime,size=5120k)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,xattr,release_agent=/lib/systemd/systemd-
cgroups-agent,name=systemd,nsroot=/)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,blkio,nsroot=/)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,cpu,cpuacct,nsroot=/)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,net_cls,net_prio,nsroot=/)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,memory,nsroot=/)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,cpuset,nsroot=/)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,freezer,nsroot=/)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,perf_event,nsroot=/)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,pids,nsroot=/)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,hugetlb,nsroot=/)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,devices,nsroot=/)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=30,pgrp=1,timeout=0,minproto=5,maxproto=5,direct)
mqueue on /dev/mqueue type mqueue (rw,relatime)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime)
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
fusectl on /sys/fs/fuse/connections type fusectl (rw,relatime)
vmware-vmblock on /run/vmblock-fuse type fuse.vmware-vmblock
(rw,relatime,user_id=0,group_id=0,default_permissions,allow_other)
tmpfs on /run/user/1000 type tmpfs (rw,nosuid,nodev,relatime,size=203072k,mode=700,uid=1000,gid=1000)
gvfsd-fuse on /run/user/1000/gvfs type fuse.gvfsd-fuse (rw,nosuid,nodev,relatime,user_id=1000,group_id=1000)
/dev/sr0 on /media/wade/VMware Tools type iso9660
(ro,nosuid,nodev,relatime,uid=1000,gid=1000,iocharset=utf8,mode=0400,dmode=0500,uhelper=udisks2)
root@ubuntu:/tmp# tar zxpf /media/wade/VMware Tools.tar.gz
tar (child): /media/wade/VMware: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
root@ubuntu:/tmp# tar /media/wade/VMware Tools.tar.gz
tar: invalid option -- '/'
Try 'tar --help' or 'tar --usage' for more information.
root@ubuntu:/tmp# tar /media/wade/VMware\ Tools.tar.gz
tar: Old option 'V' requires an argument.
Try 'tar --help' or 'tar --usage' for more information.
root@ubuntu:/tmp#
root@ubuntu:/tmp# tar zxpf /media/wade/VMware\ Tools.tar.gz
tar (child): /media/wade/VMware Tools.tar.gz: Cannot open: No such file or directory
tar (child): Error is not recoverable: exiting now
tar: Child returned status 2
tar: Error is not recoverable: exiting now
root@ubuntu:/tmp# tar zxpf /media/wade/VMware\ Tools
tar (child): /media/wade/VMware Tools: Cannot read: Is a directory
tar (child): At beginning of tape, quitting now
tar (child): Error is not recoverable: exiting now
gzip: stdin: unexpected end of file
tar: Child returned status 2
tar: Error is not recoverable: exiting now
root@ubuntu:/tmp# cd /media/wade/VMware\ Tools
root@ubuntu:/media/wade/VMware Tools#
root@ubuntu:/media/wade/VMware Tools# cd ~
root@ubuntu:~# cd /wade/tmp
-bash: cd: /wade/tmp: No such file or directory
root@ubuntu:~# ls
root@ubuntu:~# ls
root@ubuntu:~# cd /honme
-bash: cd: /honme: No such file or directory
root@ubuntu:~# cd /home
root@ubuntu:/home# ls
wade
root@ubuntu:/home# cd /wade
-bash: cd: /wade: No such file or directory
root@ubuntu:/home# cd wade
root@ubuntu:/home/wade# ls
Desktop Documents Downloads examples.desktop Music Pictures Public Templates Videos
root@ubuntu:/home/wade# cd ~
root@ubuntu:~# cd ..
root@ubuntu:/# ls
bin cdrom etc initrd.img lib64 media opt root sbin srv tmp var
boot dev home lib lost+found mnt proc run snap sys usr vmlinuz
root@ubuntu:/# cd tmp
root@ubuntu:/tmp# ls
config-err-rYu2ek unity_support_test.0
systemd-private-0799a101a7a042798c751f5215208d02-colord.service-fuDjIL VMwareDnD
systemd-private-0799a101a7a042798c751f5215208d02-rtkit-daemon.service-JQ3JjX vmware-root
systemd-private-0799a101a7a042798c751f5215208d02-systemd-timesyncd.service-mZNX1l
root@ubuntu:/tmp# cd /home
root@ubuntu:/home# cd wade
root@ubuntu:/home/wade# ls
Desktop Documents Downloads examples.desktop Music Pictures Public Templates Videos
root@ubuntu:/home/wade# cd documents
-bash: cd: documents: No such file or directory
root@ubuntu:/home/wade# cd Documents
root@ubuntu:/home/wade/Documents# cd qijitao_tmp
-bash: cd: qijitao_tmp: No such file or directory
root@ubuntu:/home/wade/Documents# cd ..
root@ubuntu:/home/wade# ls
Desktop Documents Downloads examples.desktop Music Pictures Public Templates Videos
root@ubuntu:/home/wade# cd /Downloads/qijitao_tmp
-bash: cd: /Downloads/qijitao_tmp: No such file or directory
root@ubuntu:/home/wade# cd Downloads
root@ubuntu:/home/wade/Downloads# ls
qjitao_tmp sogoupinyin_2.1.0.0082_amd64.deb
root@ubuntu:/home/wade/Downloads# ls
qijitao_tmp sogoupinyin_2.1.0.0082_amd64.deb
root@ubuntu:/home/wade/Downloads# cd qijitao_tmp
root@ubuntu:/home/wade/Downloads/qijitao_tmp# tar zxpf /media/wade/VMware\ Tools/VMwareTools-10.0.10-4301679.tar.gz
root@ubuntu:/home/wade/Downloads/qijitao_tmp# cd vmware-tools-distrib
root@ubuntu:/home/wade/Downloads/qijitao_tmp/vmware-tools-distrib# cd vmware-install.pl
-bash: cd: vmware-install.pl: Not a directory
root@ubuntu:/home/wade/Downloads/qijitao_tmp/vmware-tools-distrib# ./vmware-install.pl
The installer has detected an existing installation of open-vm-tools on this
system and will not attempt to remove and replace these user-space
applications. It is recommended to use the open-vm-tools packages provided by
the operating system. If you do not want to use the existing installation of
open-vm-tools and attempt to install VMware Tools, you must uninstall the
open-vm-tools packages and re-run this installer.
The packages that need to be removed are:
open-vm-tools
The installer will next check if there are any missing kernel drivers. Type yes
if you want to do this, otherwise type no [yes] yes
Creating a new VMware Tools installer database using the tar4 format.
Installing VMware Tools.
In which directory do you want to install the binary files?
[/usr/bin] yes
The path "yes" is a relative path. Please enter an absolute path.
In which directory do you want to install the binary files?
[/usr/bin] y
The path "y" is a relative path. Please enter an absolute path.
In which directory do you want to install the binary files?
[/usr/bin]
What is the directory that contains the init directories (rc0.d/ to rc6.d/)?
[/etc]
What is the directory that contains the init scripts?
[/etc/init.d]
In which directory do you want to install the daemon files?
[/usr/sbin]
In which directory do you want to install the library files?
[/usr/lib/vmware-tools]
The path "/usr/lib/vmware-tools" does not exist currently. This program is
going to create it, including needed parent directories. Is this what you want?
[yes]
In which directory do you want to install the documentation files?
[/usr/share/doc/vmware-tools]
The path "/usr/share/doc/vmware-tools" does not exist currently. This program
is going to create it, including needed parent directories. Is this what you
want? [yes] yes
The installation of VMware Tools 10.0.10 build-4301679 for Linux completed
successfully. You can decide to remove this software from your system at any
time by invoking the following command: "/usr/bin/vmware-uninstall-tools.pl".
Before running VMware Tools for the first time, you need to configure it by
invoking the following command: "/usr/bin/vmware-config-tools.pl". Do you want
this program to invoke the command for you now? [yes] yes
The file /usr/bin/vmware-hgfsclient that this program was about to install
already exists. Overwrite? [no] no
The file /usr/bin/vmhgfs-fuse that this program was about to install already
exists. Overwrite? [no] no
The file /sbin/mount.vmhgfs that this program was about to install already
exists. Overwrite? [no] no
Initializing...
Making sure services for VMware Tools are stopped.
Stopping Thinprint services in the virtual machine:
Stopping Virtual Printing daemon: done
Stopping VMware Tools services in the virtual machine:
VMware User Agent (vmware-user): done
Unmounting HGFS shares: done
Guest filesystem driver: done
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults
The module vmci has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vsock has already been installed on this system by another installer
or package and will not be modified by this installer.
The module vmxnet3 has already been installed on this system by another
installer or package and will not be modified by this installer.
The module pvscsi has already been installed on this system by another
installer or package and will not be modified by this installer.
The module vmmemctl has already been installed on this system by another
installer or package and will not be modified by this installer.
The VMware Host-Guest Filesystem allows for shared folders between the host OS
and the guest OS in a Fusion or Workstation virtual environment. Do you wish
to enable this feature? [yes] yes
The vmxnet driver is no longer supported on kernels 3.3 and greater. Please
upgrade to a newer virtual NIC. (e.g., vmxnet3 or e1000e)
VMware automatic kernel modules enables automatic building and installation of
VMware kernel modules at boot that are not already present. This feature can
be enabled/disabled by re-running vmware-config-tools.pl.
Would you like to enable VMware automatic kernel modules?
[no] no
Thinprint provides driver-free printing. Do you wish to enable this feature?
[yes] yes
Creating a new initrd boot image for the kernel.
update-initramfs: Generating /boot/initrd.img-4.4.0-21-generic
Starting Virtual Printing daemon: done
Checking acpi hot plug done
Starting VMware Tools services in the virtual machine:
Switching to guest configuration: done
Guest filesystem driver: done
Mounting HGFS shares: done
VMware User Agent: done
The configuration of VMware Tools 10.0.10 build-4301679 for Linux for this
running kernel completed successfully.
Enjoy,
--the VMware team
Found VMware Tools CDROM mounted at /media/wade/VMware Tools. Ejecting device
/dev/sr0 ...
umount: /media/wade/VMware Tools: target is busy
(In some cases useful info about processes that
use the device is found by lsof(8) or fuser(1).)
/usr/bin/eject: unmount of `/media/wade/VMware Tools' failed
Eject Failed: If possible manually eject the Tools installer from the guest
cdrom mounted at /media/wade/VMware Tools before canceling tools install on the
host.
root@ubuntu:/home/wade/Downloads/qijitao_tmp/vmware-tools-distrib# cd /mnt/hgfs
root@ubuntu:/mnt/hgfs# ls
VM_ubantu_share
root@ubuntu:/mnt/hgfs#