NFS setting on LAN
In this post I describe how to set up a NFS file system on a local area newtwork: a NFS server blueberry (in this example a desktop with OpenSuse Leap 15.5 linux), exposing a directory path jupiter; and a NFS client strawberry (a Raspberry Pi with Debian buster linux). I am also showing how to use autofs to access jupiter.
These are the steps required:
-  Server side
- install the server nfs daemon. On OpenSuse Leap this is done with:
 sudo zypper install nfs-kernel-server
- Open port 2049 (nfs) on blueberry‘s firewall
- Declare the directories to be exported on the server.
 This is done by editing/adding the file/etc/exportswith the following (example):
 /jupiter 192.168.1.0/255.255.255.0(rw,sync,no_root_squash,no_all_squash,no_subtree_check)
 Here the first element declares which directory to export. It is followed by the ip filter that allows all clients on the LAN and by a list of mounting options.
- restart the nfs daemon
 
- install the server nfs daemon. On OpenSuse Leap this is done with:
-  Client side
- Install nfs client on strawberryby:
 sudo apt-get install nfs-common
- Test that the client is working by mounting on a subdirectory of /mnt, like:
 sudo mkdir -p /mnt/jupiter
 sudo mount -v -t nfs blueberry:/jupiter /mnt/jupiter
 ls /mnt/jupiter
 The last statement should return a non-empty list of files/directories in the server nfs directory.
 
- Install nfs client on 
-  Using autofs
 autofsallows automatic or lazy mounting of a directory. The mounting happens the first time that a path is required.- install autofson the clientstrawberryby:sudo apt-get install autofs
- create a directory path to hold the mount point, like sudo mkdir -p /mnt/nfs/jupiter
- edit the file /etc/auto.masterby creating the mapping to the appropriate configuration file.
 Add the following to the file:
 /mnt/nfs /etc/auto.nfs
 This tellsautofsthat the mounting of mount-point/mnt/nfsis determined by the configuration/etc/auto.nfs
- Create the file /etc/auto.nfs, if its does not exists already, and add the following:
 jupiter -fstype=nfs4,rw blueberry:/jupiter
 This tellsautofsto mount the mount point/mnt/nfs/jupiterpointing tojupiterdirectory on the serverblueberryusing mount options-fstype=nfs4,rw
- Test it by ls /mnt/nfs/jupiter. It should work without the need of explicit mounting.
 
- install 
Recent Comments