Ubuntu 12.04 LTS on an Apple Mac Mini (Late 2012)

I’m switching my web hosting to a Mac Mini running Ubuntu Linux. These are my notes for getting it set up.

Here’s the hardware specs:

  • Apple Mac Mini 6,2 (Late 2012)
  • Intel Core i7-3615QM 2.3 GHz quad-core processor
  • 16 GB DDR3-1600 memory
  • 128 GB solid state drive
  • 1 TB 5400 RPM hard drive

The Mac Mini is built to run OS X 10.8, but Ubuntu 12.04.1 runs nicely with a couple of tweaks.

  • Installing required the “noapic” flag (F6 when at the boot menu)
  • Set “Boot after power failure” by running the following, and adding it to /etc/rc.local:
    setpci -s 0:1f.0 0xa4.b=0
  • Fan control doesn’t work without applesmc and macfanctld installed from Ubuntu’s Mactel PPA
  • the network card doesn’t work out of the box, you need to download/compile a new version of the tg3 module from Broadcom

For networking, I didn’t want to have to remember to recompile the module after reinstalling each kernel. I setup DKMS to take care of it automatically.

  • Download the Linux “tg3” driver from Broadcom (version 3.124c (10/18/12) at the time of this writing)
  • Extract it
  • Navigate to Server/Linux/Driver/tg3-3.124c.tar.gz
  • Extract that file to /usr/src/tg3-3.124c/src/
  • Create a file called /usr/src/tg3-3.124c/dkms.conf with the following contents:
PACKAGE_NAME=tg3
PACKAGE_VERSION=3.124c
CLEAN="make -C src/ clean"
MAKE="cd src/ && make BUILD_KERNEL=${kernelver} KVER=${kernelver}"
BUILT_MODULE_NAME[0]="tg3"
BUILT_MODULE_LOCATION[0]="src/"
DEST_MODULE_LOCATION[0]=/updates
AUTOINSTALL=yes
  •  Add the module to DKMS so that it’s automatically built for new kernels:
sudo dkms add -m tg3 -v 3.124c
sudo dkms build -m tg3 -v 3.124c
sudo dkms install -m tg3 -v 3.124c
  • The module is now ready, either load it with “modprobe tg3” or reboot
  • If you need to remove it at a later time, do:
sudo dkms remove -m tg3 -v 3.124c --all

After these changes the Mac Mini is working great. I didn’t test Wi-Fi, Thunderbolt, or Sound, since I won’t be using them. USB works as far as being able to connect a keyboard and mouse, and Ubuntu’s 12.04.1 LiveCD boots into the full desktop.

Update:

Ubuntu has released 12.04.2 install/live CDs based on kernel version 3.5. I have not tested the above instructions with kernel 3.5, so if you’re following them you probably want to stick with the 12.04.1 install ISOs with kernel 3.2. If you install from 12.04.1, you will automatically stay on 3.2 even when updating to 12.04.2.

Update 2 (2014-10-05):

Ubuntu 14.04 and 12.04 with the Trusty hardware enablement stack (installed by default from the 12.04.5 ISO) have the required tg3 driver and do not need the custom DKMS config above.

 

Web Hosting on a Mac Mini

The new Mac mini is out (Late-2012 model), and I’m going to give Macminicolo a try. I’m moving from the dedicated server I’ve been on for the last two years:

  • quad-core 2.83 GHz (Intel Q9550)
  • 8 GB DDR2-800
  • dual 500 GB 7200RPM SATA drives with a hardware mirror (RAID 1)
  • Ubuntu 10.04 LTS

to the faster Mac mini:

  • quad-core 2.3 GHz (Intel Core i7-3615QM)
  • 16 GB DDR3-1600
  • 128 GB SSD
  • 1 TB SATA
  • Ubuntu 12.04 LTS

I’m moving because it’s less expensive and faster. Due to having to buy the Mini, my break-even point is in 12 months, but after that I’m saving money.

Compared to Amazon EC2, after two years I will have paid roughly the same as a Medium instance (2 CPU, 4GB RAM) with the 1/year reservation discount. The Mac Mini is much faster, but then, Amazon offers a lot more (paid) services and options.

The downside is that there’s no redundancy built into the Mac mini, and I become responsible for hardware failures. There’s a year of warranty built into the Mini, but after that there’s a chance I’ll be buying a new one, and my predicted savings will be pushed back a year. In case of a hardware failure, I’ll temporarily move to Amazon EC2. Being instantly available is worth the extra cost in that case.