The installation and testing of the NFS service is relatively simple. Next we will introduce in detail the specific installation and testing steps of the NFS service in Linux. For more information, see the configuration files and related formats.
1) server configuration file:/etc/exports
File Format: Directory hostname (options)
Directory is the Directory to be shared;
The domain name/IP Address/IP address segment of the hostname client. It can also be empty. If it is null, it indicates any host;
Options is optional. If this parameter is not specified, default options are used, such as ro, rw, sync, and async;
For example:
The following is a code snippet:
/Home 192.168.1. * (rw, async, no_root_squash)
Rw; readable and writable
Async; synchronization, the server only accepts the response from the client to proceed to the next step, to ensure more reliable connection
No_root_squash; Do not compress the permissions of the root user. to be safer, use
On the server side, you can use the exportfs command to output the directories shared by exports;
2) ensure that portmap and NFS are started.
The following is a code snippet:
#/Etc/rc. d/init. d/portmap start (or: #/service portmap start)
#/Etc/rc. d/init. d/nfs start (or: #/serverice nfs start)
Note: You can use netstat & ndash; untlp to check whether the portmap and nfs services are started. Port 2049 is the NFS server and port 111 corresponds to the portmap service, it can be found that both TCP and UDP have corresponding ports;
3) NFS client configuration (mount or fstab file)
The following is a code snippet:
# Mount & ndash; t nfs hostname (orIP):/directory/mountpoint
-T nfs can be omitted;
/Directory is the absolute path;
Or add the mounting records of the NFS file system to the/etc/fstab file.
The following is a code snippet:
NFSserverIP:/directory/mountpoint nfs ults 0 0
You can use mount to check the mount point.