% begin_ohpc_run
% ohpc_comment_header Complete basic Warewulf setup for master node \ref{sec:setup_ww}
%\begin{verbatim}

\begin{lstlisting}[language=bash,literate={-}{-}1,keywords={},upquote=true,keepspaces]
# Configure Warewulf provisioning to use desired internal interface
[sms](*\#*) perl -pi -e "s/device = eth1/device = ${sms_eth_internal}/" /etc/warewulf/provision.conf

# Configure DHCP server to use desired internal interface
[sms](*\#*) perl -pi -e "s/^DHCPD_INTERFACE=\S+/DHCPD_INTERFACE=${sms_eth_internal}/" /etc/sysconfig/dhcpd

# Configure Warewulf to use the default SLES tftp location
[sms](*\#*) perl -pi -e "s#\#tftpdir = /var/lib/#tftpdir = /srv/#" /etc/warewulf/provision.conf

# Configure Warewulf to use the correct certificate bundle
[sms](*\#*) perl -pi -e "s,cacert =.*,cacert = /etc/ssl/ca-bundle.pem," /etc/warewulf/provision.conf

# Update Warewulf http configuration to use the SLES version of Apache modules
[sms](*\#*) export MODFILE=/etc/apache2/conf.d/warewulf-httpd.conf
[sms](*\#*) perl -pi -e "s#modules/mod_perl.so\$#/usr/lib64/apache2/mod_perl.so#" $MODFILE
[sms](*\#*) perl -pi -e "s#modules/mod_version.so\$#/usr/lib64/apache2/mod_version.so#" $MODFILE

# Enable internal interface for provisioning
[sms](*\#*) ip link set dev ${sms_eth_internal} up
[sms](*\#*) ip address add ${sms_ip}/${internal_netmask} broadcast + dev ${sms_eth_internal}

# Enable Apache mod_rewrite module (needed for warewulf)
[sms](*\#*) a2enmod mod_rewrite
# Restart/enable relevant services to support provisioning
[sms](*\#*) systemctl enable mysql.service
[sms](*\#*) systemctl restart mysql
[sms](*\#*) systemctl enable apache2.service
[sms](*\#*) systemctl restart apache2
[sms](*\#*) systemctl enable dhcpd.service
[sms](*\#*) systemctl enable tftp.socket
[sms](*\#*) systemctl start tftp.socket
\end{lstlisting}
%\end{verbatim}
% end_ohpc_run
