NFS File Sharing Service
Assuming that the existing two server IP addresses are 192.168.0.2 and 192.168.0.3,192.168.0.2, respectively, as server,192.168.0.3 as the client, then:
Both machines need to be installed Nfs-utils Rpcbind:
Yum Install nfs-utils rpcbindchkconfig NFS Onchkconfig rpcbind on
Turn on firewall ports 111 and 2049:
111 -J Accept111 -J Accept2049 -JAccept2049 -J ACCEPT/etc/init.d/iptables saveservice iptables Restart
Next, create a shared directory on 192.168.0.2:
mkdir -p/home/nfs
To modify an NFS configuration file:
VI /etc/exports
Add the following code:
192.168. 0.0/(rw,sync, Insecure,no_root_squash)
To start the NFS and RPC services:
Service Rpcbind StartService NFS Start
To view a native-published NFS shared directory:
Showmount-e localhost
As a client 192.168.0.3, mount the server directory directly to the local directory after starting the service:
mkdir -p/home/nfs_serverMount192.168. 0.2:/home/nfs/home/nfs_server
To view file system mounts:
Tail -1 /etc/mtab
To set up automatic mounts:
vi /etc/fstab
#加入以下代码 192.168. 0.2:/home/nfs /home/nfs_server NFS defaults,rw,_netdev 0 0
Linux Environment Deployment Record (ii)-NFS File Share