Skip to content

Instantly share code, notes, and snippets.

@ricardo-rossi
Created September 17, 2014 14:31
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ricardo-rossi/8132ce0577c15ee5adfa to your computer and use it in GitHub Desktop.
Save ricardo-rossi/8132ce0577c15ee5adfa to your computer and use it in GitHub Desktop.
StackScript (LAMP)
#!/bin/bash
# This block defines the variables the user of the script needs to input
# when deploying using this script.
#
# <UDF name="hostname" label="The hostname for the new Linode.">
# <UDF name="username" label="Add a user account to add to sudo">
# <UDF name="password" label="The sudo user's password">
# <UDF name="db_password" Label="MySQL root Password" />
# <UDF name="db_name" Label="Database Name" default="" example="Create this database" />
# <UDF name="db_name2" Label="Database 2 Name" default="" example="Create this database" />
# <UDF name="db_user" Label="MySQL Username" default="" example="Create this user" />
# <UDF name="db_user_password" Label="MySQL Username Password" default="" example="User's password" />
source <ssinclude StackScriptID=1>
source <ssinclude StackScriptID=10306>
$IPADDR = system_primary_ip
system_update
system_set_hostname "$HOSTNAME"
# This section sets hosts file.
echo 127.0.0.1 $HOSTNAME >> /etc/hosts
set_timezone_central
user_add_sudo "$USERNAME" "$PASSWORD"
postfix_install_loopback_only
mysql_install "$DB_PASSWORD" && mysql_tune 40
mysql_create_database "$DB_PASSWORD" "$DB_NAME"
mysql_create_database "$DB_PASSWORD" "$DB_NAME2"
mysql_create_user "$DB_PASSWORD" "$DB_USER" "$DB_USER_PASSWORD"
mysql_grant_user "$DB_PASSWORD" "$DB_USER" "$DB_NAME"
mysql_grant_user "$DB_PASSWORD" "$DB_USER" "$DB_NAME2"
php_install_with_apache && php_tune
apache_install && apache_tune 40
goodstuff
utilities
restartServices
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment