Skip to content

Instantly share code, notes, and snippets.

@hungneox
Forked from kcjpop/Vagrantfile
Created April 20, 2014 22:53
Show Gist options
  • Save hungneox/11127293 to your computer and use it in GitHub Desktop.
Save hungneox/11127293 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Update the box
# --------------
# Downloads the package lists from the repositories
# and "updates" them to get information on the newest
# versions of packages and their dependencies
apt-get update
# Install Vim
apt-get install -y vim
# Apache
# ------
# Install
apt-get install -y apache2
# Add ServerName to httpd.conf
echo "ServerName localhost" > /etc/apache2/httpd.conf
# Setup hosts file
VHOST=$(cat <<EOF
<VirtualHost *:80>
ServerName localhost
ServerAlias laravel.dev
ServerAdmin webmaster@localhost
DocumentRoot "/var/www/public"
<Directory "/var/www/public">
Options -Indexes +FollowSymLinks +MultiViews
AllowOverride All
Order allow,deny
allow from all
Require all granted
</Directory>
SetEnv APP_ENV DEV
</VirtualHost>
EOF
)
echo "${VHOST}" > /etc/apache2/sites-enabled/000-default
# Enable mod_rewrite
a2enmod rewrite
# Restart apache
service apache2 restart
# 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
# Update
apt-get update
# PHP stuff
# ---------
# Command-Line Interpreter
apt-get install -y php5-cli
# MySQL database connections directly from PHP
apt-get install -y php5-mysql
# cURL is a library for getting files from FTP, GOPHER, HTTP server
apt-get install -y php5-curl
# Module for MCrypt functions in PHP
apt-get install -y php5-mcrypt
# cURL
# ----
apt-get install -y curl
# Mysql
# -----
# Ignore the post install questions
export DEBIAN_FRONTEND=noninteractive
# Install MySQL quietly
apt-get -q -y install mysql-server-5.5
# Git
# ---
apt-get install git-core
# Install Composer
# ----------------
curl -s https://getcomposer.org/installer | php
# Make Composer available globally
mv composer.phar /usr/local/bin/composer
# Laravel stuff
# -------------
# Load Composer packages
cd /var/www
composer install --dev
# Set up the database
echo "CREATE DATABASE IF NOT EXISTS laravel" | mysql
echo "CREATE USER 'laravel'@'localhost' IDENTIFIED BY 'laravel'" | mysql
echo "GRANT ALL PRIVILEGES ON laravel.* TO 'laravel'@'localhost' IDENTIFIED BY 'laravel'" | mysql
service apache2 reload
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
config.vm.box = "hashicorp/precise32"
config.vm.synced_folder "./", "/var/www", id: "vagrant-root",
owner: "vagrant",
group: "www-data",
mount_options: ["dmode=775,fmode=664"]
config.vm.provision :shell, :path => "bootstrap.sh"
config.vm.network :forwarded_port, host: 4567, guest: 80
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment