LEMP 12.04

by obs
410 deployments · 116 still active · last rev. 3 years ago

Install nginx, various useful tools such as shorewall, logwatch etc as well as optionally installing mysql and php-fpm

Compatible with: No distros currently supported
						#!/bin/bash
######
#LICENCE#
######
#Released under the BSD license http://www.opensource.org/licenses/bsd-license
#Copyright (c) 2011, Rowan Wookey <admin@rwky.net>
#All rights reserved.
#
#Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
#
#1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
#2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
#3. Neither the name of the <ORGANIZATION> nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.
#THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
######
#<udf name="INSTALL_MYSQL" label="Instal MySQL?" oneOf="Yes,No">
#<udf name="MYSQL_PASSWORD" label="MySQL root password" default="">
#<udf name="NGINX_VERSION" label="Install nginx from PPA" oneOf="Yes,No,None" example="See https://launchpad.net/~nginx/+archive/stable">
#<udf name="SSH_PORT" label="SSH port" default="22">
#<udf name="USER_NAME" label="Unprivileged User Account" />
#<udf name="USER_PASSWORD" label="Unprivileged User Password" />
#<udf name="USER_SSHKEY" label="Public Key for User" default="" />
#<udf name="SSH_ALLOW_USERS" label="SSH Allow Users directive, leave blank if you don't know what this is" default="" />
#<udf name="ROOT_EMAIL" label="Email alias for root" />
#<udf name="HOSTNAME" label="Hostname" default="" />
#<udf name="WHICHKERNEL" label="Use ubuntu virtual kernel?" oneOf="No,Yes" />
#<udf name="INSTALL_PHP" label="Install PHP?" oneOf="Yes,No" />
######
#Support
######
#For support please email admin@rwky.net
#######


source <ssinclude StackScriptID="4746">

#update system and set hostname
prep_system

#setup firewall
install_shorewall

#setup standard user
configure_user

#secure ssh
configure_ssh

#setup postfix
install_postfix

if [ "$INSTALL_MYSQL" == "Yes" ]
then
#setup mysql
install_mysql
fi

if [ "$INSTALL_PHP" == "Yes" ]
then
#setup php
install_php_fpm
fi

if [ "$NGINX_VERSION" != "None" ]
then
#setup nginx
install_nginx
fi

#install monit/munin/security tools/other tools
install_monit
install_munin
install_security
install_tools

#install stock kernel
#this requires user interaction
if [ "$WHICHKERNEL" == "Yes" ]
then
install_ubuntu_stock_kernel
fi

#set root .profile
set_root_profile

#cleanup
cleanup

#send notification
notification_email