Skip to content

Instantly share code, notes, and snippets.

@tobiassjosten
Created April 8, 2010 19:20
Show Gist options
  • Save tobiassjosten/360429 to your computer and use it in GitHub Desktop.
Save tobiassjosten/360429 to your computer and use it in GitHub Desktop.
#!/bin/bash
###############################################################################
## INITIALIZATION
if [ $(whoami) != "root" ]; then
echo "[*] You must be root to run this setup script!"
exit
fi
# Setup MySQL password
MYSQL_ROOT_PASS_CONFIRM="-----"
until [ "$MYSQL_ROOT_PASS" = "$MYSQL_ROOT_PASS_CONFIRM" ]; do
echo "Enter MySQL Root password:"
read -s MYSQL_ROOT_PASS
echo "Confirm MySQL Root password:"
read -s MYSQL_ROOT_PASS_CONFIRM
if [ "$MYSQL_ROOT_PASS" != "$MYSQL_ROOT_PASS_CONFIRM" ]; then
echo "[*] MySQL Root passwords entered don't match!"
fi
done
echo -e "[*] Passwords matched and saved!\n"
# Setup pubkey
while [[ -z $PUBKEY || $PUBKEY_CONFIRM != [Yy] ]]; do
echo "Enter your public key:"
read PUBKEY
echo "[*] Public key: $PUBKEY"
PUBKEY_CONFIRM=""
while [[ $PUBKEY_CONFIRM != [YyNn] ]]; do
echo "Is that correct? (Y/N):"
read PUBKEY_CONFIRM
if [[ $PUBKEY_CONFIRM = [Nn] ]]; then
PUBKEY=""
fi
done
done
# Update Aptitude repo
aptitude update
###############################################################################
## INSTALLATION
aptitude -y install bash-completion wget curl
# Unstall MySQL non-interactively
export DEBIAN_FRONTEND=noninteractive; aptitude -q -y install mysql-server mysql-client
# Install Apache 2.0
aptitude -y install apache2
# Install PHP 5
aptitude -y install libapache2-mod-php5 php5 php5-common php5-curl php5-dev php5-gd php5-imagick php5-mcrypt php5-memcache php5-mhash php5-mysql php5-cli php-apc php-pear
# Install Git
aptitude -y install git-core gitosis
# Install Postfix
aptitude -y install postfix
# Drush 2.1
cd /opt
wget http://ftp.drupal.org/files/projects/drush-All-versions-3.0-beta1.tar.gz
tar zxf drush-All-versions-3.0-beta1.tar.gz
rm -f drush-All-versions-3.0-beta1.tar.gz
ln -s /opt/drush/drush /usr/local/bin/
###############################################################################
## CONFIGURATION
# .bashrc (prompt colors, bash completion)
# .bash_aliases
# MySQL configuration
mysqladmin -u root password $MYSQL_ROOT_PASS
# Apache configuration
a2enmod rewrite
a2enmod expires
echo 'ServerName 127.0.0.1' > /etc/apache2/httpd.conf
/etc/init.d/apache2 restart
# Apache scripts (a2restart, a2reload)
# PHP configuration
pecl install uploadprogress
echo 'extension=uploadprogress.so'>/etc/php5/conf.d/uploadprogress.ini
# Gitosis configuration
echo $PUBKEY | sudo -H -u gitosis gitosis-init
# Default site as Kollegorna splash
# Postfix configuration
postconf -e "myhostname = DOMAIN"
postconf -e "mydomain = DOMAIN"
postconf -e "mydestination = DOMAIN, localhost"
# Drupal cron
#skapa /usr/local/bin/drupal-cron
#chmod +x drupal-cron
#skapa /etc/cron.d/drupal-cron
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment