Monday, January 18, 2010

NFS Server Setup

The Network File System is certainly one of the most widely used network services. Network file system (NFS) is based on the Remote procedure call. It allows the client to automount and therefore, transparently access the remote file systems on the network.


Three simple steps to share your files in Linux using nfs share
1. Start nfs service :
santosh-test:~ # /etc/init.d/nfsserver start
Starting kernel based NFS server done
santosh-test:~ #


2. Add required file to export file:
Add abosulte path to exports file. * is to allow this share to be mounted by any nfs client on the network and used options as (ro) readonly permission and get synchronize automatically.
santosh-test:~ # ls /Image/Updates
Package            Opera
MozillaFirefox     Messengers

santosh-test:~ # cat /etc/exports
/Image/Updates *(ro,sync)   

santosh-test:~ #


Verifiy the path using exportfs command

santosh-test:~ # exportfs
/Image/Updates


santosh-test:~ #  


3. Restart nfs service:
Restart nfs service
santosh-test:~ # /etc/init.d/nfsserver restart
Shutting down kernel based NFS server   done

Starting kernel based NFS server        done
santosh-test:~ #  



Testing:
Tested on SLES10/11 and RHEL 5
santosh-test-client:~ # showmount -e santosh-test
Export list for 164.99.98.64:
/Image/Updates *
santosh-test-client:~ # mount santosh-test:/Image/Updates /mnt/
santosh-test-client:~ # ls /mnt/

Package            Opera
MozillaFirefox     Messengers 
santosh-test-client:~ #  


More information: Linux NFS-HOWTO