Diff for "AutomatedNodeDeployment"


Differences between revisions 1 and 2
Revision 1 as of 2009-04-15 16:31:18
Size: 20173
Editor: nc-65-40-163-178
Comment:
Revision 2 as of 2009-04-15 19:29:12
Size: 20364
Editor: nc-65-40-163-193
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
Line 4: Line 5:
= Introduction =
Line 8: Line 7:
Many "how to" documents exist on automating the installation of the Linux operating system to include making hard drive images and scripted installations. Many “how to” documents exist on how to set up various services in Linux as well. Many "how to" documents exist on automating the installation of the Linux operating system to include making hard drive images and scripted installations. Many how to documents exist on how to set up various services in Linux as well.
Line 18: Line 17:
 1. TFTP Server
 1. Syslinux
 1. DHCP Server
 1. NFS Server
 1. Debootstrap
 1. PXE capable NICs
 * TFTP Server
 * Syslinux
 * DHCP Server
 * NFS Server
 * Debootstrap
 * PXE capable NICs
Line 26: Line 25:
 1. Wake-on-lan
 1. Apache
 1. Apt-mirror
 1. BIND
 1. Whois (for the mkpassword command)
 1. Expect
 * Wake-on-LAN
 * Apache
 * Apt-mirror
 * BIND
 * Whois (for the mkpassword command)
 * Expect
Line 41: Line 40:
* /opt/cluster will contain bash scripts
* /opt/cluster/config will contain configuration information
 * /opt/cluster will contain bash scripts
 * /opt/cluster/config will contain configuration information
Line 50: Line 49:
 1. Network
 1. Server identification
 1. File locations
 1. Operating system
 1. Packages
 1. Nodes
 * Network
 * Server identification
 * File locations
 * Operating system
 * Packages
 * Nodes
Line 58: Line 57:

- Please note: a file that is sourced does not need to start with a shebang. The shebang i.e #!/bin/bash may be missing from the other scripts due to the wiki mark-up


Create the global configuration:

{{{
touch /opt/cluster/config/global.conf
}}}
Line 139: Line 148:
* . /opt/cluster/config/global.conf
* source /opt/cluster/config/global.conf
 * . /opt/cluster/config/global.conf
 * source /opt/cluster/config/global.conf
Line 146: Line 155:
 1. Site information – identifies how our site is configured
 1. Service information – identifies various services and their related configuration files
 1. Node information – identifies node information. Please take node of the variable NODE as it identifies the name of the first node in the cluster.
 1. NFS Root file-system information – identifies information related to creating our NFS root for disk-less systems.
 * Site information – identifies how our site is configured
 * Service information – identifies various services and their related configuration files
 * Node information – identifies node information. Please take node of the variable NODE as it identifies the name of the first node in the cluster.
 * NFS Root file-system information – identifies information related to creating our NFS root for disk-less systems.
Line 153: Line 162:
Now that we have defined our global configuration, we will now install the necessary software to make our system the “head node”. If we can automate the installation of nodes, we should be able to automate the installation and configuration of our deployment server. Now that we have defined our global configuration, we will now install the necessary software to make our system the head node. If we can automate the installation of nodes, we should be able to automate the installation and configuration of our deployment server.
Line 156: Line 165:
 1. Creates our cluster user with a specific ID and home directory
 1. Installs openssh
 1.
Installs debootstrap
 1. Installs apt-mirror (see Note(1) regarding apt-mirror located after script)
 1. Configures /etc/apt/mirror.list
 1. Installs TFTP
 1. Installs syslinux
 1. Installs ISC DHCP Server
  1. Configures the scope for the DHCP server
 1. Installs NTP
  1. Configures NTP
 1. Installs BIND
  1. Configures the forward look-up zone
  1. Configures the reverse look-up zone
 1. Installs NFS server
  1. Configures our exports
 1. Install the LAMP stack (see Note(2) regarding LAMP located after script)
  1. Makes our Ubuntu mirror available via HTTP
 1. Creates our initial node list (blank to begin)
 1. Installs parallel-ssh
 1. Installs expect
 1. Installs wakeonlan
 * Creates our cluster user with a specific ID and home directory
 * Installs openssh
 *
Installs debootstrap
 * Installs apt-mirror (see Note(1) regarding apt-mirror located after script)
 * Configures /etc/apt/mirror.list
 * Installs TFTP
 * Installs syslinux
 * Installs ISC DHCP Server
  * Configures the scope for the DHCP server
 * Installs NTP
  * Configures NTP
 * Installs BIND
  * Configures the forward look-up zone
  * Configures the reverse look-up zone
 * Installs NFS server
  * Configures our exports
 * Install the LAMP stack (see Note(2) regarding LAMP located after script)
  * Makes our Ubuntu mirror available via HTTP
 * Creates our initial node list (blank to begin)
 * Installs parallel-ssh
 * Installs expect
 * Installs wakeonlan

Setting up an Ubuntu System to deploy Ubuntu

Installing an operating system on multiple systems can be a complicated and daunting task. A check-list may be employed to ensure all systems have similar if not identical configurations. We will employ tools to automate the process not only for disk-full systems, but will include disk-less systems as well.

Many "how to" documents exist on automating the installation of the Linux operating system to include making hard drive images and scripted installations. Many how to documents exist on how to set up various services in Linux as well.

This document was created with the intent of being a comprehensive document that will allow the easy deployment of an Ubuntu HPC cluster. We will not concentrate on parallel computing, only on the deployment of the nodes to support a HPC Cluster.

Bash will be our main tool for the automation. I will explain the purpose of each script as you encounter them on this page.

Prerequisites

Required

  • TFTP Server
  • Syslinux
  • DHCP Server
  • NFS Server
  • Debootstrap
  • PXE capable NICs

Optional

  • Wake-on-LAN
  • Apache
  • Apt-mirror
  • BIND
  • Whois (for the mkpassword command)
  • Expect

I highly recommend the optional requirements as they will ease the installation of the operating system.

Getting Started

Install Ubuntu 9.04 (Jaunty Jackalope) on a system that you will use as the deployment server. I prefer a minimal install and then install required/optional packages as needed.

I maintain all the scripts in /opt/cluster, however, you can modify them to be placed in any location. All bash scripts make reference to a global configuration file. Having common variables in a single location eases the coding involved in other scripts, however, may cause confusion when encountering unknown variables when you are making changes to the code.

  • /opt/cluster will contain bash scripts
  • /opt/cluster/config will contain configuration information

Let's create the directory that will contain our scripts and various configuration files:

mkdir -p /opt/cluster/config

The global configuration file /opt/cluster/config/global.conf contains information related to:

  • Network
  • Server identification
  • File locations
  • Operating system
  • Packages
  • Nodes

Create the common configuration file that is sourced by all other scripts.

- Please note: a file that is sourced does not need to start with a shebang. The shebang i.e #!/bin/bash may be missing from the other scripts due to the wiki mark-up

Create the global configuration:

touch /opt/cluster/config/global.conf

# /opt/cluster/config/global.conf: configuration file for node deployment 
# This file is sourced by files used by the deployment system 

# Site information 
DOMAIN_NAME="home.local" 
DOMAIN_ADMIN="root" 
NETWORK="10.10.1.0" 
SUBNET_MASK="255.255.255.0" 
BROADCAST="10.10.1.255" 
ROUTER_NAME="router" 
ROUTER_IP="10.10.1.1" 
NAME_SERVER_NAME="dns" 
NAME_SERVER_IP="10.10.1.10" 
NTP_SERVER_NAME="ntp" 
NTP_SERVER_IP="10.10.1.10" 
DHCP_SERVER_NAME="dhcp" 
DHCP_SERVER_IP="10.10.1.10" 
HTTP_SERVER_NAME="www" 
HTTP_SERVER_IP="10.10.1.10" 
PROXY_SERVER_NAME="proxy" 
PROXY_SERVER_IP="10.10.1.10" 
TFTP_SERVER_NAME="tftp" 
TFTP_SERVER_IP="10.10.1.10" 
NFS_SERVER_NAME="nfs" 
NFS_SERVER_IP="10.10.1.10" 
MIRROR_SERVER_NAME="mirror" 
MIRROR_SERVER_IP="10.10.1.10" 

# Service information 
DHCPD_CONFIG_FILE="/etc/dhcp3/dhcpd.conf" 
DNS_CONFIG_FILE="/etc/bind/named.conf.local" 
DNS_FORWARD_CONFIG="/etc/bind/db.$DOMAIN_NAME" 
DNS_REVERSE_CONFIG="/etc/bind/db.10.10.1" 
UBUNTU_MIRROR_URL="http://$MIRROR_SERVER_NAME.$DOMAIN_NAME/ubuntu" 
NFS_CONFIG_FILE="/etc/exports" 
NFS_ROOT_EXPORT="/srv/nfsroot" 
NFS_HOME_EXPORT="/srv/cluster" 
OFFICIAL_MIRROR="us.archive.ubuntu.com/ubuntu" 
MIRROR_LIST_FILE="/etc/apt/mirror.list" 
TFTP_ROOT="/var/lib/tftpboot" 
DEFAULT_PXE_CONFIG_FILE="$TFTP_ROOT/pxelinux.cfg/default" 

# NODE information 
HEAD_NODE="headnode" 
HEAD_NODE_IP="10.10.1.10" 
HEAD_NODE_WORKING_DIR="/root" 
HEAD_NODE_CONFIG_DIR="/opt/cluster/config" 
BASE_NODE_NAME="node" 
NODE_NUMBER=71 
MASTER_NODE_LIST="$HEAD_NODE_CONFIG_DIR/nodes.txt" 
NEW_NODES_LIST="$HEAD_NODE_CONFIG_DIR/new_nodes.txt" 
PSSH_HOST_FILE="$HEAD_NODE_CONFIG_DIR/hosts.txt" 
# Undiscovered node DHCP Range 
DHCP_RANGE_START="10.10.1.100" 
DHCP_RANGE_STOP="10.10.1.200" 
NODE_USER="cluster" 
NODE_USER_UID=1010 

# NFS Root filesystem information 
ARCH="amd64" 
RELEASE="jaunty" 
PRE_INST_PKGS="language-pack-en,language-pack-en-base,vim,wget,openssh-server,ntp,nfs-common" 
PRE_INST_EXCL_PKGS="ubuntu-minimal" # separated by a comma 
POST_INST_PKGS="linux-image-server" #separated by a space 
PKGS_TO_PURGE="" # separated by a space 
NODE_PXE="$TFTP_ROOT/nodes/$RELEASE/$ARCH" 
REPOSITORY="main restricted universe multiverse" 
NFS_BUILD_DIR="$HEAD_NODE_WORKING_DIR/nfsroot/$RELEASE/$ARCH" 
APT_SOURCES_FILE="$NFS_BUILD_DIR/etc/apt/sources.list" 
FSTAB_FILE="$NFS_BUILD_DIR/etc/fstab" 
HOSTNAME_FILE="$NFS_BUILD_DIR/etc/hostname" 
NTP_CONF_FILE="$NFS_BUILD_DIR/etc/ntp.conf" 
INTERFACE_FILE="$NFS_BUILD_DIR/etc/network/interfaces" 
HOSTS_FILE="$NFS_BUILD_DIR/etc/hosts" 
CURRENT_PXE_FILES="$HEAD_NODE_CONFIG_DIR/pxefiles.txt" 

printf "Global configration file loaded\n"

The global configuration file can be sourced with either

  • . /opt/cluster/config/global.conf
  • source /opt/cluster/config/global.conf

As you read on, you will notice most if not all scripts will refer to /opt/cluster/config/global.conf.

global.conf sections:

  • Site information – identifies how our site is configured
  • Service information – identifies various services and their related configuration files
  • Node information – identifies node information. Please take node of the variable NODE as it identifies the name of the first node in the cluster.
  • NFS Root file-system information – identifies information related to creating our NFS root for disk-less systems.

You will notice that Site information uses the same IP address for multiple servers. This is from dedicating a “head node” to systems deployment. You can substitute pre-existing servers to perform some of the same roles.

Now that we have defined our global configuration, we will now install the necessary software to make our system the head node. If we can automate the installation of nodes, we should be able to automate the installation and configuration of our deployment server.

The script to create the “head node”:

  • Creates our cluster user with a specific ID and home directory
  • Installs openssh
  • Installs debootstrap
  • Installs apt-mirror (see Note(1) regarding apt-mirror located after script)
  • Configures /etc/apt/mirror.list
  • Installs TFTP
  • Installs syslinux
  • Installs ISC DHCP Server
    • Configures the scope for the DHCP server
  • Installs NTP
    • Configures NTP
  • Installs BIND
    • Configures the forward look-up zone
    • Configures the reverse look-up zone
  • Installs NFS server
    • Configures our exports
  • Install the LAMP stack (see Note(2) regarding LAMP located after script)
    • Makes our Ubuntu mirror available via HTTP
  • Creates our initial node list (blank to begin)
  • Installs parallel-ssh
  • Installs expect
  • Installs wakeonlan

Create makeHeadNode make it executable:

touch /opt/cluster/makeHeadNode
chmod u+x /opt/cluster/makeHeadNode

The following bash script will install the necessary software to allow our head node to be the system used to deploy others, and configure the services provided by each package as it is installed:

# 
# /opt/cluster/makeHeadNode: A script to install necessary software to become the head node 
# used for node deployment. 
# Version 0.1 
# Author: geekshlby

CONFIG_DIR="/opt/cluster/config" 

if [ ! $(whoami) = "root" ]; then 
  printf "This script must run with root access.\n" 
  exit 192 
fi 

if [ -f $CONFIG_DIR/global.conf ]; then 
  source $CONFIG_DIR/global.conf 
else 
  printf "Unable to locate the global configuration file.\n" 
  printf "This script looks for configuration files in:\n" 
  printf "$CONFIG_DIR\n" 
  exit 192 
fi 
 
################################################## 
# Install packages on Head Node 
################################################## 
# Create the cluster user and prompt for password 
adduser --uid $NODE_USER_UID --home $NFS_HOME_EXPORT --gecos $NODE_USER $NODE_USER 
################################################## 
# SSH server 
tasksel install openssh-server 
# Debootstrap 
apt-get -y install debootstrap 
################################################## 
# Apt-mirror 
apt-get -y install apt-mirror 
# Since we don't know what release the apt-mirror package defaults to, 
# create the mirror list from scratch e.g. installing on intrepid the mirror list 
# was configured for hardy (this was later fixed in an updated intrepid package)
# after we have mirrored the repositories, we can point /etc/apt/sources.list to our local repository 
printf "set nthreads\t\n" > $MIRROR_LIST_FILE 
printf "set _tilde 0\n\n" >> $MIRROR_LIST_FILE 
printf "deb http://$OFFICIAL_MIRROR $RELEASE main restricted universe multiverse\n" >> $MIRROR_LIST_FILE 
printf "deb http://$OFFICIAL_MIRROR $RELEASE-updates main restricted universe multiverse\n" >> $MIRROR_LIST_FILE 
printf "deb http://$OFFICIAL_MIRROR $RELEASE-security main restricted universe multiverse\n" >> $MIRROR_LIST_FILE 
printf "deb http://$OFFICIAL_MIRROR $RELEASE main/debian-installer restricted/debian-installer universe/debian-installer multiverse/debian-installer" >> $MIRROR_LIST_FILE 
printf "deb http://$OFFICIAL_MIRROR $RELEASE-updates main/debian-installer universe/debian-installer\n">> $MIRROR_LIST_FILE 
printf "deb http://$OFFICIAL_MIRROR $RELEASE-security main/debian-installer\n\n" >> $MIRROR_LIST_FILE 
printf "clean http://$OFFICIAL_MIRROR\n" >> $MIRROR_LIST_FILE 
################################################## 
# TFTP Server 
apt-get -y install tftpd-hpa 
/etc/init.d/openbsd-inetd stop 
update-rc.d -f openbsd-inetd remove 
sed -i s/no/yes/ /etc/default/tftpd-hpa 
/etc/init.d/tftpd-hpa start 
################################################## 
# Syslinux 
apt-get -y install syslinux 
cp /usr/lib/syslinux/pxelinux.0 $TFTP_ROOT 
mkdir -p $TFTP_ROOT/pxelinux.cfg 
touch $DEFAULT_PXE_CONFIG_FILE 
################################################## 
# DHCP Server 
apt-get -y install dhcp3-server 
# Global options for DHCP that will apply to all client 
DDNS_STYLE="none" 
DEFAULT_LEASE_TIME="86400" 
MAX_LEASE_TIME="604800" 
TIME_OFFSET="-18000" 
AUTHORITATIVE="authoritative" 
LOG_FACILITY="local7" 
ALLOW_BOOT="booting" 
ALLOW_BOOTP="bootp" 
FILENAME="pxelinux.0" 
# Undiscovered nodes 
GET_LEASE_NAMES="on" 
USE_HOST_DECL_NAME="on" 
# Generate a new base dhcpd.conf 
printf "#Global options\n\n" > $DHCPD_CONFIG_FILE 
printf "ddns-update-style $DDNS_STYLE;\n" >> $DHCPD_CONFIG_FILE 
printf "option domain-name \"$DOMAIN_NAME\";\n" >> $DHCPD_CONFIG_FILE 
printf "option domain-name-servers $NAME_SERVER_IP;\n" >> $DHCPD_CONFIG_FILE 
printf "option ntp-servers $NTP_SERVER_IP;\n" >> $DHCPD_CONFIG_FILE 
printf "option routers $ROUTER_IP;\n" >> $DHCPD_CONFIG_FILE 
printf "option subnet-mask $SUBNET_MASK;\n" >> $DHCPD_CONFIG_FILE 
printf "option broadcast-address $BROADCAST;\n" >> $DHCPD_CONFIG_FILE 
printf "default-lease-time $DEFAULT_LEASE_TIME;\n" >> $DHCPD_CONFIG_FILE 
printf "max-lease-time $MAX_LEASE_TIME;\n" >> $DHCPD_CONFIG_FILE 
printf "option time-offset $TIME_OFFSET;\n" >> $DHCPD_CONFIG_FILE 
printf "$AUTHORITATIVE;\n" >> $DHCPD_CONFIG_FILE 
printf "log-facility $LOG_FACILITY;\n" >> $DHCPD_CONFIG_FILE 
printf "allow $ALLOW_BOOT;\n" >> $DHCPD_CONFIG_FILE 
printf "allow $ALLOW_BOOTP;\n" >> $DHCPD_CONFIG_FILE 
printf "filename \"$FILENAME\";\n" >> $DHCPD_CONFIG_FILE 
printf "next-server $TFTP_SERVER_IP;\n\n" >> $DHCPD_CONFIG_FILE 
printf "#Undiscovered nodes\n\n" >> $DHCPD_CONFIG_FILE 
printf "subnet $NETWORK netmask $SUBNET_MASK {\n" >> $DHCPD_CONFIG_FILE 
printf "\tget-lease-hostnames $GET_LEASE_NAMES;\n" >> $DHCPD_CONFIG_FILE 
printf "\tuse-host-decl-names $USE_HOST_DECL_NAME;\n" >> $DHCPD_CONFIG_FILE 
printf "\trange $DHCP_RANGE_START $DHCP_RANGE_STOP;\n" >> $DHCPD_CONFIG_FILE 
printf "}\n\n" >> $DHCPD_CONFIG_FILE 
printf "#Begin reservations for discovered nodes\n\n" >> $DHCPD_CONFIG_FILE 
/etc/init.d/dhcp3-server start 
################################################## 
# NTP Server 
apt-get -y install ntp 
sed -i s/server\ ntp.ubuntu.com/server\ us.pool.ntp.org/ /etc/ntp.conf 
sed -i '/us.pool.ntp.org/a server ntp.ubuntu.com\nrestrict us.pool.ntp.org mask 255.255.255.255 nomodify notrap noquery\nrestrict ntp.ubuntu.com mask 255.255.255.255 nomodify notrap noquery\nrestrict 10.10.1.0 mask 255.255.255.0 nomodify notrap' /etc/ntp.conf 
/etc/init.d/ntp restart 
################################################## 
# DNS Server 
apt-get -y install bind9 
printf "zone \"$DOMAIN_NAME\" {\n" > $DNS_CONFIG_FILE 
printf "\ttype master;\n" >> $DNS_CONFIG_FILE 
printf "\tnotify no;\n" >> $DNS_CONFIG_FILE 
printf "\tfile \"$DNS_FORWARD_CONFIG\";\n" >> $DNS_CONFIG_FILE 
printf "};\n\n" >> $DNS_CONFIG_FILE 
printf "zone \"1.10.10.in-addr.arpa\" {\n" >> $DNS_CONFIG_FILE 
printf "\ttype master;\n" >> $DNS_CONFIG_FILE 
printf "\tnotify no;\n" >> $DNS_CONFIG_FILE 
printf "\tfile \"$DNS_REVERSE_CONFIG\";\n" >> $DNS_CONFIG_FILE 
printf "};\n" >> $DNS_CONFIG_FILE 
# Config for forward zone 
printf ";\n; BIND data file for $DOMAIN_NAME domain\n;\n" > $DNS_FORWARD_CONFIG 
printf "\$TTL\t604800\n" >> $DNS_FORWARD_CONFIG 
printf "@\t\tIN\tSOA\t$HEAD_NODE.$DOMAIN_NAME.\t$DOMAIN_ADMIN.$DOMAIN_NAME. (\n" >> $DNS_FORWARD_CONFIG 
printf "\t\t\t\t1\t\t; Serial\n" >> $DNS_FORWARD_CONFIG 
printf "\t\t\t\t604800\t\t; Refresh\n" >> $DNS_FORWARD_CONFIG 
printf "\t\t\t\t86400\t\t; Retry\n" >> $DNS_FORWARD_CONFIG 
printf "\t\t\t\t2419200\t\t; Expire\n" >> $DNS_FORWARD_CONFIG 
printf "\t\t\t\t604800 )\t; Negative Cache TTL\n" >> $DNS_FORWARD_CONFIG 
printf ";\n" >> $DNS_FORWARD_CONFIG 
printf "\t\t\tNS\t$NAME_SERVER_NAME.$DOMAIN_NAME.\n" >> $DNS_FORWARD_CONFIG 
printf "\t\t\tMX\t10 $HEAD_NODE.$DOMAIN_NAME.\n" >> $DNS_FORWARD_CONFIG 
printf "@\t\tIN\tA\t$HEAD_NODE_IP\n" >> $DNS_FORWARD_CONFIG 
printf "$ROUTER_NAME\t\tIN\tA\t$ROUTER_IP\n" >> $DNS_FORWARD_CONFIG 
printf "$HEAD_NODE\t\tIN\tA\t$HEAD_NODE_IP\n" >> $DNS_FORWARD_CONFIG 
printf "$NAME_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$DHCP_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$NTP_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$NFS_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$MIRROR_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$NTP_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$PROXY_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$HTTP_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n" >> $DNS_FORWARD_CONFIG 
printf "$TFTP_SERVER_NAME\t\tIN\tCNAME\t$HEAD_NODE\n\n" >> $DNS_FORWARD_CONFIG 
# Generate names for undiscovered nodes 
printf ";Automatic name generation for undiscovered nodes\n" >> $DNS_FORWARD_CONFIG 
printf "\$GENERATE $(printf $DHCP_RANGE_START | cut -d. -f4)-$(printf $DHCP_RANGE_STOP | cut -d. -f4) dhcp-\$\tIN\tA\t$(printf $NETWORK | sed 's\0$\\')\$\n\n" >> $DNS_FORWARD_CONFIG 
printf ";Discovered nodes\n" >> $DNS_FORWARD_CONFIG 
# Config for reverse zone 
printf ";\n; BIND reverse data file for $DOMAIN_NAME domain\n;\n" > $DNS_REVERSE_CONFIG printf "\$TTL\t604800\n" >> $DNS_REVERSE_CONFIG 
printf "@\t\tIN\tSOA\t$NAME_SERVER_NAME.$DOMAIN_NAME.\t$DOMAIN_ADMIN.$DOMAIN_NAME. (\n" >> $DNS_REVERSE_CONFIG 
printf "\t\t\t\t1\t\t; Serial\n" >> $DNS_REVERSE_CONFIG 
printf "\t\t\t\t604800\t\t; Refresh\n" >> $DNS_REVERSE_CONFIG 
printf "\t\t\t\t86400\t\t; Retry\n" >> $DNS_REVERSE_CONFIG 
printf "\t\t\t\t2419200\t\t; Expire\n" >> $DNS_REVERSE_CONFIG 
printf "\t\t\t\t604800 )\t; Negative Cache TTL\n" >> $DNS_REVERSE_CONFIG 
printf ";\n" >> $DNS_REVERSE_CONFIG 
printf "\t\tIN\tNS\t$NAME_SERVER_NAME.$DOMAIN_NAME.\n" >> $DNS_REVERSE_CONFIG 
printf "$(printf $ROUTER_IP | cut -d. -f4)\t\tIN\tPTR\t$ROUTER_NAME.$DOMAIN_NAME.\n" >> $DNS_REVERSE_CONFIG 
printf "$(printf $HEAD_NODE_IP | cut -d. -f4)\t\tIN\tPTR\t$HEAD_NODE.$DOMAIN_NAME.\n\n" >> $DNS_REVERSE_CONFIG 
# Generate reverse names for undiscovered nodes 
printf ";Automatic name generation for undiscovered nodes\n" >> $DNS_REVERSE_CONFIG 
printf "\$GENERATE $(printf $DHCP_RANGE_START | cut -d. -f4)-$(printf $DHCP_RANGE_STOP | cut -d. -f4) \$\t\tIN\tPTR\tdhcp-\$.$DOMAIN_NAME.\n\n"  >> $DNS_REVERSE_CONFIG 
printf ";Discovered nodes\n" >> $DNS_REVERSE_CONFIG 
/etc/init.d/bind9 restart 
#Make ourself the resolver 
printf "domain $DOMAIN_NAME\n" > /etc/resolv.conf 
printf "search $DOMAIN_NAME\n" >> /etc/resolv.conf 
printf "nameserver $NAME_SERVER_IP\n" >> /etc/resolv.conf 
################################################## 
# NFS Server 
apt-get -y install nfs-kernel-server 
mkdir -p $NFS_ROOT_EXPORT 
printf "$NFS_ROOT_EXPORT\t\t$NETWORK/24(rw,sync,no_root_squash,no_subtree_check)\n" > $NFS_CONFIG_FILE 
printf "$NFS_HOME_EXPORT\t\t$NETWORK/24(rw,sync,no_root_squash,no_subtree_check)\n" >> $NFS_CONFIG_FILE 
exportfs -a 
################################################## 
# Web Server 
tasksel install lamp-server 
ln -s /var/spool/apt-mirror/mirror/us.archive.ubuntu.com/ubuntu /var/www/ubuntu 
################################################## 
# Create an empty node list 
> $MASTER_NODE_LIST 
> $NEW_NODES_LIST 
################################################## 
# Install parallel-ssh 
apt-get -y install pssh 
for PUSHTOPLACE in /root /srv/cluster; do 
        pushd $PUSHTOPLACE 
        printf "alias /usr/bin/parallel-ssh='pssh -h /opt/cluster/config/hosts.txt'\n" >> $PUSHTOPLACE/.bashrc 
        printf "alias /usr/bin/parallel-scp='pscp -h /opt/cluster/config/hosts.txt'\n" >> $PUSHTOPLACE/.bashrc 
        printf "alias /usr/bin/parallel-rsync='prsync -h /opt/cluster/config/hosts.txt'\n" >> $PUSHTOPLACE/.bashrc 
        printf "alias /usr/bin/parallel-nuke='pnuke -h /opt/cluster/config/hosts.txt'\n" >> $PUSHTOPLACE/.bashrc 
        printf "alias /usr/bin/parallel-slurp='pslurp -h /opt/cluster/config/hosts.txt'\n" >> $PUSHTOPLACE/.bashrc 
        popd 
done
################################################## 
# Install expect 
apt-get -y install expect 

exit 0

Note(1) Apt-mirror is a tool which will allow you to maintain a local mirror of the Ubuntu repositories. You will be able to make the mirror available via HTTP, FTP, NFS, etc. In our will use HTTP which will require the installation of a Web Server. Mirroring the repository (to include main, updates, multiverse, universe, and restricted for the amd64 architecture of a single release will require approximately 24 GB of space. The length of time required for the mirror process to complete is dependent upon several factors, one of which is bandwidth. It took me approximately 2.5 days via DSL. Apt-mirror is not a requirement for this exercise, however, greatly reduces the length of time to deploy an Ubuntu system. I recommend apt-mirror to be installed. If you choose to use apt-mirror, you can update /etc/apt/sources.list to point to the local repository. This can be included in the makeHeadNode script.

Note(2) The entire LAMP stack is not needed. Since we will be providing the Ubuntu repositories via HTTP as well as the preseed configuration file, all that is needed is Apache. I prefer the LAMP stack as it provides a multitude of possibilities. Some of which will be appended to the end of this document.

Now that our prerequisite software is installed and configured will will create a base installation for use by disk-less nodes.

AutomatedNodeDeployment (last edited 2017-09-03 16:43:02 by ckimes)