CentOS 6.x for NFS sharing
Network Environment:
One Linux server ip address 192.168.1.254 and one Linux client ip address 192.168.1.100
Operating System: CentOS 6.5
Requirement Description:
1: Share/root with 192.168.93.129, which can be written or synchronized. Allow the client to access the IP address with the root permission.
2: Share/var/www/html with the network segment 192.168.93.0/24, writable and asynchronous
Steps:
1: Check whether the nfs program is installed
[Root @ server ~] # Rpm-qa | grep nfs check nfs whether nfs-utils-1.2.3-39.el6.i686 is installed [root @ server ~] # Rpm-qa | grep rpcbind check whether RPC is installed with rpcbind-0.2.0-11.el6.i686
2: start the service and set it to boot
[root@server ~]# service nfs start[root@server ~]# service rpcbind start[root@server ~]# chkconfig rpcbind on[root@server ~]# chkconfig nfs on
3: Enable the corresponding port
iptables -I INPUT -p tcp --dport 111 -j ACCEPTiptables -I INPUT -p udp --dport 111 -j ACCEPTiptables -I INPUT -p tcp --dport 2049 -j ACCEPTiptables -I INPUT -p udp --dport 2049 -j ACCEPTiptables -I INPUT -p tcp --dport 30001:30004 -j ACCEPTiptables -I INPUT -p udp --dport 30001:30004 -j ACCEPTservice iptables saveservice iptables restart
4: Requirements 1 and 2 for editing the configuration file
[root@server ~]# vim /etc/exports/root 192.168.93.129(rw,sync,no_root_squash)/var/www/html 192.168.93.0/24(rw,async)
5. Restart the service.
[root@server ~]# service nfs restart[root@server ~]# service rpcbind restart
6. Set/var/www/html local write permission on the server.
[root@server ~]# chmod o+w /var/www/html
7. Client Test
[root@client ~]# mkdir -p /data/root[root@client ~]# mount 192.168.93.128:/root /data/root/[root@client ~]# mkdir -p /var/www/html_client[root@client ~]# mount 192.168.93.128:/var/www/html /var/www/html_client[root@client ~]# mount |tail -2