First, install configure NFS server
1> to enable Server for NFS to service, you must start inet, Portmap,nfs, and Mount
These 4 daemons and keep running in the background.
2> Plan a partition or directory to share
3> defines the parameters of a client
4> Configure NFS Master profile:/etc/exports
5> Restart NFS Services
1. Configure the syntax for/etc/exports files
#vi/etc/exports
/sharedir-maproot=daemon Host2
/sharedir2-ro-network 192.168.1.0
or in the following format
/sharedir Host3 (OPTION)
/sharedir 192.168.1.12/24 (OPTION)
First paragraph: for shared directories, be sure to have absolute paths.
Second paragraph: Some parameters, such as:-maproot=daemon means that if the visitor is the root user, convert to daemon user;-ro: read-only permission.
The third paragraph: to allow access to the client, can be a host, such as HOST2, can also be a network segment, the host can be represented by the domain name, can also be represented by IP, domain name support wildcard characters, but not include points. such as *.example.net, can represent e1.example.net or e2.example.net and so on, but cannot represent s1.e1.example.net.
The third format means that you can write the read-write, read-only parameters in parentheses and separate them with commas.
2. Activating Services Portmap and NFSD
When Portmap is activated, a SUNRPC service with a port number of 111 appears
#service Portmap Restart
#service NFS Restart
3. Client Configuration
3.1 Open Portmap Service
3.2 Mounting a shared directory using the Mount command
Mount–t type-o Option Device dir
#mount-T Nfs-o hard 192.168.1.22:/sharedir/tmp/
3.3 Users can use/etc/fstab mount or AutoFS mount, in addition to mount command mounts.
Second, NFS server configuration instance
NFS server-side configuration:
1. First check to see if the server side installs the following packages
#rpm-qa |grep NFS
Nfs-utils-1.0.9-16.e15
nfs-utils-lib-1.0.8-7.2
2. Configure NFS server-side configuration files:/etc/exports
/sharedir: For shared directories, permissions are subject to share permissions (rw) and local permission restrictions.
192.168.1.22/24: Allow all machine access to 192.168.1.0 network segment
#vim/etc/exports
#cat/etc/exports
/sharedir 192.168.1.22/24 (rw)
3. Restart NFS Services
#service NFS Restart
NFS Client Configuration:
1. Confirm the installation of Portmap package
#rpm-qa |grep Portmap
portmap-4.0-65.2.2.1
2. Open Portmap Service
#service Portmap Restart
3. View an NFS server share directory
192.168.1.22: IP address for Server for NFS
#showmount-E 192.168.1.22
Export list for 192.168.1.22:
/sharedir 192.168.1.22/24
4. Mount the shared directory of the server
-T NFS: Represents the file system format of the mounted file, or it can omit
#mount-T NFS 192.168.1.22:/sharedir/mnt/