#! /bin/bash ### frontend-2of3.txt. The sequel of frontend-1of3. This script is effective only after the frontend rebooted at the end of this script' #HOSTNAME=hostname # 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)' node10='/export 192.168.1.30/24(rw,sync,no_root_squash)' node11='/export 192.168.1.31/24(rw,sync,no_root_squash)' node12='/export 192.168.1.32/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 echo $node10 >> /etc/exports echo $node11 >> /etc/exports echo $node12 >> /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 # create shared folders /share/cluster, /share/tmp, /share/home, /share/apps mkdir -p /export/share/apps/configrepo mkdir -p /export/share/apps/local/bin mkdir -p /export/share/home mkdir -p /export/share/apps/configrepo/users_data mkdir -p /export/share/tmp mkdir -p /export/share/cluster cd / rm -rf share ln -s /export/share . cd /share/apps/configrepo chmod -R 755 /share/apps/ chmod -R 777 /share/home chmod -R 700 users_data/ chmod -R 777 /share/tmp ### 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