Install the nfs-utils and portmap packages.

Edit  /etc/exports :

#  vi  /etc/exports

[path of shared directory/folder]    * (global access)

[path of shared directory/folder]    [ip address or ip series] (specific access)

[path of shared directory/folder]    *   {ro,sync} (global read-only access)

[path of shared directory/folder]    *   {rw,sync} (global read-write access)

[path of shared directory/folder]    [ip address or ip series]{ro,sync} (specific read-only access)

[path of shared directory/folder]    [ip address or ip series]{rw,sync} (specific read-write access)

Eg.
/var/dump    *

/var/dump    192.168.7.12

/var/dump    192.168.7.0

/var/dump    192.168.7.12{ro,sync}

#  service nfs restart
#  service portmap restart

To see the shared directory/folder on server side :

#  showmount  -e

To see the shared directory/folder on client side :

#  showmount  -e  [nfs server ip]

————Client side access————-

Make a directory to mount nfs share :

#  mkdir  /nfs

Mounting nfs share :

#  mount  -t  nfs  [nfs server ip]:[path of directory/folder]  /nfs

To view the share :

#  cd  /nfs

Eg.

#  mount  -t  nfs   192.168.7.1:/var/dump   /nfs

For permanent mount in fstab :

#  vi  /etc/fstab

Add this in the end :

[location on server]   [mount point]   [type]   defaults   0   0

Eg.

192.168.7.1:/var/dump        /nfs       nfs       defaults      0     0

Advertisements