These notes describe the installation of Ubuntu 12.04.3 on a Mac Mini. This is the most powerful server we have found for its size, especially considering that the PSU is internal.
The recommended configuration of a workshop server is:
These instructions have been tested on the following models:
When you have Linux running, you can determine your model using
sudo dmidecode -s system-product-name
For more information on the different models of Mac Mini see:
For installation only, you will need:
We also recommend an Apple USB to Ethernet adapter for the external Internet connection. This leaves the internal gigabit Ethernet port available for the lab internal network and avoids having to trunk VLANs; it also helps if you have a newer Mac Mini where the internal ethernet adapter is not supported in the default kernel.
First you need to choose which ISO image to use and download it. Start with the standard 64-bit server edition (ubuntu-12.04.3-server-amd64.iso) which should work fine with recent Mac Minis.
If you have problems booting, then try one of the amd64+mac1 variants from the alternative downloads page:
However you would then end up installing a desktop version.
You may burn the image onto a CD-R if you have a USB CD-ROM drive to boot from, such as the Apple Superdrive.
Otherwise, to write the image to a USB stick you need use a Mac which is running OSX and follow these instructions
hdiutil convert -format UDRW -o ubuntu-12.04.3-server-amd64.img ubuntu-12.04.3-server-amd64.iso
# Note: the output filename may be .img.dmg
diskutil list # note the devices seen
# insert flash drive
diskutil list # note the new device seen, e.g. /dev/disk2
diskutil unmountDisk /dev/diskN
sudo dd if=ubuntu-12.04.3-server-amd64.img.dmg of=/dev/rdiskN bs=1m
diskutil eject /dev/diskN
# remove flash drive
Insert the CD-ROM or flash disk into the Mac Mini, and connect the keyboard and screen. Connect ethernet uplink - using the USB-to-ethernet adapter if you have one.
Power on and hold the alt/option key while it is starting. You may get a choice of boot icons - the USB key will be "EFI boot".
After this you should get a menu of Ubuntu options:
Install Ubuntu Server
Install in expert mode
Multiple server install with MAAS
Check disc for defects
Rescue a broken system
Select "Install Ubuntu Server" and proceed as normal, choosing country, language and keyboard layout.
If you are using the USB-to-ethernet adapter for your external Internet connection, then you will be prompted for the primary network interface:
eth0: Broadcom Corporation NetXtreme BCM57765 Gigabit Ethernet PCIe
eth1: Ethernet
Choose the one which is your ethernet uplink (i.e. eth1)
Select "Do not configure the network at this time"
Installation is complete: hit Enter, then unplug CD-ROM or USB stick.
Your Mac should be up and running - login as user nsrc
.
Use ifconfig -a
to find its external IP address, and you should be able to ssh into it from outside. Then you no longer need the keyboard and monitor.
Hint: also take a note of the MAC address of the USB-ethernet adapter, and label it. It helps when locating the machine without a monitor.
The secondary hard drive needs to be partitioned and formatted so it can be used for storing half of the VM disk images.
sudo su - (type the nsrc account password)
parted -s -a optimal /dev/sdb mklabel gpt -- mkpart primary ext4 1 -1
mkfs.ext4 /dev/sdb1
mkdir /data
edit /etc/fstab
/dev/sdb1 /data ext4 defaults 0 2
mount /data
Now let's see that we actually have the second disk available to us under the /data partition:
df -h
You should see something like:
Filesystem Size Used Avail Use% Mounted on
/dev/sda2 215G 1.5G 202G 1% /
udev 7.8G 4.0K 7.8G 1% /dev
tmpfs 3.2G 376K 3.2G 1% /run
none 5.0M 0 5.0M 0% /run/lock
none 7.8G 0 7.8G 0% /run/shm
/dev/sda1 93M 2.1M 91M 3% /boot/efi
/dev/sdb1 230G 60M 219G 1% /data
Note that /data is mounted on /dev/sdb1, or the second hard drive in your MacMini
We purposely did not configure our network interfaces during installation so that the installation would go faster and we could configure out interfaces as we want now. You can see that neither eth0 or eth1 are configured by doing:
ifconfig
To fix this, as root, at the command line prompt type:
edit /etc/network/interfaces
Make sure the file looks like this:
# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
# The loopback network interface
auto lo
iface lo inet loopback
auto eth0
# eth0 internal network interface
iface eth0 inet static
address 10.10.0.241
netmask 255.255.255.0
auto eth1
# eth1 external, public network interface
iface eth1 inet dhcp
Now to bring up both interfaces with their new configurations do:
ifup eth0
ifup eth1
Wait a few seconds for the script to complete then type:
ifconfig
to see that your network is now configured. Trying pinging some external sites to verify that your network is working.
Now that our base operating system is installed we need to pull down a list of current versions of available packages and then download and install the packages.
Let's first see what version of the Linux kernel we are running:
uname -a
Remember this and see if you have a newer kernel version once we are finished with this exercise. To update apt and then packages that need updating do:
sudo apt-get update
sudo apt-get dist-upgrade
Say "Yes" to downloading and installing the new packages.
This could take some time as a considerable amount of information is going to be downloaded. While this is happening we will go on to the next set of configuration items for your workshop kit which includes configuring your switch and access point.
When your machine finishes with the apt-get update and the apt-get dist-upgrade processes you will likely have a new kernel image. This is one of the few times you need to reboot Linux to see change. To do this do:
sudo shutdown -r now
Wait for the MacMini to restart and log back in as the user nsrc, then type:
uname -a
To see the version of the Linux kernel that you are running. Is it different from what you had before running "apt-get update" and "apt-get dist-upgrade"?
At this point your MacMini is ready and in its initial state. We'll be updating your MacMini environment using a tool called Ansible a bit later.
Assuming your network interfaces are properly configured you can now remove the monitor and keyboard attached to your MacMini and connect to it using ssh instead.
If this is the first time you are installing Linux on your MacMini it's possible that the Linux installer will not set the boot order correctly. Your Mac may be set to boot Mac OS X, but this is no longer available. To correct this you need to do:
At the bottom of your screen you will see the "#" command prompt. You are now in a rescue Linux shell where we can set some hardware options. You can type:
efibootmgr
You'll probably see MacOS X listed as the BootCurrent item (0080). We want the Ubuntu entry to become the BootCurrent item. To do this type:
efibootmgr -o 00
And, that's it.
Your MacMini should now boot. It may pause for a moment with the white screen, but give it a few seconds to complete booting.
If the attached monitor displays the grub prompt but then goes blank after booting, your monitor may not support the default resolution. If this happens, try booting with parameter "nomodeset".
nomodeset
to the endThen to make this change permanent:
# vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"
# update-grub
The following instructions were from previous tests with a Macmini4,1 and are kept in case they help debugging problems on older machines.
It's probably safer to wipe out the existing Mac OS X and Linux partitions, which should also get rid of rEFIt. That way we make sure that rEFIt is not changing how Linux views the system.
The image used successfully was the alternate-amd64+mac.iso image
The problem is that this installs all the desktop GUI crap, which must be removed after installation.
# vi /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="quiet"
GRUB_CMDLINE_LINUX=”noacpi nomodeset reboot=acpi”
Disable lightdm (replacement for gdm):
echo 'manual' | sudo tee /etc/init/lightdm.override
Then:
# update-grub
Remove all the desktop-related packages:
# apt-get --purge remove 'gnome-*' xerver-xorg
And install the right kernel:
# apt-get install linux-headers-server linux-image-server linux-server
All set.
Aside: there may be another way to do this using tasksel