# Install NFS client
Install NFS-related clients:
#!/bin/sh # In the Debain series apt-get install -y nfs-common # Redhat/CentOS yum install -y nfs-utils.x86_64
# View NFS export directory
View the directory exported by the NFS service on the server:
#!/bin/sh showmount -e 192.168.3.4 # # After executing the above command, the directory list exported by the NFS server service will be displayed. For example: # Export list for localhost: # /srv/nfs *
# Mount the remote NFS directory to the local
Then you can execute the mount command to mount the /srv/nfs directory of the machine 192.168.3.4 to the local /media/nfs . The command is as follows:
#!/bin/sh mount -t nfs 192.168.3.4:/srv/nfs /media/nfs
The above command hangs the remote directory in the /media/nfs/ directory of the local machine .
Note that /media/nfs must already exist.
# Automatically mount at boot (persistent)
Use /etc/fstab to mount
If you want to use /etc/fstab to mount. You can write the following lines into the /etc/fstab configuration file:
#!/bin/sh example.hostname.com:/srv/nfs /media/nfs nfs rsize=8192,wsize=8192,timeo=14,intr
references
SettingUpNFSHowTo
Network File System (NFS)
Solving NFS Mounts at Boot Time
Mounting NFS File Systems using /etc/fstab