Windows/Unix development on Mac Part 4: Just VirtualBox

September 23, 2016 08:56

I’m abandoning Vagrant (1.8.5) for now. Ssh’ing into the VM is really fragile and hard to fix when it breaks. Apparently this is a chronic problem as there is so much on Google about this issue that I can hardly wade through it. I’ve regenerated the keys, etc. (and so have lots of other folks), no luck.

Vagrant definitely plays a future role. But having worked with it now I think that it is really intended more for automated testing, where you can spin up an environment, run tests on it, spin it down and move onto the next environment — all from a shell script. In short, Vagrant is a scripting front end for VirtualBox (or VMware, or...)

For my purposes, namely creating dev VM environments, just using VirtualBox will work just fine — better by certain measures because I’m eliminating the extra layer of the Vagrant front end. Within VirtualBox I can export VMs (they call them ‘appliances’) and load them on other machines. And within VirtualBox I can change memory, shares, etc.

I can definitely see Vagrant playing an important role in the not too distant future. I’m figuring by then they’ll have this bug worked out!

And so, here’s setting up a VirtualBox dev environment directly:


I’m opting for Centos6.5 as I’m already familiar with it and it works well for my purposes. So you download Centos images in general from here (‘older’ images at the bottom):

Or go straight here (the mirror I chose at random):

I opted for the DVD1 and DVD2 images just so I have everything on hand if I want it. The installer lets you choose how complete an install to do (we'll get to that).

Create a new VM. Be sure to give it realistic RAM because the installer will only present you with install configurations that work in the RAM you specify. Mount the ISO on your virtual CD, click run to boot your VM, etc.

BTW, after you've created your machine, you can alter your `physical characteristics' like RAM. But note: your machine must be completely shut down, and not just suspended to make those sorts of changes. Which makes perfect sense if you think about it!

When installing, I chose the ’Minimal Desktop’ as I want a desktop for IntelliJ but little else. Unfortunately with this option you get no network! So, after completing the install, launch Terminal and then a root session. Then perform the following edits on /etc/sysconfig/network-scripts/ifcfg-eth0:

HWADDR=MAC Address*System MAC* 

(Set NW_CONTROLLED=yes if you want Network Manager to be able to manage this.)

Then execute:

service network restart

After that, yum update should work.

You’ll also want to do the following:

yum install -y git-all

If you like gvim:

yum install vim-X11

`Larger' Display

At this point your maximum display is 1024x768. We can set that larger by installing the `Guest Additions'. But before that we have to install gcc and perl and the kernel-headers and in essence rebuild the virtual kernel. Ugh... do I have to do that with Parallels? No. Let's try all of this under Parallels...

yum install -y gcc-c++
yum install perl-Perl-MinimumVersion.noarch

Specialized Dev Environments

At this point I'm saving my image, as this is a good base for a dev machine. (E.g., I'll clone the base VM and install as follows:


For IntelliJ Idea java development you'll want the compiler, not just the runtime:

yum install -y java-1.7.0-openjdk-devel

Root will need to manually set JAVA_HOME=/your/path in /etc/environment


PHP Storm and Apache/Mysql for LAMP, etc:

    Previous    Next