VScaler: CIX Controller Node OHPC Installation

From Define Wiki
Jump to navigation Jump to search

1st Script - Update installation and install packages

  • 1_ohpc-head-update.sh
#!/bin/bash

## Check to see if you are root

if [ "$USER" != "root" ]
then
        echo "This and the following scripts must be ran as root!"
	exit
fi

## Double check you want to continue

echo "You are about to update the system and reboot."
echo "Are you sure you want to continue? [y/N]"

read input
if [ "$input" != "y" ]
then
        exit
fi

## Install packages, update and reboot
yum -y install kernel* tk* tcl* tigervnc* ipmitool* freeipmi* cairo* perl* gcc* glibc* screen epel-release vim ntp libnl lsof libxml2-python python mlocate numactl* yum-utils htop xinetd
yum -y groupinstall "Development Tools" "Base"
yum -y update

echo "1" >> /tmp/ohpc-step-1

reboot

2nd Script - OHPC Installation

  • 2_ohpc-head-install.sh
#!/bin/bash

## Check to see if you are root

if [ "$USER" != "root" ]
then
        echo "This and the following scripts must be ran as root!"
        exit
fi

## Check if the previous step is completed

check_prev=$(cat /tmp/ohpc-step-1 2> /dev/null)

if [ "$check_prev" != "1" ]
then
        echo "You did not run the first script! Exiting..."
        exit
fi

echo "After the end of this script, do you want to run the 3rd one as well? [y/N]"

run_3rd="1"
read run3
if [ "$run3" != "y" ]
then
        run_3rd="0"
fi

## Set the required variables

FILE_DIR=/root/ohpc-install
HOSTNAME="head.cix.vscaler.cloud"
SLURM_CONTROLLER="head"
IF1=enp6s0f0
IF2=enp6s0f1
PROVISION_IF=$IF1
EXTERNAL_IF=$IF2
CHROOT="/opt/ohpc/admin/images/centos7.2"
OHPC_REPO="http://build.openhpc.community/OpenHPC:/1.1/CentOS_7.2/OpenHPC:1.1.repo"
INTERNAL_IP="172.18.0.1"
INTERNAL_NM="255.255.0.0"
NTP="0.centos.pool.ntp.org"

## Make sure the admin wants to continue

echo "*************************************************************************************"
echo "You are about to install the OHPC head-node packages and configure it appropriately, with the following parameters."
echo "MAKE SURE YOU HAVE CHANGED THE INTERFASES AND SUBNETS IN THE SCRIPT ACCORDINGLY!"
echo "You are about to use:"
echo "   Internal/Provision Interface: $PROVISION_IF"
echo "   External Interface:           $EXTERNAL_IF"
echo "   Internal Subnet:              $INTERNAL_IP / $INTERNAL_NM"
echo "   Head Hostname:                $HOSTNAME"
echo "*************************************************************************************"
echo "Are you sure you want to continue? [y/N]"

read input
if [ "$input" != "y" ]
then
        exit
fi


## Stop some services

systemctl stop NetworkManager 
systemctl disable NetworkManager 
systemctl stop firewalld 
systemctl disable firewalld 

## Set the hostname of the head

hostnamectl set-hostname $HOSTNAME

## Configure the provision interface

cp $FILE_DIR/ifcfg-ohpc-provision /etc/sysconfig/network-scripts/ifcfg-$PROVISION_IF
perl -pi -e "s/NAME=eno1/NAME=${PROVISION_IF}/" /etc/sysconfig/network-scripts/ifcfg-$PROVISION_IF
perl -pi -e "s/DEVICE=eno1/DEVICE=${PROVISION_IF}/" /etc/sysconfig/network-scripts/ifcfg-$PROVISION_IF
echo "IPADDR=$INTERNAL_IP" >> /etc/sysconfig/network-scripts/ifcfg-$PROVISION_IF
echo "NETMASK=$INTERNAL_NM" >> /etc/sysconfig/network-scripts/ifcfg-$PROVISION_IF
systemctl restart network

## Add some aliases in bashrc and source it

echo >> /root/.bashrc
echo "CHROOT=$CHROOT" >> /root/.bashrc
echo "ohpc_repo=$OHPC_REPO" >> /root/.bashrc
echo "sms_name=$HOSTNAME" >> /root/.bashrc
echo "sms_ip=$INTERNAL_IP" >> /root/.bashrc
echo "sms_eth_internal=$PROVISION_IF" >> /root/.bashrc
echo "eth_provision=$PROVISION_IF" >> /root/.bashrc
echo "internal_netmask=$PROVISION_NM" >> /root/.bashrc
echo "ntp_server=$NTP" >> /root/.bashrc

source /root/.bashrc

## Add the OHPC repo in yum

wget -P /etc/yum.repos.d ${OHPC_REPO}
yum clean all

## Add ntp

systemctl stop ntpd
ntpdate $NTP
systemctl start ntpd
systemctl enable ntpd

## Install OHPC components

yum -y groupinstall ohpc-base ohpc-warewulf
yum -y groupinstall ohpc-slurm-server 
useradd slurm

## Modify config files

#mkdir /tmp/setup-filesystems
#cd /tmp/setup-filesystems
#cat /srv/warewulf/initramfs/capabilities/setup-filesystems | cpio -i
#rm -rf warewulf/provision/80-mkbootable
#cp $FILE_DIR/80-mkbootable warewulf/provision/
#find warewulf | cpio -o -c > /srv/warewulf/initramfs/capabilities/setup-filesystems
#cd

sed -i '29 s/^/#/' /etc/warewulf/vnfs.conf
sed -i '53,54 s/^/#/' /etc/warewulf/vnfs.conf
sed -i '13,17 s/^/#/' /etc/warewulf/bootstrap.conf
sed -i '31 s/^#//' /etc/warewulf/bootstrap.conf

perl -pi -e "s/device = eth1/device = ${PROVISION_IF}/" /etc/warewulf/provision.conf
perl -pi -e "s/^\s+disable\s+= yes/ disable = no/" /etc/xinetd.d/tftp
MODFILE=/etc/httpd/conf.d/warewulf-httpd.conf
perl -pi -e "s/cgi-bin>\$/cgi-bin>\n Require all granted/" $MODFILE
perl -pi -e "s/Allow from all/Require all granted/" $MODFILE
perl -ni -e "print unless /^\s+Order allow,deny/" $MODFILE
perl -pi -e "s/ControlMachine=\S+/ControlMachine=$SLURM_CONTROLLER/" /etc/slurm/slurm.conf

## Restart and enable some services

systemctl restart xinetd
systemctl enable xinetd
systemctl restart mariadb
systemctl enable mariadb.service
systemctl restart httpd.service
systemctl enable httpd.service
systemctl restart rpcbind.service
systemctl enable rpcbind.service
systemctl restart nfs-server.service
systemctl enable nfs-server.service 

echo "1" >> /tmp/ohpc-step-2

if [ "$run_3rd" == "1" ]
then
	./3_ohpc-head-exports-vnfs.sh
fi