#! /bin/bash ### centos6_frontend2of2. The sequel of centos6_frontend1of2. This script is effective only after the frontend rebooted at the end of running centos6_frontend1of2. # 4. cd /home/common mkdir nfs cd /home/common/nfs wget http://10.205.19.205/configrepo/howto/CENTOS6/centos6_frontend1of2 wget http://10.205.19.205/configrepo/howto/CENTOS6/centos6_frontend2of2 wget http://10.205.19.205/configrepo/howto/CENTOS6/centos6_node_part2 wget http://10.205.19.205/configrepo/howto/CENTOS6/exports wget http://10.205.19.205/configrepo/howto/CENTOS6/iptables wget http://10.205.19.205/configrepo/howto/CENTOS6/centos6_node_mpich wget http://10.205.19.205/configrepo/howto/CENTOS6/inst_apps wget http://10.205.19.205/configrepo/howto/CENTOS6/centos6_ssh wget http://10.205.19.205/configrepo/howto/CENTOS6/centos6_ssh-copy-cluster wget http://10.205.19.205/tlyoon/info/bashrc cp /home/common/.bashrc /home/common/.bashrc.orig cp /home/common/nfs/bashrc /home/common/.bashrc chown common: /home/common/.bashrc . /home/common/.bashrc cp /root/.bashrc /root/.bashrc.orig cp /home/common/nfs/bashrc /root/.bashrc chown root: /root/.bashrc . /root/.bashrc chmod +x /home/common/nfs/* chown -R common: /home/common/nfs ### Preparing repo's wget http://10.205.19.205/configrepo/howto/CENTOS6/addrepo_nfs chmod +x addrepo_nfs ./addrepo_nfs ####### #5. # Configure nfs server in frontend (refer to http://www.cyberciti.biz/faq/centos-fedora-rhel-nfs-v4-configuration/) cd /home/common/nfs wget http://www2.fizik.usm.my/configrepo/howto/CENTOS6/exports # the file export contains the inform of which folder to be shared for the other nodes (in our case,/home/common/ and /usr/local). mv /etc/exports /etc/exports.orig cp exports /etc/. #chkconfig portmap on #service portmap start chkconfig nfs on service nfs start exportfs -ra /etc/init.d/nfs start # 5.5. # Backup iptables since 6 - 9 below are going to modifiy the iptables cp /etc/sysconfig/iptables /etc/sysconfig/iptables.orig # 6. Sharing eth1 in frontend for port forwarding so that other nodes can go online via frontend's eth1 # (see http://www.cyberciti.biz/faq/rhel-fedora-linux-internet-connection-sharing-howto/). # Note that we need to put this script in centos6_frontend2of2 because iptables will work only after the SELINUX has been set to permissive in centos6_frontend1of2. sed -i 's/net.ipv4.ip_forward = 0/net.ipv4.ip_forward = 1/g' /etc/sysctl.conf echo 'net.ipv4.conf.default.forwarding=1' >> /etc/sysctl.conf service network restart service iptables stop iptables -t nat -A POSTROUTING -o eth1 -j MASQUERADE # 7. # Open the 2049 port by adding in a line in the iptables. This is to make nfs works. # '-A RH-Firewall-1-INPUT -s 10.1.1.1/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT' #iptables -A RH-Firewall-1-INPUT -s 10.1.1.1/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT iptables -A INPUT -s 10.1.1.1/24 -m state --state NEW -p tcp --dport 2049 -j ACCEPT # If this fail, one has to do it by hand to edit /ets/sysconfig/iptables. #8. # Open the frontend's firewall to trust i/o via eth0. This is required in order for mpich2 to work. iptables -A INPUT -i eth+ -j ACCEPT iptables -A FORWARD -m state --state ESTABLISHED,RELATED -j ACCEPT iptables -A FORWARD -p icmp -j ACCEPT iptables -A FORWARD -i lo -j ACCEPT iptables -A FORWARD -i eth+ -j ACCEPT # If this fail, one has to do it by hand by clicking the eth+ in firewall's trusted interfaces in the administration GUI. # 8.5 (OPTIONAL. Used only if 5 - 8 fail) # The iptables from http://www2.fizik.usm.my/configrepo/howto/CENTOS6/iptables are supposed to work it it is used to replace the existing one to implement the steps mentioned above (5,6,7,8). To replace the iptables, uncomment the lines below. However this is not an necessary if (5 - 8) all work well. #cd /home/common/nfs #mv iptables /etc/sysconfig/. # 9. # Restart all iptables after modification. service iptables save service iptables restart # 10. # Install numerical pacakges NOT including mpich2, from http://10.205.19.205/configrepo/howto/inst_numeric_nompich2 cd /home/common/nfs wget http://10.205.19.205/configrepo/howto/inst_numeric_nompich2 chmod +x inst_numeric_nompich2 ./inst_numeric_nompich2 # 11. Install mpich2 in /root cd /home/common/nfs wget http://www2.fizik.usm.my/configrepo/howto/mpich2/mpich2-1.4.1p1.tar cp /home/common/nfs/mpich2-1.4.1p1.tar /root/. cd /root tar -xvf mpich2-1.4.1p1.tar cd mpich2-1.4.1p1 ./configure make make install chown -R common: /home/commmon/nfs/mpich2-1.4.1p1 # 12. Install lammps-icms in /home/common/nfs cd /home/common/nfs wget http://www2.fizik.usm.my/configrepo/howto/CENTOS6/inst_lammps-icms_CENTOS6_nfs chmod +x inst_lammps-icms_CENTOS6_nfs ./inst_lammps-icms_CENTOS6_nfs chown -R common: /home/common/nfs/lammps-icms touch /home/common/hosts echo '10.1.1.1' >> /home/common/hosts echo '10.1.255.231' >> /home/common/hosts echo '10.1.255.232' >> /home/common/hosts echo '10.1.255.233' >> /home/common/hosts echo '10.1.255.234' >> /home/common/hosts echo '10.1.255.235' >> /home/common/hosts echo '10.1.255.236' >> /home/common/hosts echo '10.1.255.237' >> /home/common/hosts chown common: /home/common/hosts chown -R common: /home/common/nfs ###### END of FRONTEND CONFIGURATION ################################################################################################ reboot