First, configure Server for NFS1. Download and install NFS if the system is CentOS 5:
Yum-y Install Nfs-utils Portmap
If the system is Cenos 6:
Yum-y Install Nfs-utils Rpcbind
192.168.0.103 NFS Server 192.168.0.107 Client
2. Configure NFS Configuration Files Etc/exports
/root/nfs 192.168.0.107 (Rw,sync,no_root_squash,no_subtree_check)
Mount address can be an IP, a network segment, a domain name, domain name wildcard, EP: *.youxia.com. There are no spaces between the mount address and the permissions.
After the main explanation of the parameter meaning:
Rw:read-write read-Write permission ro:read-only read-only permission sync: File write memory and hard disk async: Files are temporarily stored in memory but not written to memory. No_root_squash: If the client is logged in as root, the Shared Server directory page has root access (unsafe). Root_squash: If the client is logged in as root, the shared server directory is operated with the privileges of the anonymous user, typically nobody or nfsnobody.
3. Start NFS
If the system is CentOS 5:
Service Portmap Start Service NFS Start
If the system is CENTOS6
Service Rpcbind Start Service NFS Start
4. Client Mount NFS Server
Mount-t NFS 192.168.0.103:/root/nfs/root/test
/root/nfs the directory shared for Server for NFS,/root/test the client mount point (Mount point).
Pleae Teset below:
Under the client's root/test operation, observe the server for NFS specified directory situation:
192.168.0.103
[root@localhost nfs]# ls
[root@localhost nfs]#
192.168.0.107
[Root@kevin test]# ls
[Root@kevin test]#
Create a file on the client
[Root@kevin test]# echo "Hello World" >> test.log
[root@kevin test]# ls
test.log
[Root@kevin test]#
Service side:
[root@localhost nfs]# ls
test.log
[root@localhost nfs]# cat Test.log
Hello World
[root@localhost NFS] #
On the client side, another method for querying the mount:
[Root@kevin test]# df-h
filesystem Size Used avail use% mounted on
/dev/sda2 18G 885M 16G 6%/
tmpfs 491M 0 491M 0%/dev/shm
192.168.0.103:/root/nfs
7.7G 3.0G 4.4G 41%/root/test