Skip to content

Instantly share code, notes, and snippets.

@technosailor
Created July 26, 2012 19:44
Show Gist options
  • Save technosailor/3184085 to your computer and use it in GitHub Desktop.
Save technosailor/3184085 to your computer and use it in GitHub Desktop.
#!/bin/bash
WP_STABLE='3.4.1'
# Make file structure
mkdir /var/www/$1
chown -R www-data:www-data /var/www/$1
chmod 755 /var/www
# Install WordPress latest stable
svn --force export http://svn.automattic.com/wordpress/tags/$WP_STABLE /var/www/$1
# Deploy vhost
cp /etc/apache2/sites-available/default /etc/apache2/sites-available/$1
sed "2a \\\tServerName $1" /etc/apache2/sites-available/$1 > /etc/apache2/sites-available/$1.new
sed "s/DocumentRoot \/var\/www/DocumentRoot \/var\/www\/$1/" /etc/apache2/sites-available/$1.new > /etc/apache2/sites-available/$1
rm -f /etc/apache2/sites-available/$1.new
a2ensite $1
service apache2 restart
OS=`uname`
IO="" # store IP
case $OS in
Linux) IP=`ifconfig | grep 'inet addr:'| grep -v '127.0.0.1' | cut -d: -f2 | awk '{ print $1}'`;;
FreeBSD|OpenBSD) IP=`ifconfig | grep -E 'inet.[0-9]' | grep -v '127.0.0.1' | awk '{ print $2}'` ;;
SunOS) IP=`ifconfig -a | grep inet | grep -v '127.0.0.1' | awk '{ print $2} '` ;;
*) IP="Unknown";;
esac
echo "If you haven't switched DNS, add to your local hosts file"
echo "$IP $1 www.$1"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment