Skip to content

Instantly share code, notes, and snippets.

@bacsa
Forked from asmerkin/Vagrant.bootstrap.sh
Last active August 27, 2015 20:51
Show Gist options
  • Select an option

  • Save bacsa/aa23ed485a65a1ca5eaf to your computer and use it in GitHub Desktop.

Select an option

Save bacsa/aa23ed485a65a1ca5eaf to your computer and use it in GitHub Desktop.

Revisions

  1. Andrés Smerkin revised this gist Jul 25, 2014. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion Vagrant.bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -50,7 +50,7 @@ service apache2 reload
    # ---------------------------------------

    # Installing packages
    apt-get install -y php5 php5-cli php5-fpm curl php5-curl php5-mcrypt
    apt-get install -y php5 php5-cli php5-fpm curl php5-curl php5-mcrypt php5-xdebug

    # Creating the configurations inside Apache
    cat > /etc/apache2/conf-available/php5-fpm.conf << EOF
  2. Andrés Smerkin revised this gist Jul 25, 2014. 1 changed file with 12 additions and 0 deletions.
    12 changes: 12 additions & 0 deletions Vagrantfile
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,12 @@
    # -*- 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 = "ubuntu/trusty64"
    config.vm.hostname = "benchmark"
    config.vm.network :forwarded_port, host: 8080, guest: 80
    config.vm.provision :shell, path: "Vagrant.bootstrap.sh"
    end
  3. Andrés Smerkin revised this gist Jul 25, 2014. 1 changed file with 26 additions and 1 deletion.
    27 changes: 26 additions & 1 deletion Vagrant.bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -105,4 +105,29 @@ apt-get install -y phpmyadmin
    ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-enabled/phpmyadmin.conf

    # Restarting apache to make changes
    service apache2 restart
    service apache2 restart



    # ---------------------------------------
    # Tools Setup
    # ---------------------------------------

    # Adding NodeJs PPA Repository
    add-apt-repository -y ppa:chris-lea/node.js
    apt-get update

    # Installing nodejs and npm
    apt-get install -y nodejs

    # Installing Bower and Grunt
    npm install -g bower grunt-cli

    # Installing GIT
    apt-get install -y git

    # Install Composer
    curl -s https://getcomposer.org/installer | php

    # Make Composer available globally
    mv composer.phar /usr/local/bin/composer
  4. Andrés Smerkin created this gist Jul 9, 2014.
    108 changes: 108 additions & 0 deletions Vagrant.bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,108 @@
    #!/usr/bin/env bash

    # ---------------------------------------
    # Virtual Machine Setup
    # ---------------------------------------

    # Adding multiverse sources.
    cat > /etc/apt/sources.list.d/multiverse.list << EOF
    deb http://archive.ubuntu.com/ubuntu trusty multiverse
    deb http://archive.ubuntu.com/ubuntu trusty-updates multiverse
    deb http://security.ubuntu.com/ubuntu trusty-security multiverse
    EOF


    # Updating packages
    apt-get update

    # ---------------------------------------
    # Apache Setup
    # ---------------------------------------

    # Installing Packages
    apt-get install -y apache2 libapache2-mod-fastcgi apache2-mpm-worker

    # linking Vagrant directory to Apache 2.4 public directory
    rm -rf /var/www
    ln -fs /vagrant /var/www

    # Add ServerName to httpd.conf
    echo "ServerName localhost" > /etc/apache2/httpd.conf
    # Setup hosts file
    VHOST=$(cat <<EOF
    <VirtualHost *:80>
    DocumentRoot "/var/www/public"
    ServerName localhost
    <Directory "/var/www/public">
    AllowOverride All
    </Directory>
    </VirtualHost>
    EOF
    )
    echo "${VHOST}" > /etc/apache2/sites-enabled/000-default.conf

    # Loading needed modules to make apache work
    a2enmod actions fastcgi rewrite
    service apache2 reload

    # ---------------------------------------
    # PHP Setup
    # ---------------------------------------

    # Installing packages
    apt-get install -y php5 php5-cli php5-fpm curl php5-curl php5-mcrypt

    # Creating the configurations inside Apache
    cat > /etc/apache2/conf-available/php5-fpm.conf << EOF
    <IfModule mod_fastcgi.c>
    AddHandler php5-fcgi .php
    Action php5-fcgi /php5-fcgi
    Alias /php5-fcgi /usr/lib/cgi-bin/php5-fcgi
    FastCgiExternalServer /usr/lib/cgi-bin/php5-fcgi -socket /var/run/php5-fpm.sock -pass-header Authorization
    # NOTE: using '/usr/lib/cgi-bin/php5-cgi' here does not work,
    # it doesn't exist in the filesystem!
    <Directory /usr/lib/cgi-bin>
    Require all granted
    </Directory>
    </IfModule>
    EOF

    # Enabling php modules
    php5enmod mcrypt

    # Triggering changes in apache
    a2enconf php5-fpm
    service apache2 reload

    # ---------------------------------------
    # MySQL Setup
    # ---------------------------------------

    # Setting MySQL root user password root/root
    debconf-set-selections <<< 'mysql-server mysql-server/root_password password root'
    debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root'

    # Installing packages
    apt-get install -y mysql-server mysql-client php5-mysql

    # ---------------------------------------
    # PHPMyAdmin setup
    # ---------------------------------------

    # Default PHPMyAdmin Settings
    debconf-set-selections <<< 'phpmyadmin phpmyadmin/dbconfig-install boolean true'
    debconf-set-selections <<< 'phpmyadmin phpmyadmin/app-password-confirm password root'
    debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/admin-pass password root'
    debconf-set-selections <<< 'phpmyadmin phpmyadmin/mysql/app-pass password root'
    debconf-set-selections <<< 'phpmyadmin phpmyadmin/reconfigure-webserver multiselect apache2'

    # Install PHPMyAdmin
    apt-get install -y phpmyadmin

    # Make Composer available globally
    ln -s /etc/phpmyadmin/apache.conf /etc/apache2/sites-enabled/phpmyadmin.conf

    # Restarting apache to make changes
    service apache2 restart