How to install and configure NFS Server

01192016-15usd-sitewide728x90

In this tutorial we will learn how to  install and configure NFS server. Network File System (NFS) is basically developed for sharing folders and files between linux/unix systems. NFS is a server-client protocol used for sharing files between *nix systems. NFS enables you to mount a remote share locally.




Server Side Configuration

We can install nfs by using command yum install nfs* (* is used for all) as shown in below image;

install1
Daemon of NFS server is nfs

After installation we can start nfs service  by using below command;
Systemctl start nfs           (we can also use status/restart/reload/stop option)

startnfs

 

Lets start configuring the NFS share. we will use create folder ‘share.folder’  under / (root) directory. we will then

use this folder as shared

mkfolder

For tutorial purpose I have put one folder share and text file

sharefilesserv

To enable above folder to be shared we will edit file /etc/exports file

export




Define the path with folder name and here I am using *  for any network .You can specify network or specific IP for particular sharing. (Note: you can write 192.168.0.0/24 for whole network)

editconfigfile

Above example configuration allows the client server to both read and write access within the share.folder. You can use ro (read only) access. no_root_squash (turn off root. This option is mainly useful for diskless clients).

To check  shared directory use exportfs command on server.

exportfs

Setting up the NFS client  at Client machine

Install nfs-utils at client side by using yum install nfs-utils command press y to begin installation;

nfsinstlclent

Start service of nfs here I am using CentOS 6.5 in this version you can start service through service nfs start (Note: you can also use stop/restart/status/reload).

nfsstartclnt

For checking the shared directory/folder we can use showmount –e (server IP/hostname)

showmount

We can mount that folder by using mount –t nfs 192.168.40.123:/share.folder /mnt/ (here I am going to mount folder in mnt directory) and hit enter; (Note: this is  temporary mount after reboot we are not able to use mount/sharing folder)

mntpoint

now list content of .mnt directory using ll command

shrefile

01192016-15usd-sitewide728x90
To  permanently mount point we need to edit file vi  /etc/fstab.Please  see screenshot below.

we have added line at bottom of file to mount share.folder permanently
192.168.40.123:/share.folder /mnt/  nfs  default  0 0

permntmnt

01192016-15usd-sitewide728x90

Removing the nfs mount we can use umount  /mnt/

umnt1

If anyone faces any issue regarding NFS server feel free to contact us. 🙂

 

Thanks

SUBSCRIBE OUR NEWSLETTER
I agree to have my personal information transfered to MailChimp ( more information )
Join us by subscribing to our newsletter and learn IT subjects for free
We hate spam. Your email address will not be sold or shared with anyone else.