Posts Tagged ‘NFS’

25th December
2009
written by Chris

Follow these simple steps to setup an NFS client/server.

First, some housekeeping for this example.
Server machine (server) = 192.168.1.1
Client machine (client) = 192.168.1.2
Exported directory /nfs/export

### The server steps ###
1. Create an entry in /etc/exports with the exported directory and client IP.

/nfs/export 192.168.1.2(rw)

The (rw) sets the directory to be read and writeable. There are other options that can be specified here. Check out the NFS docs for more.

2. Edit /etc/hosts.deny and /etc/host.allow
In /etc/hosts.deny

portmap: ALL

In /etc/hosts.allow

portmap: 192.168.1.2

3. Start up portmap, nfs, nfslock, netfs on the server. These can most likely be found in /etc/init.d in the form of init scripts. Make sure they are set to start at boot with chkconfig (Redhat servers).

4. Run rpcinfo and make sure at least nfs, portmap and mountd are listed.

rpcinfo -p localhost



### The client steps ###

5. Make a directory that you you are going to use to mount the NFS share. Call it whatever you want.

mkdir /mount/nfsdir

6. Start portmap, nfs, nfslock, netfs on the client as you did on the server.

7. Mount the share.

mount 192.168.1.1:/nfs/export /mnt/nfsdir

8. Add an entry to /etc/fstab in order to have the share mount after a reboot.

192.168.1.1:/nfs/export  /mnt/nfsdir   nfs  rw  0 0

9. Test that you can create/delete/edit files and needed by your application.

Tags: