Skip to content

Instantly share code, notes, and snippets.

@kai23
Created November 14, 2013 15:54

Revisions

  1. kai23 created this gist Nov 14, 2013.
    98 changes: 98 additions & 0 deletions bootstrap.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,98 @@
    #!/usr/bin/env bash

    # Met à jour la box
    apt-get update

    # Install Vim
    apt-get install -y vim

    # Install Apache
    apt-get install -y apache2

    # PHP 5.4
    # -------
    apt-get install -y libapache2-mod-php5

    # Add add-apt-repository binary
    apt-get install -y python-software-properties

    # Install PHP 5.4
    add-apt-repository ppa:ondrej/php5

    # mise à jour
    apt-get update

    # Les trucs PHP
    # ---------

    apt-get install -y php5-cli
    apt-get install -y php5-curl
    apt-get install -y curl
    apt-get install -y php5-mcrypt

    # Git
    # ---
    apt-get install -y git

    # On supprime le dossier /var/www
    rm -rf /var/www

    # lien entre /vagrant et /www --> on fait un raccourci
    ln -fs /vagrant /var/www


    # Clone repository
    git clone https://github.com/laravel/laravel.git /vagrant/laravel

    # Add ServerName to httpd.conf
    echo "ServerName localhost" > /etc/apache2/httpd.conf
    # Setup hosts file
    VHOST=$(cat <<EOF
    <VirtualHost *:80>
    ServerAdmin [email protected]
    DocumentRoot /var/www/laravel/public
    <Directory /var/www/laravel/public>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride all
    </Directory>
    ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
    <Directory "/usr/lib/cgi-bin">
    AllowOverride None
    Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
    Order allow,deny
    Allow from all
    </Directory>
    ErrorLog ${APACHE_LOG_DIR}/error.log
    # Possible values include: debug, info, notice, warn, error, crit,
    # alert, emerg.
    LogLevel warn
    CustomLog ${APACHE_LOG_DIR}/access.log combined
    </VirtualHost>
    EOF
    )
    echo "${VHOST}" > /etc/apache2/sites-available/laravel.conf
    sudo a2dissite default
    sudo a2dissite 000-default.conf
    sudo a2ensite laravel
    sudo service apache2 reload
    sudo service apache2 restart

    # Install Composer
    # ----------------
    curl -s https://getcomposer.org/installer | php
    # Make Composer available globally
    mv composer.phar /usr/local/bin/composer
    # Enable mod_rewrite
    a2enmod rewrite
    # Restart apache
    service apache2 restart

    cd /var/www/laravel
    composer install