Run Linux in a VM on Mac

I recently had to run a Linux VM on my MacBook Pro to access a certain software. While it's not a challenging thing to do, there are a few gotchas. Here's some advice on how to get it going:

  1. Decide which distribution to use. Sometimes it's a requirement. But other times, one has to choose. These days I prefer enterprise distros for their relative stability. Either CentOS or Ubuntu LTS will fit this bill. I chose CentOS 7.

  2. Decide the VM environment to be used. Docker is great, but it's got a learning curve. Virtualbox is free, but is very slow on my Mac. So I ended up using Parallels which is fast, and has good integration features.

  3. Decide the use case: I wanted to use GUI applications, so should have used the "DVD ISO" which has almost every package I needed. But I chose the minimal server edition to cut the download time. It's good enough for a headless server, but switching back to GUI mode is a little more work. Of course, I did the hard route. GNOME3 is too slow in a VM and doesn't support Parallels Coherence mode, so better to use Xfce. Also I had to switch the default startup mode to Graphical, instead of

    • yum group install x11
      
    • yum group install Xfce
      
    • systemctl set-default graphical.target
      
  4. Once logged into Xfce, use the Window Manager Tweaks settings to disable the Compositor. The Compositor is responsible for the all nice GUI effects, but it's not supported in Coherence mode, my preferred mode for using Parallels.

Hopefully next time you're setting up a VM, you can avoid some dead-ends and get to your actual task quicker.

links

social