How to build an NFS server
1. Install NFS server 1.1
RPC main program: rpcbind
NFS main program: nfs-utils
[Root @ ~] #Rpm-qa | grep rpcbind
[Root @ ~] #Rpm-qa | grep nfs
1.2 NFS security configuration
Firewall settings, bind the NFS service port
[Root @ ~] #Vi/etc/sysconfig/nfs
RQUOTAD_PORT = 875
LOCKD_TCPPORT = 32803
LOCKD_UDPPORT = 32769
MOUNTD_PORT = 892
STATD_PORT = 662
Configure the firewall policy to enable the above ports and111, 2049Port (111 is the RPC port number, and the NFS service is started on port 2049.
1.3 Construction
1) configuration file/etc/exports
[Root @ ~] #Vi/etc/exports
/Wserp/repos * (rw, sync)
2) Start rpcbind, nfs, and nfslock
Service xxxstatus/start (/etc/init. d/xxx)
3) set rpcbind, nfs, and nfslock to start at startup.
Chkconfig xxx on
1.4 Test
View connections
[Root @ ~] #Showmount-e xxx
1.5 Other Instructions
1) After resetting the/etc/exports file, you do not need to restart NFS.
# A. Re-mount the setting of/etc/exports once
[Root @ ~] #Exportfs-arv
# B. unmount all shared NFS directory resources
[Root @ ~] #Exportfs-auv
2) Precautions for shutdown
When the RPC service used by NFS is connected to the server on the client, it may take several hours to shut down the server. Before the NFS Server is shut down, we recommend that you turn off the two daemon: rpcbind and nfs. If not, kill them.
2. Set up NFS client 2.1
Start required services rpcbind and nfslock. See section 1.3.
2.2 mount and unmount
1) create a mount point and mount it
[Root @ ~] #Mount-t nfs IP:/dir
View the information after mounting
[Root @ ~] #Df
2) uninstall
[Root @ ~] #Umount dir
3) start mounting
Edit File/Etc/rc. d/rc. localAdd the mount command.