New LAMP Server

by mgedzius
2 deployments · 2 still active · last rev. 4 months ago

Compatible with: Ubuntu 14.04 LTS
						#!/bin/bash
# <UDF name="hostname" Label="System Hostname" />
# <UDF name="admin_user" Label="SysAdmin's Username" />
# <UDF name="admin_pass" Label="SysAdmin's Password" />
# <UDF name="admin_pubkey" Label="SysAdmin's pubkey" />
# <UDF name="ssh_port" Label="SSH PORT" />
# <UDF name="db_password" Label="MySQL root Password" />
# <UDF name="db_name" Label="Create Database" default="" example="Optionally create this database" />
# <UDF name="db_user" Label="Create MySQL User" default="" example="Optionally create this user" />
# <UDF name="db_user_password" Label="MySQL User's Password" default="" example="User's password" />


source <ssinclude StackScriptID="1">

system_update
system_set_hostname "$HOSTNAME"
system_add_host_entry system_primary_ip

user_add_sudo "$ADMIN_USER" "$ADMIN_PASS"
user_add_pubkey "$ADMIN_USER" "$ADMIN_PUBKEY"
ssh_disable_root
sed -i 's/#PubkeyAuthentication yes/PubkeyAuthentication yes/' /etc/ssh/sshd_config
sed -i 's/PasswordAuthentication yes/PasswordAuthentication no/' /etc/ssh/sshd_config
postfix_install_loopback_only
mysql_install "$DB_PASSWORD" && mysql_tune 40
mysql_create_database "$DB_PASSWORD" "$DB_NAME"
mysql_create_user "$DB_PASSWORD" "$DB_USER" "$DB_USER_PASSWORD"
mysql_grant_user "$DB_PASSWORD" "$DB_USER" "$DB_NAME"
php_install_with_apache && php_tune
apache_install && apache_tune 40 && apache_virtualhost_from_rdns && apache_virtualhost 
goodstuff
restartServices