Last Updated: February 25, 2016
·
521
· Cedric Dugas

Tips for getting started with Vagrant

I have been using xampp for my local lamp stack for ages. It works well, but that's definitely nothing like my live production server. Enter Vagrant, "easily" reproducible dev stacks.

Wouldn't it be perfect if you could just give a recipe to your new developers and boom, their app environment is ready, they can get to code right away. No more fiddling with hosts, memcache, enabling by hand php modules. Just 2 or 3 commands and your done. I'm not going to go deep into a tutorial since I am still very new to Vagrant but I thought I could give you a couple of tips to get you started easily.

<h2>Video tutorial</h2>
One nice thing about Vagrant is their <a href="http://vimeo.com/9976342">introduction video</a> that helps you automate your first lamp stack. The bad news is that while it will get you 90% there, Vagrant changed a lot since that video was made and you will have to do a bit of testing to get everything working.

<a href="http://iostudio.github.com/LunchAndLearn/2012/03/21/vagrant.html">These slides</a> are also a good starting point, it's a bit more up to date and the coding style is more elegant.

<h2>Fiddling with hosts</h2>
Vagrant by default will forward the vm to your 127.0.0.1 with a special port (any port you choose). On your side you can't use your host to forward 127.0.0.1:8080 to (for example) devdomain.com. Hosts file are only for dns not for port so it won't help you. You could of course go to forward back the port using firewall apps and etc.

But the easiest thing to do is nothing, put your domain in your host file and then you can just type devdomain:8080 and it's going to work since you already forwarded that domain to your localhost in your host file.

More tips : http://www.position-absolute.com/news/tips-for-getting-started-with-vagrant-dev-environments-evolved/