I liked WAMP very much, but after discovering Vagrant I never will go back to WAMP.
What is Vagrant used for?
Create and configure lightweight, reproducible, and portable development environments.
In my words: Vagrant is used to simulate a real server environment to interact with.
In this article I want to share my basic setup.
Here is a quick introduction to vagrant if you don’t know what it is:
When I need a LAMP stack (on windows) for development, I use this vagrant box:
If gives you a web server environment (LAMP stack) with the following software already installed and configured:
I usually create a new directory for my vagrant box and inside this directory a “html” directory which will be the server’s document root later.
cd c:\ mkdir vagrant-lamp cd .\vagrant-lamp mkdir html
Then I initialize my vagrant box with:
vagrant init avenuefactory/lamp
A short message appears, telling me that the Vagrantfile has been placed in this directory.
After this, I open the the Vagrantfile and add the following configurations at the end of this file (before “end”):
config.vm.network "private_network", ip: "192.168.10.10" config.vm.synced_folder "./html", "/var/www/html"
Those settings tell vagrant, to make the server available on this ip and to map the “./html” folder on my host system to my document root of my guest system (vagrant box).
If I want to change the memory limit:
config.vm.provider "virtualbox" do |vb| vb.memory = 1024 end
I can start the vagrant box by typing:
If this is the first time using this vagrant box, vagrant will download the box initially (will take some minutes).
Now I have a fully functional web server under:
I put my projects inside the “html” directory, and they are ready to work with.
To access the server with ssh, I start PuTTy (on a windows host) and enter the following connection details (vagrant will tell you all details in the command-line)
IP: 127.0.0.1 Port: 2222 user: vagrant password: vagrant
When I am using a linux host, I just type:
To shutdown the server, I type:
All other information about this vagrant box (connection to mysql, phpmyadmin) are written down here:
If you like, check out my own base box: https://atlas.hashicorp.com/alexwenzel/boxes/webdev