Jump to content
Sign in to follow this  
xDamox

Setting up a simple NFS server

Recommended Posts

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:

 

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:

 

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:

 

/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:

 

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.

 

service portmap start

 

Once your portmap has been started you can start your NFS server:

 

service nfs start

 

Once the service has started you can check everything is running by issue the following

command:

 

rpcinfo -p

 

You will get output similar to:

 

  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.

 

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:

 

exportfs -r

 

well you can now setup a simple NFS server and store your files on the server :D

  • Like 1

Share this post


Link to post
Share on other sites
^_^ nice !

Share this post


Link to post
Share on other sites
Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...