Saturday, December 03, 2011

NFS Server Configuration

NFS stands for Network File System. NFS protocol used for sharing files between computer network. NFS allowes to mount files on remote computer as well as on local computer. For NFS server the server machine and client machine both are must be Linux OS, NFS does not support Windows machine because Windows is not NFS compatible. The NFS server shares one or more directories to client system.

  • Package = nfs
  • Service = nfs
  • Port No. = 2049
  • Configuration File = /etc/exports
Per quest:-
  • Configure Server IP =
  • Configure Client IP =
  • Confiugre Server Hostname =
  • Configure Client Hostname =
  • Firewall must be disabled.
1] Install required package
[root@server ~]# yum install nfs* -y

2] Create one new directory to share it using NFS server
[root@server ~]# mkdir /data
[root@server~]# cd /data
[root@server data]# touch anup1 anup2 anup3 anup4 anup5
[root@server data]# cd

3] Grant full permissions to data directory.
[root@server ~]# chmod 777 /data

4] Open main configuration file i.e. /etc/exports and share /data directory to network
[root@server~]# vim /etc/exports
/data,sync) #Here rw means r for read & w for write
#You can allow data directory to specific IP als.
#You can insert entry for data directory by following way
/data *(rw,sync)
/data *(ro,sync)
/data,sync) #Share directory using Hostname
5] Now start NFS service
[root@server ~]# service nfs start
[root@server ~]# chkconfig nfs on

6] Update exports file entries
[root@server ~]# exportfs -r

NFS Client Side:-
1] Check communication with NFS Server
[root@client ~]# ping

2] Check NFS server exports list
[root@client ~]# showmount -e

3] Create mount point to mount shared directory
[root@client ~]# mkdir /testnfs

4] Now mount shared directory.
[root@client ~]# mount -t nfs /testnfs
[root@client ~]# cd /testnfs
[root@client testnfs]# ls
[root@client testnfs]# cat > testfile
This is test file from client.
[root@client testnfs]# cd

[ Note = In this way you can use shared directory. But this directory will be available till system is up, it will not availabe after system reboot. To keep it available after reboot use following way: ]
[root@client ~]# vim /etc/fstab (Go to end of the file and make following entry)      /testnfs      nfs      defaults     0 0
[root@client ~]# mount -a

[ Reboot computer using reboot command and check /testnfs directory]

No comments: