1.
Start with VirtualBox. It’s a virtual machine tool for MacOS (and others).
I’ve not worked much with virtual machines but this absolutely rocks. You just
create a virtual machine, tell it how much RAM, HDD, etc you want. You can
manipulate all the IO devices easily. Just download an .iso file or link the
CDROM drive to the real drive in your computer and off you go.You can also make
snapshots of the entire state machine and thus installation and configuration
are way easier, if you’re ever unsure. And believe me I made a lot of mistakes
along the way.So create a virtual box. Give it +500MB RAM and 5GB HDD.
2.
Download mini.iso from
Ubuntu. Link this file to your virtual CDROM drive and start the machine.
Ubuntu will boot a minimal LiveCD system and allow you to install a Ubuntu
system on your virtual Drive. Instead of selecting individual packages I chose
the “Xubuntu” preconfig.
3.
Remove the virtual CD and reboot.
Using Firefox download Chrome 16 (or later). You should download the .deb
package since Ubuntu is derived from Debian. Set the user to “username” and
give it a password. You’ll need this in the following setup process.
4.
Open a terminal. Navigate to where
the .deb file got downloaded to and do:
sudo dpkg –i google-chrome*.deb
This will
likely throw some unsatisfied dependencies.
Resolve them by using
sudo apt-get install [package name ]
Then re-issue the dpkg command :
sudo dpkg –i google-chrome*.deb
Start chrome with
/opt/google/chrome/chrome
Set up chrome the way you like. In
my case I had to install a plugin and configure it.
5.
Next install remastersys.
First you need to get a security key from remastersys and then register their
site in /etc/apt/sources.list so that apt-get will know where to get it
from. Simply do:
wget http://www.remastersys.com/ubuntu/remastersys.gpg.keysudo apt-key add
remastersys.gpg.key Then, add the following line that corresponds to your
version of Ubuntu to your /etc/apt/sources.list
#Remastersys Lucid
deb http://www.remastersys.com/ubuntu lucid main
#Remastersys Maverick
deb http://www.remastersys.com/ubuntu maverick main
#Remastersys Natty
deb http://www.remastersys.com/ubuntu natty main
#Remastersys Oneiric
deb http://www.remastersys.com/ubuntu oneiric main
In my case it was the last one.
Now you just need to do:
sudo apt-get update
sudo apt-get install remastersys
6.
Do a ‘df’, and you’ll see your
system is currently about 2.2GB (at least it was in my case). This,
compressed, will make an .iso file that is about 750MB, which unfortunately
doesn’t fit on a CD. So to get the final LiveCD ISO to be as small as possible
we want to loose all the weight we don’t need. This was slightly tricky and
required a few attempts to get right. It was important to preserve all Chrome
functionality, auto Xstart capability and all sound playing ability. I
definitely screwed up each of these at least once.
So therefore the next step is to
Make a
snapshot of the Virtual Machine using VirtualBox
7.
Now, go and do
sudo apt-get install aptitude
sudo aptitude
I went in an removed a lot of
stuff, all window managers, firefox, editors, graphics programs, documentation,
etc etc. All sorts of crap you don’t need.
You need to make sure to not remove
anything that what you need is dependent on though! I did this largely by trial
and error. I’d choose enough packages to loose about 200MB (Aptitude will tell
you in the upper right hand corner how much its removing) and let you know
about dependenceies. I’d then hit ‘g’ remove the packages, quit aptitude,
reboot the machine (sudo reboot) and see if chrome and X and sound still
worked. If so I’d make another snapshot on VirtualBox and continue, if not I’d
go back to the last snapshot and try again.
Apparently I needed to preserve
certain parts of Gnome and importantly GDM. Also ALSA sound drivers need to
stay obviously. There’s a lot of stuff that seems like it’s not needed but
essential parts are dependent on it. Anyway, I managed to reduce the
system size to about 1.35 GB, which awesomely reduces down to an .iso of about
450MB!
8.
Ok, so I wanted the system to just
boot straight into Chrome running in X, alone, with not window managers,
nothing.
So you need to add these lines to /etc/gdm/custom.conf:
AutomaticLoginEnable=true
AutomaticLogin=[username]
(replacing [username] with your
username of course. And to get chrome to start up create a script
~/start_chrome.sh:
#!/bin/sh
/opt/google/chrome/chrome http://www.mystartsite.com
and make it executable:
chmod 755 ~/start_chrome.sh
then edit ~/.xsession (or create it
if it’s not already there) and add
#!/bin/sh
/home/[username]/start_chrome.sh
Just in case make that file
executable too
9.
Ok, you’re set. Reboot. Hopefully
you’ll end up in X without any login prompts in chrome loading your favourite
page. Now you wont have any menus or whatever – so to break out into a
shell press Ctrl+Alt+F1 (add fn if on a Mac). (This always works on X
btw). Ok, now back in the shell. Be sure to remove any temporary
files which are no longer needed, as space on a CD is limited. A classic
example is downloaded package files, which can be cleaned out using:
sudo aptitude clean
sudo rm -rf /tmp/* ~/.bash_history
sudo rm /etc/hosts
sudo rm /var/lib/dbus/machine-id
10. Ok, so assuming you’re happy with your setup, to
create the actual .iso image, you just have to do:
sudo remastersys backup livecd.iso
It should place the file livecd.iso
in /home/remastersys/remastersys/
11. You could try and burn that .iso to a real CDROM by
linking up your real drive to the virtual machine with VirtualBox.
cdrecord dev=/dev/cdrom livecd.iso
I didn’t try that. Instead, to get
that file out of the virtual machine I just used scp and uploaded it to antoher
ssh server of mine and then downloaded it back to my Mac and just used DiskUtil
to burn the CD. Now that is clearly stupid. A better way might be to mount
another, real, drive inside the virtual machine or a USB stick. Again I didn’t
try this but it seems very reasonable. Even better would be to have a way to
mount the VirtualMachine’s drive (it’s a .vdi file) somehow on the Mac but
I wasn’t able to find a way to actually do that. Seems like it should
be no brainer. Anyway. You can also test you .iso by creating another
virtual machine on VirtualBox and shoving the new .iso in the virtual CD drive.
I recommend doing that before burning a physical CD since it will save you time
if something messed up. Anyway, all this was a lot of fun and a very neat
way to deal with readymade systems.
Another cool thing would be to burn
the iso to a thumbdrive. I had some success in making bootable thumbdrives
using a windows machine. I tried doing the same on a Mac and it just would not
boot anywhere even though the filesystems etc were set up ok on the
drive. Having the bootable system on the drive is superior in the sense
that any post-boot changes you make (like cookies etc). will be remembered on
the next boot, while they’re totally lost on the CD.