Ubuntu: Difference between revisions

1,584 bytes added ,  5 years ago
Line 176:
Source: [https://www.digitalocean.com/community/tutorials/how-to-set-up-an-nfs-mount-on-ubuntu-16-04 digitalocean.com]
 
;On Server side:
 
Installation
sudo apt-get install nfs-kernel-server
 
*Make a share directory called nfs:
{{UC}}
sudo mkdir /var/nfs/general -p
 
*NFS will translate any root operations on the client to the nobody:nogroup credentials as a security measure.
*Therefore change the directory ownership to match those credentials:
sudo chown nobody:nogroup /var/nfs/general
 
*For /home do not change permissions, else it will break down the system.
 
*Configuring the NFS Exports
sudo nano /etc/exports
/var/nfs/general 203.0.113.256(rw,sync,no_subtree_check)
/home 203.0.113.256(rw,sync,no_root_squash,no_subtree_check)
 
 
rw: This option gives the client computer both read and write access to the volume.
sync: This option forces NFS to write changes to disk before replying. This results in a more stable and consistent environment since the reply reflects the actual state of the remote volume. However, it also reduces the speed of file operations.
no_subtree_check: This option prevents subtree checking, which is a process where the host must check whether the file is actually still available in the exported tree for every request. This can cause many problems when a file is renamed while the client has it opened. In almost all cases, it is better to disable subtree checking.
no_root_squash: By default, NFS translates requests from a root user remotely into a non-privileged user on the server. This was intended as security feature to prevent a root account on the client from using the file system of the host as root. no_root_squash disables this behavior for certain shares.
 
 
sudo systemctl restart nfs-kernel-server
 
;On Client Installside:
sudo apt-get install nfs-common
 
*Edit fstab file:
sudo nano /etc/fstab
10.10.1.30:/home/cores /mnt/cores/ nfs auto,noatime,nolock,bg,nfsvers=3,intr,tcp
 
*Test the mount:
sudo mount -a