NFS (Network File Server) is used for sharing files between linux to linux, unix to linux and vice versa.
By Default Port: 2049
Configuration File: /etc/exports
Step 1: Install nfs package
First install nfs-utils package using following command:
# yum -y install nfs-utils
Step 2: Configuration
Edit file idmapd.conf and add the line:
# vi /etc/idmapd.conf Domain = tecdistro-server
Insert the folder/directory along with network that you want to share it with other unix/linux machines:
# mkdir /data # chmod a+rwx /data # vi /etc/exports /data *(ro) /var 192.168.0.0/24(ro) /home 18.104.22.168/24(rw,no_root_squash)
Step 3: Start Services
Start the services rpcbind, nfslock and nfs.
# service rpcbind start Starting rpcbind: [ OK ] # service nfslock start Starting NFS statd: [ OK ] # service nfs start Starting NFS services: [ OK ] Starting NFS mountd: [ OK ] Starting NFS daemon: [ OK ] Starting RPC idmapd: [ OK ]
The following command is equivalent to nfs restart
# exports -ar
Run the services at startup/booting time.
# chkconfig rpcbind on # chkconfig nfslock on # chkconfig nfs on
Step 4: On Client Side
Now at the NFS client end, we need to mount that directory in our server to access it locally. To do so, first we need to find out that shares available on the remote server or NFS Server.
# showmount -e 192.168.0.10 Export list for 192.168.0.10: /data 192.168.0.10
Above command shows that a directory named “data” is available at “192.168.0.10” to share with your server.
To mount the directory from NFS server to client server use the following command:
# mount 192.168.0.10:/var /local