J2CKo

                      Your journey is over, Niska.
                      But I am no longer Odi.
                      Then who are you?
                      My name is Vi.

                      Humans s3e8, 00:02


### NFS WITH DEBIAN STRETCH ###
-------------------------------

On VirtualBox DEBIAN9GATEWAY from previous paper and RASPi64 as RABBIT were tested.


## SERVER

  apt-get install nfs-kernel-server nfs-common
  
Create folder to share

  mkdir -p /home/nfs
  chown nobody:nogroup /home/nfs
  chmod 755 /home/nfs
  
Check exports

  # cat /etc/exports

file /etc/exports

  # hack server address to subnet address/mask

  /home/nfs       10.0.10.0/24(rw,sync,no_subtree_check)
  /var/www        10.0.10.0/24(rw,sync,fsid=0,crossmnt,no_subtree_check,no_root_squash)

EOF

The no_root_squash option makes that /home/nfs will be accessed as root.

  # systemctl start nfs-kernel-server.service
  # systemctl status nfs-kernel-server.service

Check mounts:

  showmount -e 10.0.10.1


## CLIENT

  # apt-get install nfs-common
  # mkdir -p /mnt/nfs/home/nfs
  # mkdir -p /mnt/nfs/var/www
  # chmod 777 /mnt/nfs/home/nfs
  
Now mount:

  # mount 10.0.10.1:/home/nfs /mnt/nfs/home/nfs
  # mount 10.0.10.1:/var/www  /mnt/nfs/var/www
  
Now test:
  
  $ touch /mnt/nfs/home/nfs/hello_from_rabbit.txt
  # touch /mnt/nfs/var/www/rabbit_say_hi.txt
  
Permanent mount (client aka rabbit):

  nano /etc/fstab

  ..
  10.0.10.1:/home/nfs  /mnt/nfs/home/nfs   nfs      rw,sync,hard,intr  0     0
  10.0.10.1:/var/www   /mnt/nfs/var/www    nfs      rw,sync,hard,intr  0     0
  
Test:

  # umount /mnt/nfs/home/nfs
  # umount /var/www
  # mount -a

You should now see the two NFS shares in the outputs of

  df -h


## LINKS:

  1. https://www.howtoforge.com/tutorial
      /install-nfs-server-and-client-on-debian/

