Created
January 5, 2016 03:12
-
-
Save esmyth01/e937a488afbbb64c66a9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# -*- mode: ruby -*- | |
# vi: set ft=ruby : | |
Vagrant.configure(2) do |config| | |
# This sets the VM that we want to use - in this case, a classic Ubuntu 12.01 box | |
config.vm.box = "hashicorp/precise32" | |
# This makes the VM available in your browser on port 8080, and on MySQL's default port | |
config.vm.network "forwarded_port", guest: 80, host: 1234 #HTTP | |
#config.vm.network "forwarded_port", guest: 3306, host: 3306 #MySQL | |
# Uncomment the next line if you want to give it a distinct IP address (may not work on Windows 10) | |
# config.vm.network "private_network", ip: "192.168.33.10" | |
# We want to share a folder with the VM - namely, the web root of the server | |
config.vm.synced_folder "./www", "/var/www", create: true, :mount_options => ["dmode=777", "fmode=666"] | |
# Next, we'll set up the VM by running some shell commands on first boot | |
config.vm.provision "shell", inline: <<-SHELL | |
#install software | |
debconf-set-selections <<< 'mysql-server mysql-server/root_password password root' | |
debconf-set-selections <<< 'mysql-server mysql-server/root_password_again password root' | |
echo "Updating software listings..." | |
sudo apt-get update -qq | |
echo "Installing software from repositories..." | |
#$ sudo apt-get update | |
#$ sudo apt-get install -y python-software-properties | |
#$ sudo add-apt-repository ppa:ondrej/php5 | |
#$ sudo apt-get update | |
#$ sudo apt-get install -y php5 | |
sudo apt-get -y -q -o=Dpkg::Use-Pty=0 install apache2 mysql-server php5 php5-mysql git curl | |
#restart Apache (sometimes it doesn't see PHP's MySQL adapter) | |
sudo /etc/init.d/apache2 restart | |
SHELL | |
config.vm.post_up_message = <<-POSTUP | |
Your virtual machine is now up and running. | |
To pause this VM, use the `vagrant suspend` command. | |
To restart it after pausing, use `vagrant resume`. | |
To shut down completely, use `vagrant halt`. | |
And to start it after shutdown, use `vagrant up`. | |
Visit http://localhost:8080 to visit your local server. Web files are located in the www/ folder in this directory. They will not be erased when you halt or restart the server, and you can edit them using a normal desktop editor. You can also clone your theme into www/wp-content/themes to work on it. | |
MySQL config info for WordPress: | |
Database name: wordpress | |
User name: root | |
Password: root | |
Database host: localhost | |
Table Prefix: wp_ | |
POSTUP | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment