1

I've been trying to figure this out for hours and just cant seem to. There doesn't seem to be much help online. I've tried to do it via Chef solo, but that doesn't seem to work and I'm not particularly a fan of it downloading php, apache, mysql every time I create a new VM.

Anyway, not particularly concerned what the method is, whether its through Chef solo or similar, or whether its a box with LAMP already set up, or something else, I just want a way (and preferably the easiest way) to set up a VM with a LAMP stack through Vagrant.

Tesla
  • 793
  • 1
  • 10
  • 22

1 Answers1

1

Chef Solo is the preferred method but has a pretty steep learning curve. You should make the effort to learn this eventually. In the meantime, you can manually install everything just like you mentioned and then package the box up

vagrant package

You'll now have a package.box that you can use to create virtual machines with from vagrant with the LAMP stack you installed. Add the box

vagrant box add lamp package.box

and then within your Vagrantfile

Vagrant::Config.run do |config|
  config.vm.box = "lamp"

  # stuff
end
axsuul
  • 7,370
  • 9
  • 54
  • 71
  • does this actually work? Can I take this code literally and assume that vagrant (or whatever runs with it - chef? puppet?) will read this code and recognise "lamp" as a full LAMP stack? I tried it and it didn't seem to work for me. – therobyouknow Jan 30 '13 at 15:59
  • 1
    Nope, this is assuming you already have a full LAMP stack on your vagrant box. When packaging it up, I called it `lamp`. vagrant doesn't have predefined boxes. – axsuul Jan 31 '13 at 18:10
  • OK @Axsuul so how would that help the person who originally asked this question? – therobyouknow Jan 31 '13 at 19:08
  • I suggested he install his LAMP stack manually on the vagrant box and then package it up for re-use in the future. – axsuul Feb 01 '13 at 19:44
  • Axsuul, thanks - yes I see that from your answer - and when you say package it up, what is the resultant package? A binary image of his virtual machine? Or a series of commands (Chef?) that replicate what he did manually? Thanks again... – therobyouknow Feb 05 '13 at 15:51
  • You will get a .box file that you can then reuse in your Vagrantfile or other projects. See http://docs.vagrantup.com/v1/docs/boxes.html for more, hope that helps. – axsuul Feb 06 '13 at 21:39
  • Just FYI: I've written instructions for setting up a LAMP stack in a Windows host here, using Vagrant: http://stackoverflow.com/a/15067918/227926 Also, someone else has provided info on an automated packaging tool, VeeWee that can take and ISO from the original, official Linux distro's site and make a Vagrant .box file: http://stackoverflow.com/a/15243781/227926 – therobyouknow Mar 06 '13 at 14:47