Skip to content

Instantly share code, notes, and snippets.

@ceesvanegmond
Created April 2, 2014 10:33
Show Gist options
  • Save ceesvanegmond/9931664 to your computer and use it in GitHub Desktop.
Save ceesvanegmond/9931664 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
echo ">>> Starting Install Script"
# Update
sudo apt-get update
echo "--- MySQL time ---"
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
sudo debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'
echo ">>> Installing Base Items"
# Install base items
sudo apt-get install -y vim tmux curl wget build-essential python-software-properties
echo ">>> Adding PPA's and Installing Server Items"
# Add repo for latest PHP
sudo add-apt-repository -y ppa:ondrej/php5
# Update Again
sudo apt-get update
# Install the Rest
sudo apt-get install -y git-core php5 apache2 libapache2-mod-php5 php5-mysql php5-curl php5-gd php5-mcrypt php5-xdebug mysql-server
echo ">>> Configuring Server"
# xdebug Config
cat > $(find /etc/php5 -name xdebug.ini) << EOF
zend_extension=$(find /usr/lib/php5 -name xdebug.so)
xdebug.remote_enable = 1
xdebug.remote_connect_back = 1
xdebug.remote_port = 9000
xdebug.scream=1
xdebug.cli_color=1
xdebug.show_local_vars=1
; var_dump display
xdebug.var_display_max_depth = 5
xdebug.var_display_max_children = 256
xdebug.var_display_max_data = 1024
EOF
# Apache Config
sudo a2enmod rewrite actions ssl
curl -L https://gist.githubusercontent.com/fideloper/2710970/raw/vhost.sh > vhost
sudo chmod guo+x vhost
sudo mv vhost /usr/local/bin
# Create a virtualhost to start, with SSL certificate
sudo vhost -s $1.xip.io -d $public_folder -p /etc/ssl/xip.io -c xip.io
# PHP Config
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
sudo service apache2 restart
git config --global user.name "Cees van Egmond"
git config --global user.email 'cees.vanegmond@wearejust.com'
echo ">>> Installing Oh-My-Zsh"
# Install zsh
sudo apt-get install -y zsh
# Install oh-my-zsh
sudo su - vagrant -c 'wget https://github.com/robbyrussell/oh-my-zsh/raw/master/tools/install.sh -O - | zsh'
# Set to "blinks" theme which
# uses Solarized and shows user/host
sudo sed -i 's/ZSH_THEME="robbyrussell"/ZSH_THEME="cloud"/' /home/vagrant/.zshrc
# Add /sbin to PATH
sudo sed -i 's=:/bin:=:/bin:/sbin:/usr/sbin:=' /home/vagrant/.zshrc
# Change vagrant user's default shell
chsh vagrant -s $(which zsh);
#Change password to nothing
mysqladmin -u root -p'root' password ''
echo ">>> Installing Composer"
# Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "precise32"
config.vm.box_url = "http://files.vagrantup.com/precise32.box"
config.vm.hostname = "vagrant"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.provision :shell, :path => "install.sh"
config.vm.synced_folder ".", "/vagrant",
:nfs => true,
:mount_options => ['actimeo=2']
# If using VirtualBox
config.vm.provider :virtualbox do |vb|
# Set server memory
vb.customize ["modifyvm", :id, "--memory", "1024"]
end
# If true, then any SSH connections made will enable agent forwarding.
# Default value: false
# config.ssh.forward_agent = true
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
# config.vm.synced_folder "../data", "/vagrant_data"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment