Skip to content
This repository was archived by the owner on Jul 31, 2022. It is now read-only.

NFS Rpi

Dylan Christopherson edited this page Jun 7, 2018 · 22 revisions

NFS Server and Client Installation on CentOS 7

In this, if it says hostname you can use the IP of the machine and if it says the IP, you can use the hostname of the machine. They are interchangeable in this instance.

On Server:

Complete commands using sudo. Otherwise just become root.

yum install nfs-utils
mkdir <directory of NFS>           Ex: mkdir /opt/nfsshare                 
chmod -R 777 nfsshare
systemctl enable rpcbind nfs-server nfs-lock nfs-idmap
systemctl start rpcbind nfs-server nfs-lock nfs-idmap

vim /etc/exports      //File might not exist previously. This will create a new file

To the exports file add:

<directory of NFS> <IP of client but use syntax below>(rw,sync,no_root_squash,no_all_squash)

Example:

/opt/nfsshare 10.0.34.*(rw,sync,no_root_squash,no_all_squash)

This may be optional (Might be good just to do):

firewall-cmd --permanent --add-port=111/tcp
firewall-cmd --permanent --add-port=54302/tcp
firewall-cmd --permanent --add-port=20048/tcp
firewall-cmd --permanent --add-port=2049/tcp
firewall-cmd --permanent --add-port=46666/tcp
firewall-cmd --permanent --add-port=42955/tcp
firewall-cmd --permanent --add-port=875/tcp
firewall-cmd --reload

Continue with:

systemctl restart nfs-server
exportfs -a

On Client

yum install nfs-utils
systemctl enable rpcbind nfs-server nfs-lock nfs-idmap
systemctl start rpcbind nfs-server nfs-lock nfs-idmap

mkdir <directory of NFS>           Ex: mkdir /opt/nfsshare

mount -t nfs <serverName>:<directory of NFS server> <directory name of NFS client>

Example:

mount -t nfs frambuesa:/opt/nfsshare /opt/nfsshare

After

If you reboot the client Raspberry Pi, it will unmount the NFS. To make sure it automatically remounts on boot or reboot, follow these steps:

On the client machine:

vim /etc/fstab

At the bottom add:

<serverName>:<directory of NFS server> <directory name of NFS client>

Example:

frambuesa:/opt/nfsshare /opt/nfsshare

To unmount

To unmount, on the client machine:

umount -f -l /mnt/myfolder
Clone this wiki locally