admin/ April 7, 2016/ Linux/ 0 comments

There are few simple steps to setup the NFS server on Ubuntu.

Setup the NFS at Server end.
Step 1-:

$ sudo apt-get install nfs-kernel-server portmap

Step 2-:
Create a directory to be share on server and change permissions

$ sudo mkdir /var/www/share
$ sudo chown nobody:nogroup /var/www/share

Step 3-:

$ sudo nano /etc/exports

add the below lines in /etc/exports

/var/www/share 192.168.1.0/24(rw,sync,no_root_squash,no_subtree_check)

Step 4-:
Run the below command to configure export.

$ sudo exportfs -a

To check the configuration is working

$ sudo exportfs -v

Output

/var/www/share 192.168.1.0/24(rw,wdelay,no_root_squash,no_subtree_check)

Setup the NFS at client end.
Step1 -:
Install NFS Client packages

$ sudo apt-get install nfs-common portmap

Step 2-:
Create a directory to be mount and share

$ sudo mkdir /mnt/share

Step 3-:
To mount use the below command, use your NFS server ip here

$ sudo mount :/var/www/share /mnt/share

Example

$ sudo mount 192.168.1.100:/var/www/share /mnt/share

To Check the mount NFS.

$ sudo mount

Output-:

$ mount
/dev/sda1 on / type ext4 (rw)
none on /proc type proc (rw)
/dev/sda6 on /home type ext4 (rw)
none on /proc/sys/fs/binfmt_misc type binfmt_misc (rw)
gvfs-fuse-daemon on /home/user/.gvfs type fuse.gvfs-fuse-daemon (rw,nosuid,nodev,user=user)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw)
192.168.1.100:/var/www/share on /mnt/share type nfs (rw,addr=192.168.1.100)

Leave a Reply