Linux creates a shared directory

1. Server (ip: 192.168.102.229)

1、yum install nfs-utils

   yum install rpcbind

2. Create a shared directory

ex:mkdir -p /data/share

       chmod  777 /data/share

3. Edit the configuration file

vi /etc/exports

/data/share *(rw,sync) #* means that all ip machines are allowed to access the shared directory, rw means that it can be accessed by reading and writing, and sync data is written to memory and hard disk synchronously

4. Make the configuration take effect

exportfs -r

5. Start the service

Service nfs start

Service rpcbind start

6. Set the boot to start nfs and rpcbind services

chkconfig rpcbind on / systemctl enable nfs

chkconfig nfs on / systemctl enable rpcbind

7. Check whether there is a shared folder

showmount -e

2. Client

1. Create a shared directory mkdir /ftp

2. showmount -e 192.168.102.229 #ip is the ip of the server

3、mount -t nfs 192.168.102.229:/data/share /ftp

4. vi /etc/fstab #Set boot auto mount

192.168.102.229:/data/share   /ftp    nfs      defaults     0     0

mount -a # will mount all the partitions in the fstab file, you can use this command after adding a line in the fstab file without restarting

Guess you like

Origin blog.csdn.net/qq_20663229/article/details/86261676