2005-09-06, 05:25 PM
In this guide I will show you how to setup a simple NFS server using Fedora, but I will show how to set it up via command line so you should be able to configure it on more than one distribution.
The first step is to make sure you have the NFS server software installed you can check this
by issuing the following command:
Code:
rpm -q nfs-utils
if you don't have this package installed, you can use the YUM packages management tool to install the package, to do this issue the following command:
Code:
yum install nfs-utils
Once you have installed the package you can begin to configure the NFS server, you should have
a file in the /etc directory called: "exports". This file determines what directory's will be exported, who
is allowed to access them and what permissions they have.
In this tutorial I will be exporting my /home directory and allowing only the IP of 192.168.0.13 to
access this exported directory. So the first step is to edit the exports file and added the following:
Code:
/home 192.168.0.13(rw,nohide)
The above exports the /home directory with the read and write permissions the attributes
inside the brackets can be read using the man command along with other attributes that can go in the brackets:
Code:
man exports
Once you have setup your export you should start the portmap daemon. The portmap daemon MUST always be running when running a NFS server.
Code:
service portmap start
Once your portmap has been started you can start your NFS server:
Code:
service nfs start
Once the service has started you can check everything is running by issue the following
command:
Code:
rpcinfo -p
You will get output similar to:
Code:
program vers proto port
100000 2 tcp 111 portmapper
100000 2 udp 111 portmapper
100003 2 udp 2049 nfs
100003 3 udp 2049 nfs
100003 4 udp 2049 nfs
100003 2 tcp 2049 nfs
100003 3 tcp 2049 nfs
100003 4 tcp 2049 nfs
100021 1 udp 32833 nlockmgr
100021 3 udp 32833 nlockmgr
100021 4 udp 32833 nlockmgr
100021 1 tcp 32774 nlockmgr
100021 3 tcp 32774 nlockmgr
100021 4 tcp 32774 nlockmgr
100011 1 udp 704 rquotad
100011 2 udp 704 rquotad
100011 1 tcp 707 rquotad
100011 2 tcp 707 rquotad
100005 1 udp 706 mountd
100005 1 tcp 709 mountd
100005 2 udp 706 mountd
100005 2 tcp 709 mountd
100005 3 udp 706 mountd
100005 3 tcp 709 mountd
Once everything is checked out and the services are running you can connect form 192.168.0.13 and mount the /home directory.
Code:
mount 192.168.0.2:/home /mnt/home
Replace 192.168.0.2 with your NFS servers IP and the /mnt/home mount point to one that
suites you.
if you make any changes to the export file you will need to reexport it instead of restarting the
services issue the following:
Code:
exportfs -r
well you can now setup a simple NFS server and store your files on the server :)