Dev environment in virtual machine - edit source files

2

1

I have a mac and until now I've installed my dev environment directly on the host OS. I would like to give a shot to virtualized dev environment.

I don't have the time to learn how to setup a 'reproductible' dev env (e.g. using Vagrant), so I'll go with a VMWare VM with ubuntu inside, and I'll manually install the dependencies. My first question: is this a bad practice? (Should I go with a scripted install instead?)

Second question: what are the good practices about editing source files in the VM? In a perfect world, I would like to edit them using a native client, from the host OS. Can I share the partition between host and VM easily?

Vlad Zloteanu

Posted 2012-12-24T17:05:23.547

Reputation: 147

Answers

1

It's not a bad practice to have a VM installed on your development machine and install all the dependencies you need by hand. I have a setup like this myself as well. My development machines are Windows machines, while my servers are all Linux. To avoid big differences between your development environment and the production environment, you can use a VM solution to reproduce the environment in which you intend to run the application. It would be no good if everything works on your mac, only to discover it breaks when you want to deploy it. Nobody has any benefit from that. Also, by using a VM you can make sure that you have all the modules and same versions installed as you have on your production environment, without breaking anything on your host OS.

As for your second question, you can use native clients on the machine, like by using the console (or even SSH'ing to the box) and then use tools like vim or nano to edit your files. Although, you can also use somthing like nfs and mount the drive of your development VM in your local machine. In my setup, I also use nfs and samba and I have mounted my DocumentRoot directory as a network disk on my Windows machine, so I can easily access the files. That way, you can also use an editor on your host machine to alter the files on your development environment. Just make sure that your editor recognizes and keeps the used line endings (breaks). But as far as I know Mac OS and Ubutu both use "Unix" type line breaks, so that shouldn't be an issue.

Oldskool

Posted 2012-12-24T17:05:23.547

Reputation: 654

1

If you're going to have only one development environment then it's fine to manually install everything. You can copy guest machines later, if you need more. I did just like that for myself. OS X host with debian guest.

I mounted my source repository directories on host system to guest with VMware shared folders. I think this is the fastest way to access from both system to source. Much faster than any other alternatives.

szkl

Posted 2012-12-24T17:05:23.547

Reputation: 11