Saturday, January 2, 2016

How to install (K)Ubuntu alongside Yosemite and Windows 8 on Mac Book Pro?

Here let's see how we can install Windows 8 and (K)ubuntu 15.10 (Wily Werewolf) along side Mac Yosemite as triple boot.

Software/Hardware required

  • Mac book Pro 11,1 (instruction might be similar for newer models)
  • Yosemite
  • Windows 8
  • (K)Ubuntu 15.10  Wily Werewolf (might work with 15.04 as well)
  • Refind (not reEFIt)
Here is the summary of what we are going to do.
  1. Partition mac to have windows boot-camp partition 
  2. Install windows 8
  3. Create two new partitions from mac partition for Linux
  4. Install (K)ubuntu
  5. Fix GPT-MBR
  6. Install Refind

Step-0

In case you want to backup your mac: 
  1. Restart mac and hold 
  2. This will boot Mac in recovery mode as shown below   
  3. Plugin an external drive and choose Disk Utility option
  4. Select the mac partition (not your hard disk root) and go to restore tab
  5. Choose your external drive as the destination as shown below
  6. Important: ensure that your mac partition is the Source
  7. Click Restore to take a copy of Yosemite
  8. You are done. Close all the windows and restart

Step-1 & 2

Create a bootcamp partition using bootcamp software and install windows 8. This is part is pretty straight forward; hence we will not go in detail. But the point to remember is that you need to leave more space for Yosemite as we are going to carve out Linux partition from there. 
eg.

Step-3

Create two Linux partitions out of Yosemite partition as show below.

Here we are going to use one for '/' partition and the other for 'swap' partition. Create them as HFS+ (Journaling File System) as they are easy to resize.

Caution: DO NOT RESIZE BOOTCAMP PARTITION

After this step restart into Yosemite and Windows once to ensure that you are able to boot into them properly.

Step-4

Download Kubuntu from here. Write it to a pendrive (instructions can be found here). Restart mac and hold option key








Follow the instructions on screen and install Kubuntu on the respective partitions. 
Caution: Remember to install grub on '/' partition  of Linux (/dev/sda4 in my case) and NOT ON /dev/sda (the hard disk root)
At this point you can boot to Yosemite but you will not be able to boot to Windows. Don't worry; we will fix it.

Step-5

  1. Restart and hold option key; boot to Yosemite. (you can also do this from Kubuntu, in which case you can skip the next step)
  2. Install gdisk from here.
  3. Run sudo gdisk /dev/disk0 (assuming your hard disk is /dev/disk0)
  4. gdisk should launch and tell you, among other things, MBR: hybrid.
  5. Before installing Kubuntu this was  MBR: protective Hence we need to convert it back to  MBR: protective
  6. Type p to view the partition table. Assuming you know enough about your partitions, you should be able to verify that you're looking at the right disk. If not, type q to quit and try another disk device.
  7. Type x to enter the experts' menu.
  8. Type n to create a fresh protective MBR to replace your existing hybrid MBR.
  9. Type p again to verify that your partitions are all still in place. This is just a precaution to ensure you didn't accidentally hit the wrong key.
  10. Type w to save your partition table. You'll be asked to verify this action. Do so.
(Courtesy: http://askubuntu.com/a/650302)

Step-6

At this point you will be able to hold option key and boot to Windows or Yosemite. But you will not see an option to boot to (K)ubuntu. Restart to Yosemite and install Refind from here. (All you need to do is to open the dmg file and drag and drop ./refind-install file to terminal)

That's it. You are done. No more holding of option key. You will get a pretty menu option when you restart your mac (something similar to the one below)
rEFInd presents a graphical menu for selecting your
    boot OS.