Setting up NFS server on Linux Mint was a breeze. Since the method we followed may be useful to other developers, I thought of sharing them here.
Image via Wikipedia
What is Linux Mint?
I have been using Linux Mint for about three years now starting from Linux Mint 5 till the latest Linux Mint 9. I am a great fan of this OS.
What is NFS?
Step 1: Install NFS server and other dependent applications
Open a terminal on the Linux Mint desktop and issue the below command.
This will install three packages the are essential for clutter free operation of NFS.
Step 2: Configure the NFS server
NFS exports from a server are controlled by the file
/etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-separated list of allowed clients.
For example: To export the
/var/nfs directory so that it can be accessed by any client, please insert the below line in the file –
/var/nfs * (ro,async,subtree_check)
Note: Allowing any client to access your box can be potentially harmful. Please reconsider your decision before doing so.
To allow access to machines with a particular set of IP addresses, please insert the below line in
/var/nfs 192.168.1.1/24 (ro,async,subtree_check)
Other options that can specified along with the IP address include:
The directory is shared read only; the client machine will not be able to write it. This is the default.
The client machine will have read and write access to the directory.
If no_root_squash is specified, then root on the client machine will have the same level of access to the files on the system as root on the server. This can have serious security implications. You should not specify this option without a good reason.
If only part of a volume is exported, a routine called subtree checking verifies that a file that is requested from the client is in the appropriate part of the volume. If the entire volume is exported, disabling this check will speed up transfers.
By default, all but the most recent version (version 1.11) of the exportfs command will use async behavior, telling a client machine that a file write is complete – that is, has been written to stable storage – when NFS has finished handing the write over to the file system. This behavior may cause data corruption if the server reboots, and the sync option prevents this.
- Linux NFS Overview, FAQ and HOWTO Documents – http://nfs.sourceforge.net/
- RFC: Network File System (NFS) version 4 Protocol – http://tools.ietf.org/html/rfc3530
- nfs-kernel-server – http://linux.about.com/cs/linux101/g/nfskernelserver.htm
- nfs-common – http://linux.about.com/cs/linux101/g/nfscommon.htm
- portmap – http://linux.about.com/cs/linux101/g/portmap.htm
- apt-get – http://linux.about.com/od/ubusrv_doc/a/ubusg11t01.htm
- Advanced Packaging Tool – http://en.wikipedia.org/wiki/Advanced_Packaging_Tool
- Linux NFS How-To – http://tldp.org/HOWTO/NFS-HOWTO/server.html
- Linux / Unix Command: exportfs – http://linux.about.com/library/cmd/blcmdl8_exportfs.htm