Skip to content

Instantly share code, notes, and snippets.

@ianlandsman
Created January 11, 2014 03:24
Show Gist options
  • Save ianlandsman/8366575 to your computer and use it in GitHub Desktop.
Save ianlandsman/8366575 to your computer and use it in GitHub Desktop.
Taylor's virtual box setup
#!/usr/bin/env bash
# Upgrade Base Packages
sudo apt-get update
sudo apt-get upgrade -y
# Install Web Packages
sudo apt-get install -y build-essential dkms re2c apache2 php5 php5-dev php-pear php5-xdebug php5-apcu php5-json php5-sqlite \
php5-mysql php5-pgsql php5-gd curl php5-curl memcached php5-memcached libmcrypt4 php5-mcrypt postgresql redis-server beanstalkd \
openssh-server git vim python2.7-dev
# Install Fabric & Hipchat Plugin
sudo apt-get install python-pip
sudo pip install fabric
sudo pip install python-simple-hipchat
# Install MySQL
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password secret'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password secret'
sudo apt-get -y install mysql-server
# Configure Postgres
sudo sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/g" /etc/postgresql/9.1/main/postgresql.conf
echo "host all all 10.0.2.2/32 md5" | sudo tee -a /etc/postgresql/9.1/main/pg_hba.conf
sudo -u postgres psql -c "CREATE ROLE taylor LOGIN UNENCRYPTED PASSWORD 'secret' SUPERUSER INHERIT NOCREATEDB NOCREATEROLE NOREPLICATION;"
sudo -u postgres /usr/bin/createdb --echo --owner=taylor laravel
sudo service postgresql restart
# Configure MySQL
sudo sed -i '/^bind-address/s/bind-address.*=.*/bind-address = 10.0.2.15/' /etc/mysql/my.cnf
mysql -u root -p mysql -e "GRANT ALL ON *.* TO root@'10.0.2.2' IDENTIFIED BY 'secret';"
sudo service mysql restart
# Configure Mcrypt (Ubuntu 13.10)
sudo ln -s /etc/php5/conf.d/mcrypt.ini /etc/php5/mods-available
sudo php5enmod mcrypt
sudo service apache2 restart
# Generate SSH Key
mkdir .ssh
cd .ssh
ssh-keygen -f id_rsa -t rsa -N ''
cd ~
# Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Install PHPUnit
sudo pear config-set auto_discover 1
sudo pear install pear.phpunit.de/phpunit
# Install Mailparse (For Snappy)
sudo pecl install mailparse
echo "extension=mailparse.so" | sudo tee -a /etc/php5/apache2/php.ini
# Enable PHP Error Reporting
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/apache2/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL/" /etc/php5/cli/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/cli/php.ini
sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php5/cli/php.ini
# Create Scripts Directory
mkdir ~/Scripts
mkdir ~/Scripts/PhpInfo
# Download Serve Script
wget -O ~/Scripts/serve.sh https://gist.github.com/taylorotwell/8366252/raw/d2a2af596f362b691e7008326c04aee1fd33d9b6/Ubuntu+Serve+Script
# Download Bash Aliases
wget -O ~/.bash_aliases https://gist.github.com/taylorotwell/8366284/raw/222738eb5d43f02450c354827047a6659d0a3aef/bash-aliases
# Build PHP Info Site
echo "<?php phpinfo();" > ~/Scripts/PhpInfo/index.php
# Configure Apache Hosts
sudo a2enmod rewrite
echo "127.0.0.1 info.app" | sudo tee -a /etc/hosts
vhost="<VirtualHost *:80>
ServerName info.app
DocumentRoot /home/taylor/Scripts/PhpInfo
<Directory \"/home/taylor/Scripts/PhpInfo\">
Order allow,deny
Allow from all
Require all granted
AllowOverride All
</Directory>
</VirtualHost>"
echo "$vhost" | sudo tee /etc/apache2/sites-available/info.app.conf
sudo a2ensite info.app
sudo /etc/init.d/apache2 restart
# VirtualBox Guest Additions
sudo mount /dev/cdrom /media/cdrom
sudo sh /media/cdrom/VBoxLinuxAdditions.run
sudo usermod -aG vboxsf www-data
sudo usermod -aG vboxsf taylor
sudo reboot
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment