Forget about your long LAMP installations on your local machine.
Vagrant allows you to build and maintain portable virtual development environments alongside with Chef that automates your platform making infrastructure into code; they make a relatively easy setup for your local environments.
In the end you’ll have a virtual server, ideally, mimicking your real one, that you can just start and stop whenever you want to, better yet, you can also share it to other developers working on the same project, thus making the environment the same for everyone.
I always prefer to learn by example, so for that I have prepare a very simple repo for you to follow and learn, on this specific case, how to set up a virtual environment for working with NodeJS and MongoDB.
In five minutes you’ll be working, doing what you do best, with a virtual server on your back:
Head over to https://github.com/voxmachina/vagrant-chef-nodejs and clone away.