Monday, December 10, 2012

Network File System (NFS)

Follow the below syntax to create a Network File System. Please Note you must have the Root access to do this anyway.

Let two host A and B both can be access to each other over the network and you want to create a NFS on B from A.

Example Case:

java installed on machine A and JAVA_HOME on Host A is : /home/java/jdk1.6.0_33 . and you want to use the java on machine B with out installing it on B

ON Host B :

1) create a directory java [Note you can crteate this directory anywhere]. I am taking /mnt as parent directory , so you must be root or you have the sudo access to do so

 ~]# mkdir /mnt/java

2)open the file /etc/fstab and append the below line . Please change the parameter as per your requirements

 ~]# vi /etc/fstab

A:/home/java/jdk1.6.0_33 /mnt/java nfs defaults 0 0

A : Host name or IP address
/home/java/jdk1.6.0_33 : Path on Host A
/mnt/java                       : Path on Host B


On Host A:

1) Open the file /etc/exports and append the below line. Please change the path as per your requirements.

~]# vi /etc/exports

/home/java/jdk1.6.0_33 *(rw,sync,no_root_squash)

2)Start the nfs service. The below command will stop and start the service

 ~]# service nfs restart

3) Start portmnp service

~]# service portmap restart



Final step on Host B:

~]# mount /mnt/java


Now you are done. you can set your JAVA_HOME and PATH on Host B using the path /mnt/java.


No comments:

Post a Comment