Thursday, February 3, 2011

How should I install NFS on a linux system?

Hi,

I have two systems and I need to setup a folder on one of them that is completely read/write-able by the other.

Questions:
1) How do I setup NFS on the server(s)? It is not installed as an available filesystem/module.
2) Where should I place this folder / what is the conventional place for locating such shared folders?

This is a RHEL5 system.


Error with setting up NFS.

This is what I did on server1 on which I want to share a local folder with server0

  1. In /etc/exports , I added
    /home/els1-share 199.199.82.98(rw,sync)

  2. mkdir /home/els1-share

  3. Enabled nfs and portmap through
    ntsysv

  4. Started services:

/etc/init.d/portmap start
Starting portmap: [ OK ]

/etc/init.d/nfs start
Starting NFS services: [ OK ]
Starting NFS quotas: [ OK ]
Starting NFS daemon: [ OK ]
Starting NFS mountd: [ OK ]

Now, on server0, I did
1. mkdir /home/els1-share
2. mount 199.199.82.130:/home/els1-share /home/els1-share

which timed out with:
mount: mount to NFS server '199.199.82.130' failed: System Error: Connection timed out.

The IP addresses have been obfuscated, otherwise the output is exact.

  • yum -y install nfs-utils portmap
    

    Prepare and modify /etc/exports for sharing files, that would similar to as shown below

    /home/NFS-files 192.168.100.0/24(ro,sync)

    /home/NFS-share */26(rw,sync)

    /ISO 192.168.100.0/24(ro,sync)

    service portmap start
    
    service nfs start
    
    TWord : Hi - this is on the server on which the folder exists locally? What do I have to do on the server which is accessing this share?
    Rajat : if you have 192.168.100.20 nfs server and you have share /data folder which you want to mount to 192.168.100.21 so run the following command $mount 192.168.100.20:/data /nfs-data and then df -h http://studyhat.blogspot.com/2010/05/fedora-nfs-server-configuration.html
    TWord : Hi. It didnt quite work... can you have a look at the edit please?
    Janne Pikkarainen : @TWord: Do you have a firewall enabled? Check out the output of "iptables -vL" -- also if you have SELinux enabled (check that with "getenforce"), it can deny all sorts of things.
    TWord : Hi Janne - it gives a lot of output / what exactly should i be looking for? This is on RHEL5.
    From Rajat
  • the common placement of NFS exports is outside any os controlled areas ( /usr /etc /var ) usually in another area called /exports

    If you are automounting home directories under /home this will change your placement.

    Usage of the showmount -e to verify is very helpful.

    Enjoy. fe007

  • Make sure you have also started nfs and portmap on the client. To test NFS works, turn of the firewall on both servers temporarily if possible with the command:

    service iptables stop
    
    TWord : woah... would doing "service iptables start" get things back to normal??
    From z0mbix

0 comments:

Post a Comment