Skip to content

Instantly share code, notes, and snippets.

@n0ni0
Last active December 26, 2016 21:51
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save n0ni0/88bc2ec509141a348e15cad868791e2e to your computer and use it in GitHub Desktop.
Save n0ni0/88bc2ec509141a348e15cad868791e2e to your computer and use it in GitHub Desktop.
A simple LAMP vagrant file
#!/bin/bash
password='root'
projectFolder='project'
# Update server
add-apt-repository ppa:ondrej/php
apt-get update
apt-get upgrade -y
# Install Apache
apt-get install apache2 -y
#Install PHP
sudo apt-get install -y php7.0 libapache2-mod-php7.0 php7.0 php7.0-common php7.0-gd php7.0-mysql php7.0-mcrypt php7.0-curl php7.0-intl php7.0-xsl php7.0-mbstring php7.0-zip php7.0-bcmath php7.0-iconv
#Set locale
export LC_ALL="en_US.UTF-8"
dpkg-reconfigure locales
# Install MySQL
echo "mysql-server mysql-server/root_password password $password" | sudo debconf-set-selections
echo "mysql-server mysql-server/root_password_again password $password" | sudo debconf-set-selections
apt-get install mysql-client mysql-server -y
# Restart Apache service
service apache2 restart
# setup hosts file
VHOST=$(cat <<EOF
<VirtualHost *:80>
DocumentRoot "/var/www/html/${projectFolder}"
<Directory "/var/www/html/${projectFolder}">
AllowOverride All
Order allow,deny
allow from all
</Directory>
</VirtualHost>
EOF
)
echo "${VHOST}" > /etc/apache2/sites-available/000-default.conf
# enable mod_rewrite
sudo a2enmod rewrite
# restart apache
service apache2 restart
#Install composer
curl -sS https://getcomposer.org/installer | sudo php -- --install-dir=/usr/local/bin --filename=composer
# install git
sudo apt-get -y install git
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
Vagrant.configure("2") do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.network :forwarded_port, host: 8080, guest: 80
config.vm.network "private_network", ip: "192.168.33.10"
config.vm.synced_folder "./", "/var/www/html"
config.vm.provision "shell", path: "bootstrap.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment