Linux Server Install & Configuration NFS
Shared Server Install NFS
Login 192.168.1.122 Server. Please confirm whether nfs-utils
and rpcbind
is installed. If not, install them.
For details, see the following command:
- use
yum
installnfs
package
yum install nfs-utils
- Start the
rpcbind
andnfs
services. Note the startup sequence. Therpcbind
service must be started first. Example Set the rpcbind and nfs services to start when the system starts.
systemctl start rpcbind
systemctl start nfs
systemctl enable rpcbind nfs
- Edit
/etc/exports
file, add share info:
/home/hhongwen/.local/share 192.168.1.123(rw,sync,no_root_squash)
- Check mount information. Execute
showmount -e
, then print out/home/hhongwen/.local/share 192.168.1.123
.
If the mount information is displayed, the configuration is normal. Then configure the 192.168.1.123 server.
Share Server Configure NFS
Login 192.168.1.123 Server. Please confirm whether nfs-utils
and rpcbind
is installed. If not, install them.
For details, see the following command:
- use
yum
installnfs
package
yum install nfs-utils
- Start the
rpcbind
service. Note: Clients do not need to enable the NFS service because the directory is not shared.
systemctl start rpcbind
systemctl enable rpcbind
- Mount: Create a mount directory on the client, connect to the NFS server.
mkdir -p /home/hhongwen/nfs_share/
chmod 777 /home/hhongwen/nfs_share/
- View the shared directory on the server.
showmount -e 192.168.1.122
- Edit
/etc/fstab
file, append share info:
192.168.1.122:/home/hhongwen/.local/share /home/hhongwen/nfs_share nfs defaults 0 0
- Complete the auto mount, and check whether the shared file is displayed.
mount -a
ll /home/hhongwen/nfs_share