How to install and configure NFS server in Cubian/Debian

How to install and configure NFS server in Cubian/Debian
In the following article is how I set-up and configure NFS server in Cubian running on Cubieboard2. In this example I’m sharing a directory named /srv/http/dev.data with my local (LAN) network.


LET’S START

The first thing that you will need to do is to log in to your Debian VPS as ROOT via SSH.

Once you are in make sure that your Debian system is fully up-to-date by running the following commands in your terminal:

apt-get update
apt-get upgrade

Next, install NFS package using apt:

apt-get install nfs-kernel-server

and set the hostname:

cp /etc/idmapd.conf{,.orig}
sed -i 's/# Domain = localdomain/Domain = wormhole/' /etc/idmapd.conf

Set-up ACL for the NFS share that may be exported to NFS clients:

mountDir=/srv/http/dev.data
allowedNet=10.10.10.0/24
nfsOpts='(fsid=0,rw,sync,no_root_squash,no_subtree_check)'

cp /etc/exports{,.orig}
echo -e "${mountDir%%/} ${allowedNet}${nfsOpts}" >> /etc/exports

and start the NFS server:

service nfs-kernel-server restart 

CLIENT-SIDE

Install nfs-common package on a client using:

apt-get install nfs-common

Create a directory where we will mount the NFS share:

mkdir -p ~/code/wormhole

Mount the NFS share:

mount wormhole:/srv/http/dev.stavrovski ~/code/wormhole

Following aliases may be helpful

alias webspace-mount='sudo mount wormhole:/srv/http/dev.data ~/code/projects/my_domain_name.com'
alias webspace-umount='sudo umount ~/code/projects/my_domain_name.com'

If you’re one of our Linux VPS Hosting customers we can install and configure NFS server on your virtual server for you free of charge. Just contact us and some of our experts will complete your request immediately.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes:

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>