Skip to content

Instantly share code, notes, and snippets.

@dennisfoconnor
Last active August 29, 2015 14:01
Show Gist options
  • Save dennisfoconnor/3a146537f292ff499107 to your computer and use it in GitHub Desktop.
Save dennisfoconnor/3a146537f292ff499107 to your computer and use it in GitHub Desktop.
Vagrant Lamp Ubuntu 14.04
#!/bin/bash
echo Installing LAMP...
apt-get -y update
debconf-set-selections <<< 'mysql-server-5.1 mysql-server/root_password password testerific'
debconf-set-selections <<< 'mysql-server-5.1 mysql-server/root_password_again password testerific'
apt-get -y install php5 libapache2-mod-php5 php5-mcrypt php5-curl mysql-server php5-mysql
echo Configuring MySQL...
mysql -u root -ptesterific -e "grant all privileges on *.* to 'root'@'%' with grant option;"
#Untested
sed s/bind_address/#bind_address/ /etc/mysql/my.cnf > /etc/mysql/my.cnf.new
mv /etc/mysql/my.cnf /etc/mysql/my.cnf.orig
mv /etc/mysql/my.cnf.new /etc/mysql/my.cnf
service mysql restart
echo Installing WP-CLI...
curl -sL https://raw.github.com/wp-cli/builds/gh-pages/phar/wp-cli.phar > wp-cli.phar
chmod +x wp-cli.phar
mv wp-cli.phar /usr/bin/wp
# -*- 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|
# All Vagrant configuration is done here. The most common configuration
# options are documented and commented below. For a complete reference,
# please see the online documentation at vagrantup.com.
# Every Vagrant virtual environment requires a box to build off of.
config.vm.box = "ubuntu/trusty64"
# Create a private network, which allows host-only access to the machine
# using a specific IP.
config.vm.network "private_network", ip: "192.168.33.10"
# Share an additional folder to the guest VM. The first argument is
# the path on the host to the actual folder. The second argument is
# the path on the guest to mount the folder. And the optional third
# argument is a set of non-required options.
config.vm.synced_folder "web", "/var/www/html"
config.vm.provision "shell", path: "https://gist.githubusercontent.com/dennisoconnor/3a146537f292ff499107/raw/lamp-provision.sh"
end
@dennisfoconnor
Copy link
Author

Creates a LAMP Vagrant VM for development.
Just download the Vagrant file and run vagrant up --provision

'web' directory is synced with the web root on the server

MySQL Credentials
user: root
password: testerific

@rodleviton
Copy link

Thanks Dennis. Made the setup really easy.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment