Extended LAMP

by petehalverson
30 deployments · 20 still active · last rev. 3 years ago

Compatible with: No distros currently supported
						#!/bin/bash
#
# Extended LAMP Stack
#
# Copyright (c) 2012 Aspen Digital / Peter Halverson <pete@aspendigital.com>
# All rights reserved.
#
# Code references:
#
# StackScript Bash Library
# Copyright (c) 2010 Linode LLC / Christopher S. Aker <caker@linode.com>
# All rights reserved.
#

###########################################################
# UDF SETUP
###########################################################

# <UDF name="domain" Label="Domain" example="i.e. aspendigital.com" />
# <UDF name="hostname" Label="Hostname" example="i.e. zwei" />
# <UDF name="db_password" Label="MySQL root Password" />
# <UDF name="timezone" label="Server Timezone" oneOf="Mountain,Pacific,Eastern,Central" />


source <ssinclude StackScriptID="1">
source <ssinclude StackScriptID="5166">

touch /tmp/ss-log
echo "StackScript started..." >> /tmp/ss-log
echo "System update..." >> /tmp/ss-log
system_update

echo "Setting hostname..." >> /tmp/ss-log
set_hostname "$HOSTNAME" "$DOMAIN"

echo "Installing postfix..." >> /tmp/ss-log
postfix_install_hostname_support "$HOSTNAME" "$DOMAIN"

echo "Setting up Firewall..." >> /tmp/ss-log
firewall_setup

echo "Installing MySQL..." >> /tmp/ss-log
mysql_install "$DB_PASSWORD"
# should add mysql_secure_installation some time
echo " -- Complete. Run 'mysql_secure_installation' post install --" >> /tmp/ss-log

echo "Installing PHP and required modules..." >> /tmp/ss-log
php_install_with_apache_extended && php_secure_tune

echo "Installing and tuning Apache..." >> /tmp/ss-log
apache_install && apache_tune 40 && apache_virtualhost "$DOMAIN"

echo "Setting up logrotate for virtual hosts..." >> /tmp/ss-log
virtualhost_logrotate

echo "Installing OpenSSL..." >> /tmp/ss-log
aptitude -y install openssl

echo "Installing Fail2ban..." >> /tmp/ss-log
fail2ban_setup

echo "Installing other niceties" >> /tmp/ss-log
goodstuff

echo "Enabling rewrite..." >> /tmp/ss-log
a2enmod rewrite

echo "Setting timezone..." >> /tmp/ss-log
ln -sf /usr/share/zoneinfo/US/$TIMEZONE /etc/localtime

echo "Restarting Services..." >> /tmp/ss-log
restartServices

echo "StackScript Complete." >> /tmp/ss-log