Quick How-To: Install NFS Server & Client

nfs.png

In this tiny how-to I’ll explain you how to setup a machine as a NFS server and an other one as a client. This example was written based on my experiences on Mandriva, but all commands should almost be the same for other distributions.

First, on the server, install nfs-utils:

urpmi nfs-utils

The nfs-utils package provide a daemon for the kernel NFS server and related tools. It is a much higher level of performance than the traditional Linux NFS server used by most users.

Then edit the /etc/exports file to add the list of the local folders you wqnt to share:

[root@localhost ~]# cat /etc/exports
/mnt/hdd *(rw,insecure,all_squash)

Then, to apply change, restart the NFS server:

/etc/init.d/nfs restart

In this example I simply wanted to share the /mnt/big-disk directory and all its sub-folders with anybody, with read and write access. I did this because the server was in a closed LAN, with only one client, that’s why no security, authentification or credentials to manage.

By the way, on the server, the only required services to activate at startup are the following:

  • nfs
  • nfslock
  • portmap

On client side, you also need to install nfs-utils, in order to benefit nfslock:

urpmi nfs-utils

The latter is absolutely not required, but if it’s a good idea to have it on the client side.

Then to auto-mount the distant shared folder, add the following line to your /etc/fstab file:

192.168.1.22:/mnt/hdd /mnt/distant-hdd nfs user,noatime,rsize=8192,wsize=8192,soft 0 0

Important parameters of the line above are:

  • 192.168.1.22 = IP adress of the NFS server,
  • /mnt/hdd = path of the shared folder on the server,
  • /mnt/distant-hdd = local folder where the shared folder will be mounted.

Then, you have to modify services on the client to change their default activation state.

Following services must be started at boot:

  • nfslock
  • netfs
  • rpcidmapd

Services that must should be inactivated at boot:

  • portmap
  • nfs
  • rpcsvcgssd

2 thoughts on “Quick How-To: Install NFS Server & Client

  1. hi…
    this material was really helpful for me.Actually i hav to install nfs server on our VLSI lab.i want to ask ,could a remote computer xecute a .exe file on the server??and how one client can communicate with another client..??

  2. No, you cannot execute an .exe file on it. This is linux. Unless the remote computer could install wine.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Notify me of followup comments via e-mail. You can also subscribe without commenting.