Using Vagrant and Puppet to build a PHP/Lamp environment

Vagrant is a real help in creating developer environments and is widely used by many development teams due to its flexibility and ease of replicating environments.

In order to get ready with Drupal 8, I wanted to get to know Symfony this is an attempt to do that and hopefully this will help me do just that and help others who stumble upon this site.

The steps for creating a development environment is below, I am using a Mac OS X Yosemite, you can use your favourite OS :

1. Install vagrant using vagrantup.com

2. Install a provider I have used VirtualBox.

3. Initialise a Vagrant environment.

Vagrant should work form any where on your computer because the installer would have added this to your executable paths, so lets create a new folder called 'vagrant' and run the following command

vagrant init hashicorp/precise64

This creates the Vagrantfile which is the main configuration file for vagrant. Open the Vagrantfile in your favourite editor or maybe just vi it. some of the configurations are worth noting, you can set here the port you want to forward, shared folders etc.

by default the line config.vm.box = "hashicorp/precise64" is uncommented, and this is the only line which is required to start your vagrant machine!

We will uncomment one more line

config.vm.network "forwarded_port", guest: 80, host: 8080

This will allow us to use our computer to access a website on the VM.

in the folder where the Vagrantfile is created do "vagrant up" thats it the vagrant machine is up albeit a very basic one...we will learn to it do all the things we want for symfony to work next.

This is how we can get Vagrant to setup a development box very quickly, now think this is a vanilla base installation, now you can configure this box, install a provisioner like puppet and create a base box for your specific development team needs.

Fortunately there are a lot of base boxes already setup with the required software for symfony to work, we can use them to start...one such base box i found at:

https://github.com/scotch-io/scotch-box

with instructions on how to setup this vagrant box, installation was a doddle and i was able to setup a vagrant box in under 40 mins.

Comments

Popular posts from this blog

Install the right version of php_mongo.dll in windows

Installing sqlyog on Mac OS X Yosemite

Use ProxySQL to obfuscate data for development.