Installing Ubuntu or Kubuntu, 6.06.1 LTS "Dapper Drake", on a Single/Multi -Boot RAID System - Page 3
Activating the New System
"Activate" the new, virtual installation:
chroot /install
mount -t proc proc /proc
mount -t sysfs sysfs /sys
Create a replacement apt software package source file to install everything from a DVD disc, but to avoid downloading updates:
cp /etc/apt/sources.list /etc/apt/sources.list.full
echo "# `date`" > /etc/apt/sources.list
echo "deb file:/cdrom $SETUP_UBUNTU_VER main restricted" >> /etc/apt/sources.list
echo "deb http://archive.ubuntu.com/ubuntu $SETUP_UBUNTU_VER main restricted" >> /etc/apt/sources.list
The file:/cdrom entry instead of apt-cdrom add is used in sources.list to avoid re-mounting problems.
Sample:
# Sun Jan 28 11:21:48 UTC 2007 deb file:/cdrom dapper main restricted deb http://archive.ubuntu.com/ubuntu dapper main restricted
Request that system software package manager, apt, refreshes its list of available packages:
apt-get update
Setup a default locale and a local time zone:
locale-gen $SETUP_LOCALE
tzconfig
We will need the Feisty Fawn RAID subsystem in our new installation as well, so re-install dmraid from a locally downloaded deb archive, using dpkg:
apt-get install wget
wget http://tormod.freeshell.org/linux/dmraid/dmraid_1.0.0.rc13-2ubuntu2tormod~dapper_i386.deb
dpkg -i ./dmraid_1.0.0.rc13-2ubuntu2tormod~dapper_i386.deb
rm ./dmraid_1.0.0.rc13-2ubuntu2tormod~dapper_i386.deb
Setup fstab, a file describing our filesystems, used by the operating system itself, apt, and other user applications:
echo "# `date`" > /etc/fstab
echo "proc /proc proc defaults 0 0" >> /etc/fstab
echo "sys /sys sysfs defaults 0 0" >> /etc/fstab
echo "$SETUP_DEV_SWAP none swap sw 0 0" >> /etc/fstab
echo "$SETUP_DEV_ROOT / reiserfs defaults 0 1" >> /etc/fstab
echo "$SETUP_DEV_BOOT /boot ext3 defaults 0 2" >> /etc/fstab
echo "/dev/cdrw /cdrom iso9660,udf noauto,owner,ro 0 0" >> /etc/fstab
Sample:
# Sun Jan 28 06:23:56 EST 2007 proc /proc proc defaults 0 0 sys /sys sysfs defaults 0 0 /dev/mapper/isw_eaaicdchgi_Volume06 none swap sw 0 0 /dev/mapper/isw_eaaicdchgi_Volume07 / reiserfs defaults 0 1 /dev/mapper/isw_eaaicdchgi_Volume05 /boot ext3 defaults 0 2 /dev/cdrw /cdrom iso9660,udf noauto,owner,ro 0 0
Instruct the kernel installer how to create image files and image links. Using relative symlinks will ensure that your system will boot without problems across kernel upgrades:
echo "# `date`" > /etc/kernel-img.conf
echo "image_in_boot = 1" >> /etc/kernel-img.conf
echo "do_symlinks = 1" >> /etc/kernel-img.conf
echo "relative_links = 1" >> /etc/kernel-img.conf
echo "warn_initrd = 0" >> /etc/kernel-img.conf
Install a kernel and an Ubuntu base distribution:
apt-get install ubuntu-base
apt-get install linux-$SETUP_CPU_UBUNTU
Synchronize the system clock with an NTP (Network Time Protocol) server over the Internet:
apt-get install ntp ntpdate
Create a new system user and allow it to execute commands as root:
useradd -m -s /bin/bash $SETUP_USER
passwd $SETUP_USER
echo "$SETUP_USER ALL=(ALL) ALL" >> /etc/sudoers
Disable root login altogether for security reasons:
passwd -l root
Install GRUB, a boot loader, and setup its basic file structure:
apt-get install grub
mkdir /boot/grub
cp /lib/grub/$SETUP_CPU_GRUB/* /boot/grub/
Assemble a GRUB batch file and instruct GRUB to install itself on your hard disk. We use perl to extract a boot partition number and subtract 1 from it, in order to change it into a boot partition index that GRUB expects:
export SETUP_GRUB_ROOT=`perl -e "print substr(\"$SETUP_DEV_BOOT\",length(\"$SETUP_DEV_HDD\"), length(\"$SETUP_DEV_BOOT\")-length(\"$SETUP_DEV_HDD\")) - 1"`
echo "device (hd0) $SETUP_DEV_HDD" > /boot/grub/grub.batch
echo "root (hd0,$SETUP_GRUB_ROOT)" >> /boot/grub/grub.batch
echo "setup (hd0)" >> /boot/grub/grub.batch
Sample:
device (hd0) /dev/mapper/isw_eaaicdchgi_Volume0 root (hd0,4) setup (hd0)
cat /boot/grub/grub.batch | grub --batch
Assemble a GRUB boot menu control file:
echo "# `date`" > /boot/grub/menu.lst
echo "default 0" >> /boot/grub/menu.lst
echo "timeout 8" >> /boot/grub/menu.lst
echo "### BEGIN AUTOMAGIC KERNELS LIST" >> /boot/grub/menu.lst
echo "title Ubuntu Linux" >> /boot/grub/menu.lst
echo "root (hd0,$SETUP_GRUB_ROOT)" >> /boot/grub/menu.lst
echo "kernel /vmlinuz root=$SETUP_DEV_ROOT ro quiet splash" >> /boot/grub/menu.lst
echo "initrd /initrd.img" >> /boot/grub/menu.lst
echo "### END DEBIAN AUTOMAGIC KERNELS LIST" >> /boot/grub/menu.lst
If you use Windows, add it as a boot option as well (recall the SETUP_GRUB_WIN environment variable you have created earlier?):
export SETUP_GRUB_ROOT=`perl -e "print substr(\"$SETUP_DEV_WIN\",length(\"$SETUP_DEV_HDD\"), length(\"$SETUP_DEV_WIN\")-length(\"$SETUP_DEV_HDD\")) - 1"`
echo "title Windows" >> /boot/grub/menu.lst
echo "rootnoverify (hd0,$SETUP_GRUB_WIN)" >> /boot/grub/menu.lst
echo "chainloader +1" >> /boot/grub/menu.lst
Sample:
# Sun Jan 28 06:28:23 EST 2007 default 0 timeout 8 ### BEGIN AUTOMAGIC KERNELS LIST title Ubuntu Linux root (hd0,4) kernel /vmlinuz root=/dev/mapper/isw_eaaicdchgi_Volume07 ro quiet splash initrd /initrd.img ### END DEBIAN AUTOMAGIC KERNELS LIST title Windows rootnoverify (hd0,0) chainloader +1
Users of the latest ATI and NVIDIA graphics cards (such as GeForce 8800, ...) might want at this point to install envy, an automated vendor driver installer:
wget http://albertomilone.com/ubuntu/nvidia/scripts/envy_0.8.1-0ubuntu3_all.deb
dpkg -i ./envy_0.8.1-0ubuntu3_all.deb
rm ./envy_0.8.1-0ubuntu3_all.deb
The Moment of Truth: Booting
Reboot into the new installation:
shutdown -r now
Once booted, login as the user created previously, re-acquire root privileges, and re-mount the DVD disc:
sudo -s
apt-cdrom add
If you run into mount errors, replace /dev/cdrw (a burner drive) with /dev/cdrom (a read-only drive) in your fstab file, using sed, and retry:
sed -i -e 's/^\/dev\/cdrw/\/dev\/cdrom/g' /etc/fstab
apt-cdrom add
Request that system software package manager, apt, refreshes its list of available packages:
apt-get update
Choose a graphical desktop environment, ubuntu for GNOME, kubuntu for KDE:
export SETUP_DESKTOP_ENV=kubuntu
Install your desktop environment, make sure to select a preferred or a native LCD resolution when asked to Select the video modes... by the installer.
apt-get install fontconfig
apt-get install $SETUP_DESKTOP_ENV-desktop
Restore the full apt package source list, request that system software package manager, apt, refreshes its list of available packages, and upgrade the entire system:
mv /etc/apt/sources.list.full /etc/apt/sources.list
apt-get update
apt-get dist-upgrade
Users of the latest ATI and NVIDIA graphics cards (such as GeForce 8800) might want at this point to launch envy, an automated vendor driver installer:
envy
Start the desktop:
startx
Optional: a Graphical Boot Loader
Replace the not-so-hot textual GRUB with a graphical boot menu screen.
Start a web browser and visit this thread in Ubuntu Forums. Choose a theme file, download it, and save it to your home directory. I chose the red message.new theme.
Unpack the theme file and move it to your boot partition:
cd
tar xvf message.new.tar.gz
mv message.new /boot/
rm ./message.new.tar.gz
Download GRUB-GfxBoot using a web browser and save it to your home directory. Uninstall the textual GRUB and install the graphical version:
cd
apt-get remove grub
dpkg -i ./grub-gfxboot_0.97-5_i386.deb
rm ./grub-gfxboot_0.97-5_i386.deb
Re-setup your environment variables:
export SETUP_DEV_HDD=/dev/mapper/isw_eaaicdchgi_Volume0
export SETUP_DEV_BOOT=/dev/mapper/isw_eaaicdchgi_Volume05
export SETUP_GRUB_ROOT=`perl -e "print substr(\"$SETUP_DEV_BOOT\",length(\"$SETUP_DEV_HDD\"), length(\"$SETUP_DEV_BOOT\")-length(\"$SETUP_DEV_HDD\")) - 1"`
export SETUP_CPU_GRUB=i386-pc
Re-copy GRUB library files to your GRUB staging directory on the boot partition:
cp /lib/grub/$SETUP_CPU_GRUB/* /boot/grub/
Re-initiate GRUB:
cat /boot/grub/grub.batch | grub --batch
Insert a gfxmenu keyword on top of GRUB's menu control file:
sed -i -e "1igfxmenu (hd0,$SETUP_GRUB_ROOT)/message.new" /boot/grub/menu.lst
Enjoy
Enjoy your new Ubuntu installation!