Sunday, December 21, 2008

Installing Ubuntu Using Knoppix CD

I'm trying to avoid the cycle of cleaning viruses and spyware from my nephew Dell Windows Desktop despite having the latest AntiVirus program installed on it. I'm attempting to install Ubuntu using debootstrap on a (Knoppix CD). (additional reference)

- Desktop is a Dell Dimension E510
- Booted using the Knoppix CD. Wireless keyboard works with Knoppix. How convenient.
- Tried to start kwlan to connect to Wireless network. Doesn't work. Oh well, wired lan connection works at least.
- Using fdisk, formatted /dev/sda into /dev/sda1 with ~158GB and /dev/sda2 with remaining ~2GB
- Rebooted to ensure newly created partitions.
- Formatted /dev/sda1 using ext3
# mke2fs -j /dev/sda1
- Set /dev/sda2 as swap

# mkswap /dev/sda2
# sync; sync; sync
# swapon /dev/sda2
- Next, mount the newly formatted hdd.
# mkdir /mnt/ubuntu
# mount /dev/sda1 /mnt/ubuntu
- Setup debootstrap
# mkdir /mnt/ubuntu/work
# cd /mnt/ubuntu/work
# wget http://archive.ubuntu.com/ubuntu/pool/main/d/ \
debootstrap/debootstrap-udeb_0.3.3.0ubuntu2_i386.udeb
# ar -x debootstrap-udeb_0.3.3.0ubuntu2_i386.udeb
# cd /
# zcat /mnt/ubuntu/work/data.tar.gz | tar xv
- This is still missing the latest intrepid scripts. Install those.
# mkdir /mnt/ubuntu/work/tmp
# cd /mnt/ubuntu/work/tmp
# wget http://archive.ubuntu.com/ubuntu/pool/main/d/ \
debootstrap/debootstrap-udeb_1.0.10ubuntu1~intrepid1_all.udeb
# ar -x debootstrap-udeb_1.0.10ubuntu1~intrepid1_all.udeb
# cd /
# zcat /mnt/ubuntu/work/data.tar.gz | tar xv

- I chose the closest Ubuntu archive mirror.
- Run debootstrap

# /usr/sbin/debootstrap --arch i386 intrepid \
/mnt/ubuntu http://www.gtlib.gatech.edu/pub/ubuntu
- After the base system in installed, need to configure it.
# chroot /mnt/ubuntu /bin/bash
- Setup static file system information
# editor /etc/fstab
# /etc/fstab: static file system information.
#
# file system mount point type options dump pass
/dev/sda1 / ext3 defaults 0 1
/dev/sda2 none swap sw 0 0
proc /proc proc defaults 0 0
sys /sys sysfs defaults 0 0
/dev/cdrom /mnt/cdrom iso9660 noauto,ro,user,exec 0 0
- Mount all the above filesystems
# mount -a
- /proc didn't mount for some reason. Mounted it manually.
# mount -t proc proc /proc
- ls /proc shows a non-empty directory. Ok.
- Configure keyboard. I didn't change any default choices.
# dpkg-reconfigure console-setup
- Configure networking. I setup only loopback and eth0 from examples in /usr/share/doc/ifupdown/examples
# editor /etc/network/interfaces

auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp
- Setup hostname
# echo ubuntupc > /etc/hostname
- Install kernel and bootloader
# apt-get install linux-image-386
# apt-get install grub
- 'grub-install' doesn't work for whatever reason. This is probably has something to do with the chroot ubuntu system being unable to see /dev/sda. Why? Not sure. I exited chroot and ran grub-install from Knoppix
# exit
# grub-install --root-directory=/mnt/ubuntu /dev/sda1
- chroot again and setup menu.lst. 'update-grub' is supposed to do this automatically. But it didn't work for me. So setting it up manually.
# chroot /mnt/ubuntu /bin/bash
# editor /boot/grub/menu.lst
default 0
timeout 4

title=Ubuntu
root (hd0,0)
kernel /vmlinuz root=/dev/sda1
initrd /initrd.img

- That's it. exit and reboot.
# exit
# reboot
UPDATE: Looks like either I missed a step above or something didn't work, but grub didn't write to MBR. Rebooted to Knoppix CD and installed grub in MBR.
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
That's it. This time on reboot, Ubuntu booted normally.

UPDATE 2: I setup the GUI desktop for Ubuntu too.
# apt-get install ubuntu-standard
# apt-get install ubuntu-desktop