/vagrant-ubuntu-lamp

VirtualBox + Vagrant + Landrush; running Ubuntu 14.04 LTS w/ a full LAMP stack.

Primary LanguagePHP

VirtualBox + Vagrant + Landrush; running Ubuntu 14.04 LTS w/ a full LAMP stack. Includes a tutorial!


Installation Instructions

Step 1: Satisfy Software Requirements

You need to have VirtualBox, Vagrant, and Landrush installed. See full tutorial.

$ brew cask install virtualbox
$ brew cask install vagrant
$ vagrant plugin install landrush

You need to install the ubuntu/trusty64 Box. See full tutorial.

$ vagrant box add ubuntu/trusty64

Step 2: Clone GitHub Repo (Ubuntu LAMP Stack)

$ mkdir ~/Projects && cd ~/Projects
$ git clone --recurse-submodules https://github.com/jaswsinc/vagrant-ubuntu-lamp

Note: If you want a specific branch, be sure to checkout that specific branch. For instance, the wordpress branch makes things much easier if you're running WordPress. The master branch is a base with just a LAMP stack; i.e., no special considerations for any third-party software. You'll want to read: BRANCHES.md for more information.

$ cd ~/Projects/vagrant-ubuntu-lamp
git checkout wordpress

Step 3: Vagrant Up!

$ cd ~/Projects/vagrant-ubuntu-lamp
$ vagrant up # Boot-up the Box with LAMP ready-to-go!

Step 4: Confirm it is Working!

  • Open http://ubuntu-lamp.vm. You should see a phpinfo() page.
  • Open https://ubuntu-lamp.vm. You should get an SSL security warning. Please bypass this self-signed certificate warning and proceed. You should again see the phpinfo() page. SSL is working as expected!

Note: If you use something other than the master branch in this repo, the default hostname will be different. It will include the branch name; e.g., http://ubuntu-lamp-wordpress.vm if you are running the wordpress branch.

Step 5: Add Files to: ~/Projects/vagrant-ubuntu-lamp/htdocs/

The is the web root. Add your application files. e.g., WordPress, Drupal, Joomla, etc.

Step 6: Understanding Environment Variables

This LAMP stack comes preconfigured with a MySQL database and environment variables you can use in any PHP config. files.

  • $_SERVER['MYSQL_DB_HOST'] This is the database host name. Defaults to localhost. Port is 3306 (default port).
  • $_SERVER['MYSQL_DB_NAME'] This is the database name. Defaults to vagrant.
  • $_SERVER['MYSQL_DB_USER'] This is the database username. Defaults to vagrant.
  • $_SERVER['MYSQL_DB_PASSWORD'] This is the database password. Defaults to vagrant.

Step 7: Learn to Use the Tools That I've Bundled

A username/password is required to access each of these tools. It is always the same thing.

  • Username: vagrant Password: vagrant

Available Tools (Using Any of These is Optional):

Step 8: Tear it Down and Customize

$ cd ~/Projects/vagrant-ubuntu-lamp
$ vagrant destroy # Tear it down and customize.

In the project directory you'll find bootstrap.bash. At the top there are some configurable parameters that you can tune-in if you like. You may also want to tweak the Vagrantfile for the project; e.g., to change the config.vm.hostname or config.landrush.tld. Enjoy!

$ vagrant up # Bring it back up after you are done customizing.

Hostname Tips & Tricks

By default, the hostname will be: http://ubuntu-lamp.vm. You can change this by editing config.vm.hostname in Vagrantfile.

Note: If you use something other than the master branch in this repo, the default hostname will be different. It will include the branch name; e.g., http://ubuntu-lamp-wordpress.vm if you are running the wordpress branch.

However, you can avoid the extra step associated with the hostname altogether. Clone this repo into a directory that uses a .vm suffix. A quick look at Vagrantfile and you'll see that if your directory ends with .vm I use the directory basename as the VM hostname. For instance, I could run through the following steps and end up with http://my.vm and https://my.vm automatically.

$ git clone --recurse-submodules https://github.com/jaswsinc/vagrant-ubuntu-lamp my.vm
$ cd my.vm && vagrant up # Now visit: `http://my.vm`