Network file system sharing is a simple File sharing service in Linux system, it is characterized by simple configuration, easy to use, the disadvantage is that there is no security authentication mechanism, the security is relatively low.
A small range of scenarios that generally apply to each other in a server's cluster.
Step One: Installation Services
1. Prepare the network environment: 2 Linux hosts, one for the server side and the other for the client. Match the Yum repository on the server side.
2. The NFS service relies primarily on rpcbind, NFS2 services, which are installed by default for 2 services.
3. See if the service is enabled
[[Email protected] Desktop]# service rpcbind status
Rpcbind (PID 1740) is running ...
[[Email protected] Desktop]# service NFS Status
RPC.SVCGSSD has stopped
RPC.MOUNTD (PID 1939) is running ...
NFSD (PID 1954 1953 1952 1951 1950 1949 1948 1947) running ...
Rpc.rquotad (PID 1935) is running ...
Step Two: Configuration file (Vim/etc/exports)
1. Create a shared directory
[Email protected] Desktop]# mkdir-m 777/public
2. Configuration files
Vim/etc/exports
Configuration file format
/public 192.168.4.205 (Rw,no_root_squash)
Shared directory absolute path shared object share permissions
Parameters for shared objects: host name (localhost), IP address (192.168.1.2), network Segment (192.168.1.0/24),
Domain (*.domain.com), all hosts (*)
Parameters for Shared permissions: ro: Read only;
RW: Readable and writable
All_squash: Downgrade to Nfsnobady for all visitors (only for normal users)
No_root_squash: The root user of remote access retains administrator privileges (only for administrators)
3. Re-release
[[Email protected] Desktop]# EXPORTFS-RV
Exporting192.168.4.205:/public
4. View Shared Folders
[Email protected] Desktop]# showmount-e 192.168.4.5
Export list for 192.168.4.5:
/public 192.168.4.205
Step three: Verify the service
1. See if the service port is enabled
[Email protected] Desktop]# Netstat-apnut | grep 1740
TCP 0 0 0.0.0.0:111 0.0.0.0:* LISTEN 1740/rpcbind
TCP 0 0::: 111:::* LISTEN 1740/rpcbind
UDP 0 0.0.0.0:111 0.0.0.0:* 1740/rpcbind
UDP 0 0 0.0.0.0:643 0.0.0.0:* 1740/rpcbind
UDP 0 0::: 111:::* 1740/rpcbind
UDP 0 0::: 643:::* 1740/rpcbind
UDP 0 0 0.0.0.0:2049 0.0.0.0:* NFS
2. Client Mount
[Email protected]~] #showmount –e192.168.4.5
Export List for192.168.4.5:
/public 192.168.4.205
[Email protected]~] #mkdir/mnt/nfs
[Email protected]~] #mount192.168.4.5:/public/mnt/nfs/
[Email protected]~] #df –h
192.168.4.5:/public 50G 3.4G 8%/mnt/nfs
3. Client Operation directory Test
[Email protected]~] #cd/mnt/nfs
[[Email Protected] NFS] #pwd
/mnt/nfs
[[Email Protected] NFS] #mkdirnfs01
[[Email Protected] NFS] #touchnfs01. txts
[Email protected] nfs]# ls-l
Total Dosage 4
Drwxr-xr-x. 2 root root4096 March 11:34 nfs01
-rw-r--r--. 1 Rootroot 0 March 11:34 nfs01.txt
This article is from the "Snail Climb up" blog, please be sure to keep this source http://20120415.blog.51cto.com/3241719/1621774
Linux host NFS File share service configuration