configuration management, linux, macintosh, virtualization

The Quickest way to launch a Linux virtual machine on a Mac

Though I have played with launching virtual machines or VMs for many years I never found a virtualization solution that I thought was a awesome solution for just getting stuff done quickly. Working with a Mac at work you may find yourself needing to quickly spin up a Linux machine or test server. I personally do this because I find it easier then trying to install things like Python or Ansible on the work issued Macintosh.

If you would like to test out your Ansble, Chef, Salt of another configuration management frameworks this is a great option to be able to spin up a VM that you can then destroy when you are done running your tests.

I should mention that this specific way of deploying a Linux VM will give you a box with a command line. you shouldn’t expect to work with the GUI using this method.

To start go to the Vagrant website and get the newest version for Mac. A quick Google search should get you there quickly.

You should also install VirtualBox as Vagrant will use some the the Virtualbox packages to get rolling.

Once you have Vagrant installed You can Download which Virtual Machine image that you want. Choose from the following images and then run the init command.

For Ubuntu Trusty run:

vagrant init ubuntu/trusty64

For Debian Jessie run:

vagrant init debian/jessie64

Then run the following command to get into your Vagrant virtual machine

vagrant up

and then

vagrant ssh

That is it. Now you can build out your test server, development environment, test your Ansible, Salt, Puppet, or Chef configuration management and so much more!

once you want to destroy the vm you can run this.

vagrant destory

Just use sudo to use those commands that you want with high privileges. No password required!