NFS is a file system that can be shared by several hosts.
In this tutorial, we’ll explain how to install and configure an NFS server on Debian 8 Jessie.
Installing and configuring an NFS server
First, we use the command below to install the NFS server:
apt-get install nfs-kernel-server
Our folder to be shared will be in “/var/lib/vz/nfs”:
mkdir -p /var/lib/vz/nfs
The “/etc/exports” file is where the NFS mount point settings are made:
vim /etc/exports
Each line in the file corresponds to a client that can access your NFS server:
# /etc/exports: the access control list for filesystems which may be exported # to NFS clients. See exports(5). # # Example for NFSv2 and NFSv3: # /srv/homes hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check) # # Example for NFSv4: # /srv/nfs4 gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check) # /srv/nfs4/homes gss/krb5i(rw,sync,no_subtree_check) # /var/lib/vz/nfs 192.168.0.10(rw,sync,no_subtree_check) /var/lib/vz/nfs 192.168.0.11(rw,sync,no_subtree_check)
With the above settings made, simply save the file and then restart the NFS service:
systemctl restart nfs-kernel-server.service