#LAMP Stack on CentOS 7 Built with Vagrant/Puppet#
(a few tweaks based on https://github.com/sgphpug/vagrant-lamp-centos64)
For anyone wanting to try out Vagrant, here's some sample code to help you setup your own LAMP dev sandbox quickly. It runs on CentOS 7 and the internal setup is done with Puppet and a few small bash scripts.
Do note that the first run might take a while. Depending on your speed, 10 minutes to download the base VM and 5 minutes to startup and provision the VM. But subsequent startup should be quite fast.
You can spin up new boxes very easily. Just put your PHP scripts in the project
folder and add a new vhost. If you are lazy, just throw your PHP files into the project/public_html
folder.
- Apache 2.4.6
- PHP 5.4.16 (with php-cli and pear)
- APC
- XDebug (with remote start)
- WP-CLI
- composer
- Vagrant (>= 1.6.5) (http://vagrantup.com/)
- Appropriate Vagrant provider (tested with VMWare Fusion)
- Librarian-Puppet (https://github.com/rodjek/librarian-puppet)
##Installation Instructions##
-
Install
Puppet
&Librarian-Puppet
$ sudo gem install puppet $ sudo gem install librarian-puppet
2. Clone this Git Repository
```bash
$ git clone [email protected]/jacobhenke/vagrant-lamp-centos.git
$ cd vagrant-lamp-centos
-
Install Puppetfile dependencies
$ cd puppet $ librarian-puppet install
4. Set up desired hostname
```bash
$ sudo vim /etc/hosts
Add the following lines:
```
127.0.0.1 app.dev 127.0.0.1 www.app.dev
5. Start Vagrant
```bash
$ cd ..
$ vagrant up --provision
- Once startup in complete, point your browser to
http://app.dev
to make sure Apache is running.
-
Put your files in
project/public_html
to make it appear in the Apache document root. The./project
folder is mapped to/data
in the VM. For conveinence,/home/vagrant/public_html
is a softlink to/data/public_html
-
The MySQL username is
root
and the root password ismedia1
. -
To login into the VM type
$ vagrant ssh
* To stop the VM:
```bash
$ vagrant suspend
-
To halt the VM:
$ vagrant halt
* To destroy the VM:
```bash
$ vagrant destroy
-
To run Puppet again:
$ vagrant provision
* Whenever you make any changes to `Vagrantfile`, run:
```bash
$ vagrant reload --provision
All the configuration are in Vagrantfile
and in the puppet/manifests/hieradata/common.yaml
. Feel free to explore and tweak the settings to your liking.
- This configuration was successfully tested on Mac OSX El Capitan with VMWare Fusion.
- This is designed for local use only! The firewall and SELinux are completely disabled and no other security options were put in place. Don't put this on a public server!