Centos7 in vmware implements shared folders with windows

foreword

When developing the SAAS version of the cash register system, the centos server is used, and file updates and uploads are often required. If you use the ftp tool every time, it will take a lot of time to upload large files, so setting up file sharing is the best way

1. Environment

Host: Windows 10, 64-bit
Virtual subsystem: CentOS 7, 64-bit
VMware: VMware workstation 16 PRO

2. Install vmtools (if centos8 does not need it)

1. Enter centos

2. Click ->install vmware tools on the vm menu

3. Centos will have a vm installation package, xx.tar.gz

4. Copy to /opt

5. Use the decompression command tar to get an installation file

cd /opt             //进入到opt目录
tar -zxvf xx.tar.gz //解压缩命令
tab                 //输入文件的前两个字母点击tab可以快速填充文件名  

6. Enter the directory where the vm is decompressed, under the /opt directory

cd vmware...

7. Install the pl file

./vmware-install.pl

8. All the default settings can be used, and the installation can be successful

9. Note: gcc is required to install vmtools

gcc -v

10. Restart centos

3. Set up shared folders

Log in to the virtual machine system - click on the virtual machine - Settings - Options - Shared Folders - Add Shared Folders - Confirm
insert image description here
insert image description here
insert image description here

insert image description here

Fourth, view the shared folder

Open the terminal: enter su, execute the command, and log in with the password to become the root user
. You need to log in first before you can perform subsequent operations. Password: Enter the password and click Enter.
become root user

Check the sharing status
Check the sharing status in the virtual subsystem: the command is as follows:

#查看文件夹创建情况
vmware-hgfsclient

Open the terminal: enter vmware-hgfsclient to query the folder we just shared.
insert image description here

5. Mount directory

Create a mount directory
Create a directory under /mnt for mounting shared folders.
The command is as follows:

# 创建hgfs目录
mkdir /mnt/hgfs
#查看目录的创建情况
ls -l /mnt

Mount the shared directory

#/mnt/hgfs 是挂载位置。挂载完成之后可以在共享文件夹中添加文件,看看在CentOS中是否显示。
vmhgfs-fuse .host:/Share /mnt/hgfs

insert image description here
insert image description here
After clicking the hgfs folder, a pop-up window will appear: no permission. At this time, all you need to do is to perform the last step: specify the mount
insert image description here

Six, custom mount

#先取消挂载:
sudo umount /mnt/hgfs
#再指定用户和组挂载:
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other -o uid=1000 -o gid=1000 -o umask=022

insert image description here
insert image description here

Seven, the test is successful

In the shared folder under Windows, create a .txt file, edit it like "HELLO!!!", and save it.
insert image description here
Open the test text file in the shared folder under CentOS, add "Great~~", and save it. Return to the test file under Windows, and you can see that the content has been successfully modified, which proves that file sharing has been realized.
insert image description here

Guess you like

Origin blog.csdn.net/lovoo/article/details/129687776