Created
July 8, 2015 12:58
-
-
Save flackend/8f0bd097edf87f5462eb to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # Used to log info to stdout | |
| function console_log() { | |
| echo -e "\x1B[34m--- $1\x1B[0m\n" | |
| } | |
| # | |
| # Install Apache | |
| # | |
| # @link https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu | |
| console_log "Updating apt-get local package database" | |
| sudo apt-get update > /dev/null | |
| console_log "Installing Apache" | |
| sudo apt-get install -y apache2 > /dev/null | |
| # Remove sites directories | |
| sudo rm -fr /etc/apache2/sites-available /etc/apache2/sites-enabled | |
| # Remove unneeded conf files | |
| sudo rm /etc/apache2/ports.conf /etc/apache2/httpd.conf /etc/apache2/apache2.conf | |
| # Copy in config file | |
| sudo cp /var/www/utees-samos/provision/assets/apache2/apache2.conf /etc/apache2/apache2.conf | |
| # Enable SSL | |
| sudo ln -s /etc/apache2/mods-available/ssl.* /etc/apache2/mods-enabled/ | |
| # Copy in SSL certs | |
| sudo cp -R /var/www/utees-samos/provision/assets/apache2/ssl /etc/apache2/ssl | |
| # Enable rewrite mod | |
| sudo ln -s /etc/apache2/mods-available/rewrite.load /etc/apache2/mods-enabled/ | |
| # | |
| # Install MongoDB | |
| # | |
| # @link http://docs.mongodb.org/manual/tutorial/install-mongodb-on-ubuntu/ | |
| # @link http://stackoverflow.com/questions/8947315/mongodb-on-vagrant-via-port-forwarding-issue | |
| console_log "Installing MongoDB" | |
| # Import the public key used by the package management system | |
| sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv 7F0CEB10 | |
| # Create a list file for MongoDB | |
| echo 'deb http://downloads-distro.mongodb.org/repo/ubuntu-upstart dist 10gen' | sudo tee /etc/apt/sources.list.d/mongodb.list > /dev/null | |
| # Update local package database | |
| sudo apt-get update > /dev/null | |
| # Install MongoDB version 2.6.4 (to match production server version) | |
| sudo apt-get install -y mongodb-org=2.6.4 mongodb-org-server=2.6.4 mongodb-org-shell=2.6.4 mongodb-org-mongos=2.6.4 mongodb-org-tools=2.6.4 > /dev/null | |
| # Copy in config | |
| sudo cp /var/www/utees-samos/provision/assets/mongod.conf /etc/mongod.conf | |
| # Restart MongoDB | |
| sudo service mongod restart > /dev/null | |
| # Pin MongoDB version | |
| echo "mongodb-org hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-server hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-shell hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-mongos hold" | sudo dpkg --set-selections | |
| echo "mongodb-org-tools hold" | sudo dpkg --set-selections | |
| # | |
| # Install PHP | |
| # | |
| # @link https://www.digitalocean.com/community/tutorials/how-to-install-linux-apache-mysql-php-lamp-stack-on-ubuntu | |
| # @link http://docs.mongodb.org/ecosystem/drivers/php/ | |
| # Install packages | |
| console_log "Installing PHP" | |
| sudo apt-get install -y php5 libapache2-mod-php5 php5-gd php5-mcrypt php5-curl php5-dev php5-cli php-pear build-essential libsasl2-dev > /dev/null | |
| # Install PHP MongoDB driver | |
| console_log "Installing MongoDB PHP driver" | |
| printf "yes\n" | sudo pecl install mongo > /dev/null | |
| # Copy in php.ini | |
| sudo rm /etc/php5/apache2/php.ini /etc/php5/cli/php.ini | |
| sudo cp /var/www/utees-samos/provision/assets/php/apache2/php.ini /etc/php5/apache2/php.ini | |
| sudo cp /var/www/utees-samos/provision/assets/php/cli/php.ini /etc/php5/cli/php.ini | |
| # | |
| # Install Vim | |
| # | |
| console_log "Installing Vim" | |
| sudo apt-get install -y vim > /dev/null | |
| # | |
| # Install wkhtmltopdf | |
| # | |
| console_log "Installing wkhtmltopdf" | |
| sudo dpkg -i /var/www/utees-samos/provision/assets/wkhtmltox-0.12.1_linux-precise-amd64.deb | |
| # | |
| # Install HHVM | |
| # | |
| # @link http://fideloper.com/hhvm-nginx-laravel | |
| console_log "Installing HHVM" | |
| # Install some dependencies | |
| sudo apt-get install -y unzip git-core curl wget python-software-properties > /dev/null | |
| # Add apt-get repo | |
| sudo add-apt-repository -y ppa:mapnik/boost > /dev/null | |
| # Get key | |
| wget -O - http://dl.hhvm.com/conf/hhvm.gpg.key | sudo apt-key add - | |
| # Get list file | |
| echo deb http://dl.hhvm.com/ubuntu precise main | sudo tee /etc/apt/sources.list.d/hhvm.list > /dev/null | |
| # Update local package database | |
| sudo apt-get update > /dev/null | |
| # Install HHVM | |
| sudo apt-get install -y hhvm > /dev/null | |
| # | |
| # Install Composer | |
| # | |
| # @link https://getcomposer.org/doc/00-intro.md#globally | |
| console_log "Installing Composer" | |
| # Download | |
| curl -sS https://getcomposer.org/installer | php > /dev/null | |
| # Move to /usr/local/bin | |
| sudo mv composer.phar /usr/local/bin/composer | |
| # Create alias to run composer through HHVM | |
| console_log "Adding alias to run composer through HHVM" | |
| echo -e "\n" >> ~/.bashrc | |
| echo "# Composer alias to run through HHVM" >> ~/.bashrc | |
| echo 'alias composer="hhvm -v ResourceLimit.SocketDefaultTimeout=30 -v Http.SlowQueryThreshold=30000 -v Eval.Jit=false /usr/local/bin/composer"' >> ~/.bashrc | |
| # Restart the VM | |
| console_log "All done!" | |
| console_log "Please run 'vagrant reload'" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment