-
Notifications
You must be signed in to change notification settings - Fork 4
NFS Rpi
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. It's preferable to use a hostname as that won't change. Static IPs would also be very helpful.
Complete commands using sudo. Otherwise just become root.
yum install nfs-utils
mkdir <directory of NFS> Ex: mkdir /opt/nfsshare
chmod -R 777 nfsshare
chown nfsnobody:nfsnobody /directory Ex: chown nfsnobody:nfsnobody /opt/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)
Firewall set up:
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 -arv //Exports contents in /etc/exports into another file that NFS server will use. Make sure to run this command when you update /etc/exports
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
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, on the client machine:
umount -f -l /mnt/myfolder
On client:
showmount -e <NFS server>
I was having a lot of trouble mounting once I get a dedicated hostname. What I believe fixed it was this:
vim /etc/hosts
To the host file add this:
<your IP, but make the last digit 0>/24 <hostname>
Here is what my whole /etc/hosts file looked like when it was complete:
(Was in here previously)
127.0.0.1 localhost andAWholeBunchOfJunk
::1 localhost andAWholeBunchOfJunk
(I added)
10.0.33.0/24 frutilla
I was also having issues with the firewall at some point in this process. So I shut it down...here's how to do that if you'd like (I shut it down on both the server and client)
systemctl disable firewalld
systemctl stop firewalld
systemctl status firewalld //Will say inactive
https://www.howtoforge.com/tutorial/setting-up-an-nfs-server-and-client-on-centos-7/ http://mpitutorial.com/tutorials/running-an-mpi-cluster-within-a-lan/