Skip to content

Instantly share code, notes, and snippets.

@w0ng
Forked from fideloper/install.sh
Last active August 29, 2015 14:12
Show Gist options
  • Save w0ng/710bcb554caf1801f61d to your computer and use it in GitHub Desktop.
Save w0ng/710bcb554caf1801f61d to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo "========================"
echo "Installing base items..."
echo "========================"
apt-get update
apt-get install -y build-essential curl wget python-software-properties mlocate
echo "======================================"
echo "Presetting MySQL password to 'root'..."
echo "======================================"
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
echo "==================================="
echo "Installing Apache, PHP and MySQL..."
echo "==================================="
apt-get install -y git-core php5 apache2 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-mcrypt php5-ldap mysql-server
echo "====================="
echo "Configuring Apache..."
echo "====================="
a2enmod rewrite
mv /etc/apache2/sites-available/default /etc/apache2/sites-available/default.bak
cat <<EOF > /etc/apache2/sites-available/default
<VirtualHost *:80>
ServerAdmin webmaster@localhost
RewriteEngine On
DocumentRoot /vagrant/public
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /vagrant/public>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([^\.]+)$ \$1.php [NC,L]
</Directory>
ErrorLog \${APACHE_LOG_DIR}/error.log
LogLevel warn
CustomLog \${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
EOF
echo "=================="
echo "Configuring PHP..."
echo "=================="
sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
echo "===================="
echo "Installing xdebug..."
echo "===================="
apt-get install -y php5-xdebug
cat << EOF | tee -a /etc/php5/conf.d/xdebug.ini
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
EOF
echo "======================"
echo "Installing Composer..."
echo "======================"
curl -sS https://getcomposer.org/installer | php
mv composer.phar /usr/local/bin/composer
echo "================="
echo "Installing vim..."
echo "================="
apt-get install -y vim
curl -o /home/vagrant/.vimrc https://gist.githubusercontent.com/w0ng/7e3f41b75c50fa3eb984/raw/8024565a584c1307e033589d71195c628ffb3699/.vimrc
echo "====================="
echo "Finalising changes..."
echo "====================="
service apache2 restart
updatedb
echo "====="
echo "DONE!"
echo "====="
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment