In the summer of 2005, Linux came into my life. I know to many of you that doesn't seem like so long ago, but in the years since I have developed quite an attachment to Linux; without it nearby I feel lost and trapped, and somehow computers just aren't as fun. But now I have a MacBook(!), and I must confess, Leopard is quite a piece of software. Still, Linux is Linux. 'Nuf said. Normally I'd just dual boot, but this time I thought I'd try virtualization. With a Core 2 Duo 2.4 GHz and 2 GB of RAM, why not?
Following is an instructional record of how I've installed openSUSE 11 in VirtualBox 1.6 on Mac OS X Leopard. (Ok so that was a mouthful).
Prerequisites:
First and foremost, you'll need to download and install VirtualBox. While you're getting that, also grab the 32-bit version of openSUSE 11, but don't burn it to a CD. I'm using the the KDE 4 LiveCD.
Creating a VM
Once you have VirtualBox up and running, go ahead and create a new virtual machine by clicking the "New" button. The wizard is very straightforward and easy to use. We'll call this new machine "SUSE" and set the OS Type as "openSUSE." We'll give it 512 MB of RAM instead of the default 256.
Part of setting up your new virtual machine is creating a virtual hard disk to go with it. VirtualBox allows you to make either a dynamically expanding drive which grows as you use more space, or a drive of fixed size. I've chosen to create a fixed-size drive of just 8 GB (of my 160) for openSUSE. Later on we'll create a shared folder for ~/Documents, so that anything we save in Linux will be easily accessible in OS X.
openSUSE Installation
Finish the wizard, and oila! there's your new machine. Power it on by hitting the "Start" button, and you'll arrive at another wizard. For "Media Type," choose CD/DVD-ROM, and for for "Media Source," click "Image File." Then browse for and select the openSUSE CD image you downloaded earlier. Finish the wizard and you'll soon see the familiar green of openSUSE.
Important!! For now, while your VM's window has focus it will capture your keyboard, and if you click inside it, it will also capture your mouse. To regain the use your mouse and keyboard in OS X, hit the left command button.
Close the initial welcome screen in openSUSE, and click the Install icon. The YaST2 installer should open. When setting your VM's time, be sure to clear the "Hardware Clock Set to UTC" checkbox. Otherwise your it'll be way off.
For partitioning, click the "Edit Partition Setup" button. Delete /dev/sda3 and resize /dev/sda2 to fill the resulting space. Then continue on with the wizard.
When the installer asks you to reboot and to eject the CD, just hit OK and reboot. As soon as it begins to boot again, click the little CD symbol at the bottom of the VM window to unmount the CD. If you don't get it before the VM starts reading the disk, don't worry. Just unmount it and boot from the hard disk. You'll probably get an error and the VM will reboot, this time not off the CD.
Pretty soon, you have a brand new install of openSUSE 11 completed. Congrats!
Guest Additions
Now I don't know about you, but the first thing I wanted to do was get openSUSE to fill my screen like Leopard--800x600 just doesn't cut it. To do this (and other things) correctly, you'll need to install VirtualBox's Guest Additions on the guest (openSUSE). Interestingly enough, openSUSE 11 probably installed Guest Additions automatically (at least it did for me). For whatever reason, the Guest Additions which come with openSUSE 11 don't seem to work, even if fully updated. So go ahead and uninstall them by going to YaST->Software Management (see screenshots). Search for "virtualbox", and get rid of 'em.
While you're at it, install gcc, make, automake, and kernel-source by searching for them and checking their boxes. When you're done, perform a full online update with YaST->Online Update (Guest Additions won't install without it).
Note: after the update, you should have a pretty good virtual install of openSUSE. Part of the fun of virtualization is that you can mess around as much as you want without really hurting things. Of course, if you do break your virtual machine, it'll still be a time consuming process to reinstall the OS, do an update, etc.. So before you go any further, make a snapshot of your VM's current state by first selecting your virtual machine in the main VirtualBox window, and then going to the Snapshots tab and clicking the camera button. That way, if your VM does go down the tubes, you you can just revert to your snapshot. You'll be up and having fun again in no time.
Now to install the ones that work, make sure your openSUSE window has focus, then click the "Devices" menu on the OS X menu bar, and click "Install Guest Additions" at the bottom. You'll probably notice some text appear on the VM status bar saying, "Mount the Guest Additions installation image."
So let's do that. Again in the Devices menu, go to Mount CD/DVD-ROM->CD/DVD-ROM Image. You should see VBoxGuestAdditions.iso. Select it. Now go into your SUSE VM. You'll need a command line, so hit fn+ctrl+option+F1 (just ctrl+option+F1 if you don't use your function keys for brightness controls, etc.). Login as root with the password you entered on installation, and enter these commands:
cd /mnt
mkdir cd
mount /dev/sr0 cd
cd/VBoxLinuxAdditions.run
reboot
Once openSUSE has rebooted, hit left command+F and left command+G. You'll probably need to logout before you see the effect, but that should make your openSUSE install recognize the correct resolution of your monitor and resize accordingly (hitting left command+F will take you back out of fullscreen mode).
Now the last thing we need to do is to make your Documents folder in Linux accessible in Mac OS X. First, let's make the shared folder. In the Devices menu, go to Shared Folders and in the Shared Folders window, click the folder icon with the plus sign to add one. Remember what you name your new share--you'll need to enter it into one of the following commands.
In openSUSE, get a command line again (fn+ctrl+option+F1 and login as root), and issue this command:
mount -t vboxsf [insert sharename] /home/[insert username]/Documents
Hit fn+ctrl+option+F7 to get back to the GUI. Congratulations! You've just found another use for your multiple cores! ;-)
Labels: Mac, OS X, VirtualBox