I followed these steps to install alone Debian GNU Linux in my Mac Mini Server (2011 edition), without MacOS X. Please, read this post first, then do it. Make it at your own risk.
You will need (all steps):
- 2 USB memory sticks
- Empty CD-Rom to write and USB burning drive (or other USB drive)
- Debian boot image file (boot.img.gz)
- Debian install image
Step 1 – Download the installation media.
Mac Mini has a bug about installing from CD-ROM (external) and you cannot use this method, therefore, you need to do USB installation. You need for this step:
- 1 USB memory sticks
- Debian boot image file (boot.img.gz)
- Debian install image
- Installed operation system (Linux, Windows, MacOS X)
The Mac Mini has “new” hardware, not supported in all Debian versions. With old images you can boot, but the network cards won’t be detected. You need download a newer Debian testing CD and boot.img file. You can download the boot.img.gz file here: http://ftp.nl.debian.org/debian/dists/lenny/main/installer-amd64/current/images/hd-media/ (look the date, is 2011/10/02 or later). Now, the Debian install ISO image. You can use a businesscard image o netinstall image, because are small (you will copy the image in the pendrive). I used the netinstall image. You can download the images here: http://cdimage.debian.org/cdimage/daily-builds/daily/arch-latest/amd64/iso-cd/.
Now is time to create the USB drive with the boot image. You can do it using Windows, MacOS X or Linux. But you need dd or zcat (find them, for your operating system, using your favorite search engine).
Plug the USB drive to the computer. If your are using Linux, type dmesg to find the device. Do not use partitions in the USB drive, use the main device. For example, if the USB plugged is /dev/sdj with the partition /dev/sdj1, you must use /dev/sdj. If you delete the partition, sometimes is better. Now select option 1 or option 2 (sdj is the USB drive):
Option 1, using zcat:
zcat boog.img.gz > /dev/sdj
Option 2, using dd:
You need to uncompress the file first. Then make the USB boot:
gzip -d boot.img.gz
dd if=boot.img of=/dev/sdj
Now, copy the image file (something like debian-testing-amd64-netinst.iso or debian-testing-amd64-businesscard.iso) to the USB drive. Mount the drive first (I will use /mnt as mountpoint). Probably you need mount with the user root or using sudo. Do not forget to write the full path of the debian-testing-amd64-businesscard.iso file in the copy if is not in the current folder:
mount /dev/sdj /mnt
cp debian-testing-amd64-businesscard.iso /mnt
Step 2 – MacOS X recovery/install USB drive.
You need for this step:
- 1 USB memory stick
- MacOS X or recovery image
At the end of the installation (Step 4), you need run the bless command. It is included in MacOS X, and you can use it form the recovery or install device.
Download the “Lion Recovery Disk Assistant” form Apple at http://support.apple.com/kb/DL1433. Install it in you MacOS X and create the recovery USB drive.
If you don’t have MacOS X, probably you can download a recovery image. Burn it with dd.
Test the image booting the Mac Mini (press Alt key,…), select the recovery disk, your language and of course, cancel the installation.
Step 3 – Create rEFIt drive
You need copy some files from the rEFIt CD-ROM to the EFI partition in your hard drive. You will need to connect these files to the Mac Mini, using a USB stick or USB CD-ROM drive.
You need for this step:
- USB memory stick or CD-ROM drive
Download the rEFIt iso form . Now, open the iso file (e.g. with winRAR or mount -t loop) and save the files in a folder in the pendrive or write the ISO in a CD-ROM. You will need some files of this ISO in the step 5. I wrote the ISO in a CD-ROM.
Step 4 – Install Debian
You need for this step:
- USB memory stick burned in the Step 1
Ok, we start. Now, your MacOS X will be deleted (and your files!). Now, you cannot go back, therefore, please, check that you made all the previous steps and have the things ready. Insert the USB drive in the Mac Mini, hold the Alt key and press the power button. When the boot manager show the drives, release the Alt button. Select the USB stick (labeled “Windows”
) and boot Debian installation.
Probably you know how to install Debian. I don’t spend time with it. The most important is the partitions:
- You need to leave the EFI System Partition in the disks (about 200Mb), do not erase it. Is used by the EFI and you need it in the Step 5.
- Delete only the Apple Partitions.
- If you setup RAID, you need a /boot partition. Create it in the first drive. About 200Mb.
- Do not forget to create a swap drive.
- I recommend RAID if you have Mac Mini Server.
Your partition tables (2 disks) should be something like (with comments):
Device Boot Start End Blocks Id System
/dev/sda1 1 409639 204819+ ee EFI System Partition
/dev/sda2 * 409640 800265 195313 83 Linux (/boot)
/dev/sda3 800266 1449823703 724511719 fd Linux raid autodetect (/)
Device Boot Start End Blocks Id System
/dev/sdb1 1 409639 204819+ ee EFI System Partition
/dev/sdb2 * 409640 16795200 16385560 83 Linux raid autodetect (/)
/dev/sdb3 16795201 1449823703 708126159 82 Linux swap
Finish your debian installation. Install GRUB in MBR.
Step 5 – Setup rEFIt
Now, if you try to boot the Mac Mini, the process will fail. Don’t worry. Is time to recover the boot.
You need for this step:
- USB memory stick burned in the Step 2 (MacOS X recovery disk)
- USB memory stick burned in the Step 3 or the CD-ROM (rEFIt)
Plug the MacOS X recovery USB and boot the Mac Mini pressing the Alt key. Select the recovery drive to boot. Select your language and in the toolbar select “Terminal”.
In the terminal we need to copy some files form the rEFIt ISO to the EFI partition. Mount the partition with the EFI (default /dev/disk0s1) in one folder. Check the EFI partition with:
diskutil list
Now, mount the EFI partition. I created a folder in the tmpfolder of the user to do it (not /tmp because is read-only):
mkdir tmp/efi
sudo mount -t msdos /dev/disk0s1 tmp/efi
Check if is mounted with
mount
Remember the full path of the tmp folder (e.g. /youhomefolder/tmp)
Now you can change to the tmp/efi folder and check the files (sometimes is empty, but I had a APPLE folder, don’t do nothing (erase,…)). Now, create an efi folder in the EFI partition:
cd /yourhomefolder/tmp/efi
mkdir efi
Now mount the ISO or the USB drive (yourEFIdevice):
cd /yourhomefolder/tmp/
mkdir origin
mount yourEFIdevice /yourhomefolder/tmp/origin
and copy:
cp -r /yourhomefolder/tmp/origin/efi /yourhomefolder/tmp/efi/
Now, you will have the efi folder in /yourhomefolder/tmp/efi/. Probably these previous steps could be done using Linux or as first step (with MacOS X), but I did at the end of the process. Time to run bless:
bless --mount /efi --setBoot --file /yourhomefolder/efi/efi/refit/refit.efi --labelfile /yourhomefolder/efi/efi/refit/refit.vollabel
Ok, done. Shutdown the computer, remove the USB/CD-Rom drives and boot the system. Wait. Wait More. Now rEFIt shows their menu (http://refit.sourceforge.net/screen.html)
Don’t boot Linux yet, the partition table must synchronized with the GPT partition table. This gives legacy operating systems and boot loaders access to hard disk partitions. To do this step you have two options, select it in the menu (with keypad and hit enter) or run the rEFIt shell and run “gptsync.efi”.
Reboot your Mac, wait, wait more, rEFIt boot screen, wait more, wait. GRUB is here, wait, Debian is booting. Enjoy.
Comments are welcome.