1. Install the NFS software package

Sudo apt-get install nfs-common sudo apt-get install nfs-commonCopy the code

2. Add the NFS shared directory

Sudo vim /etc/exports # If you want '/data/backups' to be an NFS shared directory, add the following line at the end of the file: /data/backups *(rw,sync,no_root_squash) # * Allows systems on any network segment to access the NFS directoryCopy the code

3. Create the /data/ Backups directory and set the loosest permissions for it.

Sudo mkdir /data/backups sudo chmod -r 777 /data/backups sudo chown web:web /data/backups/ -r # -r changes all files in the directory recursivelyCopy the code

4. Start the NFS service

D /nfs-kernel-server start or sudo /etc/init.d/nfs-kernel-server restartCopy the code

5. Test

# in 192.168.1.2 instead performed on mount sudo mount -t NFS 192.168.1.1: / data/backups/data/backups - o nolock You can see the changes in 192.168.1.2Copy the code

6. Uninstall

umount /data/backups
Copy the code

End of the 7.

Reprinted from: blog.csdn.net/qq_37860012…