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
Create an entry in /etc/exports with the exported directory and client IP.
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.
Edit /etc/hosts.deny and /etc/host.allow In /etc/hosts.deny
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).
Run rpcinfo and make sure at least nfs, portmap and mountd are listed.
rpcinfo -p localhost
The client steps
Make a directory that you you are going to use to mount the NFS share. Call it whatever you want.
Start portmap, nfs, nfslock, netfs on the client as you did on the server.
Mount the share.
mount 192.168.1.1:/nfs/export /mnt/nfsdir
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
- Test that you can create/delete/edit files and needed by your application.
Originally Posted Dec 2009