Set up a Complete PHP Environment on Linux with Vagrant

Guest Post by Ran Argaman

This post will explain how to install a fully functional Linux PHP environment using Vagrant and Oracle’s VirtualBox on a windows host machine.

“Host” stands for the machine that the virtual machines are running on, not necessary to be a physical machine. We will use Microsoft’s Windows 7 on this example.

Linux virtual environments on Windows is a very good solution for developers who wants to enjoy the benefits of both worlds.

The powerful and scalability of the Linux and open source in general and the “normal” UI of Microsoft.

The first step is to download and install VirtualBox ( and Vagrant ( The next step is to create your Virtual Machine using Vagrant.

My suggestion is to create a folder that will contain all your VMs, something like c:\vms

Now, let’s create a new directory, for this example I’m going to use c:\vms\zsdev1
cd into this folder and run the following command:
[box]vagrant init[/box]

Now, we have to add a new “Box” instance.

My suggestion is to download the box file to your hard drive and not to download every time you create a VM.

You can download all flavors of Linux from Vagrant servers. For this example I’m going to use Ubuntu Precise32 ( Download it to c:\vms\

Now, it our new Vagrant folder (c:\vms\zsdev1) run the following command:

[box]vagrant box add zsdev1 c:\vms\[/box]

Now open the c:\vms\zsdev1\Vagrantfile and edit as follow:
Change the “” value from “base” to “zsdev1” and uncomment the following line:

[box] :private_network, ip: “”[/box]

You can of course choose any other IP addess you want for your VM, just remember that if you are running more than one VM you have to give them different IP addresses and don’t confuse the vagrant SSH ports and the private network IPs.

Now let’s boot our new VM:
[box]vagrant up[/box]
If you don’t know how to connect you can use the “vagrant ssh” command.

You can find more details and troubleshooting scenarios regarding Vagrant on

Remember that when you connect to Vagrant provisioned VM you have to connect to and use a “special” port like 2222 or 2200 and not to the private IP we configured before.

After connecting to the VM using SSH (putty or any other SSH client), let’s download and install Zend Server 6.1

On your home folder run the following commands:

[box]vagrant@precise32:~$ wget
vagrant@precise32:~$ tar zxf ./ZendServer-6.1.0-RepositoryInstaller-linux.tar.gz
vagrant@precise32:~$ cd ./ZendServer-RepositoryInstaller-linux/
vagrant@precise32:~/ZendServer-RepositoryInstaller-linux$ sudo ./ 5.4[/box]

Now you can open your Zend Server GUI on or

That’s it!

The virtual machine we created is almost the same as a physical Linux machine so you can add MySQL, Mongo or any other database software and you can have your LAMP stack up in a few minutes.