1

I have a windows machine with two monitors and I am looking to get a development server running through virtualbox (LAMP stack with symfony framework/PHPStorm) so that I can:

  1. Edit code out on the virtual machine running in a window one monitor
  2. Have windows be served these pages by visiting http://localhost:10080/ for example

Is there a way that I can make a generic VM image that I can use? Even better would be if I can put it on a USB stick and run th VM on any windows machine as a server?

1

Certainly possible. I actually created a small script which sets up a virtual environment like you describe (although I use it purely as a server, I develop on my local machine). I put it on Github if you're interested:

https://github.com/Bartwillemsen/virtual-devbox

Basically what you need to do on your Ubuntu guest settings is create a second Network adapter and make it "host-only".

enter image description here

Then, on the first adapter (which is NAT by default, you can set some port redirections. I set mine up like this:

enter image description here

So with this, you can set up name based hosting with Apache. If you add the name of your website on you local computer's hostfile, you can access it with the url and portnumber like this: yourwebsite.local:8000 (in my case).

EDIT: You can define your shared folders in this screen:

enter image description here

  • Thanks Gladen - it looks really promising :) I've been trying to get it to work today but after running wget -O setup.sh http://goo.gl/vcJxVA I have a copy of setup.sh in my direcory but not aliases and serve.sh. Could you guide me what I'm missing and how/why to define /media/sf_php as shared directory? – Bendy Jun 14 '15 at 14:53
  • The setup.sh reels in and installs those files automatically. :) You should run the setup.sh file in your virtual machine and you should be good to go. The reason I created a shared directory was so that I could develop on my real machine and the files would automatically sync to my virtual machine. You can define a shared directory in the settings under "shared directories" tab. (I updated my answer with a screenshot). – Gladen Jun 15 '15 at 11:38
  • Ow and make sure you attach the VirtualBox additions ISO via the Devices -> Insert Guest Additions CD Image... menu option. – Gladen Jun 15 '15 at 11:39
  • Awesome - thanks so much Gladen....that's exactly what I was after :-) My only wish is that I figure out everything that happens from your github box of tricks! – Bendy Jun 15 '15 at 19:06
  • No problem, glad it is of use for you. :) If you still have any questions regarding the script, or just things you're curious about, feel free to ask. – Gladen Jun 16 '15 at 9:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.