Skip to content

Instantly share code, notes, and snippets.

@ericjeker ericjeker/install.sh Secret
Last active Jul 5, 2016

Embed
What would you like to do?
Vagrant shell provision file
#!/usr/bin/env bash
# Update the package list
sudo apt-get update
sudo apt-get upgrade -y
# Install more recent PPA (do not do that except you are sure of what you are doing)
sudo apt-get install -y python-software-properties
sudo apt-add-repository ppa:chris-lea/node.js
#sudo apt-add-repository ppa:rwky/redis -y
sudo apt-add-repository ppa:ondrej/php5 -y
sudo apt-get update
# Install basic packages
sudo apt-get install -y python g++ make git subversion curl
sudo ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime
# Install PHP and Web server related modules
sudo apt-get install -y php5 apache2 libapache2-mod-php5 php5-curl php5-gd php5-mcrypt php5-mysql php5-sqlite php5-xdebug php5-imagick php5-dev
## Enable mode rewrite
sudo a2enmod rewrite
## Change a few PHP settings
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL \& \~E_DEPRECATED/" /etc/php5/apache2/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/apache2/php.ini
sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php5/apache2/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = \"Europe/Zurich\"/" /etc/php5/apache2/php.ini
sudo sed -i "s/short_open_tag.*/short_open_tag = On/" /etc/php5/apache2/php.ini
sudo sed -i "s/error_reporting = .*/error_reporting = E_ALL \& \~E_DEPRECATED/" /etc/php5/cli/php.ini
sudo sed -i "s/display_errors = .*/display_errors = On/" /etc/php5/cli/php.ini
sudo sed -i "s/disable_functions = .*/disable_functions = /" /etc/php5/cli/php.ini
sudo sed -i "s/memory_limit = .*/memory_limit = 512M/" /etc/php5/cli/php.ini
sudo sed -i "s/;date.timezone.*/date.timezone = \"Europe/Zurich\"/" /etc/php5/apache2/php.ini
sudo sed -i "s/short_open_tag.*/short_open_tag = On/" /etc/php5/cli/php.ini
## Configure XDebug
cat << EOF | sudo tee -a /etc/php5/mods-available/xdebug.ini
xdebug.cli_color = 1
xdebug.remote_connect_back=0
xdebug.remote_port=9000
xdebug.remote_enable=1
xdebug.remote_host=192.168.1.150
xdebug.show_exception_trace = 0
xdebug.profiler_enable_trigger = 1
xdebug.profiler_output_name = cachegrind.out.%H.%t
xdebug.trace_enable_trigger = 1
EOF
## Apache Restart
sudo service apache2 restart
# Install MySQL
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'
sudo apt-get install -y mysql-server
## Allow remote access
sudo sed -i "s/^bind-address.*/\#bind-address/" /etc/mysql/my.cnf
sudo service mysql restart
# Install and configure Sendmail
sudo apt-get install -y sendmail
sudo hostname precise64.localdomain
sudo sed -i "s/^127\.0\.1\.1\tprecise64.*/127\.0\.1\.1\tprecise64 precise64.localdomain/" /etc/hosts
# Install Composer
curl -sS https://getcomposer.org/installer | php
sudo mv composer.phar /usr/local/bin/composer
# Install Node.js and Gulp
sudo apt-get install -y nodejs npm
sudo npm install -g gulp
# Install Redis, Beanstalkd
#apt-get install -y redis-server memcached beanstalkd
# Configure Beanstalkd
#sudo sed -i "s/#START=yes/START=yes/" /etc/default/beanstalkd
#sudo /etc/init.d/beanstalkd start
# Install ZSH and Oh-my-zsh
sudo apt-get install -y zsh
cd /home/vagrant
curl -L http://install.ohmyz.sh | sh
sudo sed -i "s/^ZSH_THEME=\".*\"/ZSH_THEME=\"afowler\"/" /home/vagrant/.zshrc
# Bug 4.3.10 Guest Additions
sudo ln -s /opt/VBoxGuestAdditions-4.3.10/lib/VBoxGuestAdditions /usr/lib/VBoxGuestAdditions
@ericjeker

This comment has been minimized.

Copy link
Owner Author

commented May 18, 2014

Help setup a Vagrant with PHP5, MySql, etc... following the tutorial from JeffreyWay.

I have added a few XDebug configuration following Juan Treminio, support for MySQL distant connection removing the bind-address (do not do that in production env !) and added ZSH support.

@ericjeker

This comment has been minimized.

Copy link
Owner Author

commented Jul 23, 2014

To avoid problems with the guest additions, with the 4.3.10 version, install the Vagrant VBGuest Plugin.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.