#! /bin/bash ### centos_frontend-2of2.txt. The sequel of centos_frontend-1of2. This script is effective only after the frontend rebooted at the end of this script' HOSTNAME=chakra # Configure nfs server in the frontend (refer to https://www.itzgeek.com/how-tos/linux/centos-how-tos/how-to-setup-nfs-server-on-centos-7-rhel-7-fedora-22.html) mkdir /export/share chmod 777 /export/share chmod 777 /export/share/home mv /etc/exports /etc/exports.orig node1='/export 192.168.1.21/24(rw,sync,no_root_squash)' node2='/export 192.168.1.22/24(rw,sync,no_root_squash)' node3='/export 192.168.1.23/24(rw,sync,no_root_squash)' node4='/export 192.168.1.24/24(rw,sync,no_root_squash)' node5='/export 192.168.1.25/24(rw,sync,no_root_squash)' node6='/export 192.168.1.26/24(rw,sync,no_root_squash)' node7='/export 192.168.1.27/24(rw,sync,no_root_squash)' node8='/export 192.168.1.28/24(rw,sync,no_root_squash)' node9='/export 192.168.1.29/24(rw,sync,no_root_squash)' echo $node1 > /etc/exports echo $node2 >> /etc/exports echo $node3 >> /etc/exports echo $node4 >> /etc/exports echo $node5 >> /etc/exports echo $node6 >> /etc/exports echo $node7 >> /etc/exports echo $node8 >> /etc/exports echo $node9 >> /etc/exports systemctl start nfs-server rpcbind systemctl enable nfs-server rpcbind exportfs -ra #We need to configure the firewall on the NFS server to allow NFS client to access the NFS share. To do that, run the following commands on the NFS server. firewall-cmd --permanent --add-service mountd firewall-cmd --permanent --add-service rpc-bind firewall-cmd --permanent --add-service nfs firewall-cmd --reload # creat a shared folder called /share/cluster cd / ln -s /export/share/ . mkdir /share/cluster ### replace /etc/hosts by /share/cluster/hosts cp /etc/hosts /etc/hosts.orig mv /etc/hosts /share/cluster/ ln -s /share/cluster/hosts /etc/ echo 192.168.1.10 $HOSTNAME.local $HOSTNAME >> /share/cluster/hosts reboot