Thursday, June 2, 2011

Debootstrap

This is to install a minimum ubuntu. It can be used to install to any folder, i.e. some local folder on which to chroot later, or a mounted drive.

First install the debootstrap package
sudo apt-get install debootstrap

Then start the job:
sudo debootstrap --arch i386 hardy /mnt http://sg.archive.ubuntu.com/ubuntu

This will install hardy on /mnt by downloading all required packages from the singapore archive.

Then chroot in the new created environment: sudo chroot /mnt
create a root passwd: passwd
write /etc/fstab, /etc/network/interfaces and /etc/hostname
mount proc and pts:
mount -t proc proc /proc
mount -t sysfs sysfs /sys
mount -t devpts devpts /dev/pts
configure language: apt-get install language-pack-en
under Debian: apt-get install locales; dpkg-reconfigure locales
install a kernel and GRUB: apt-get install linux-image grub

write MBR and create GRUB images:
(from outside the chroot, i.e. from a normal console): sudo grub-install --root-directory=/mnt /dev/sdc
This will install the GRUB images in /mnt/boot/grub and write the MBR on disk sdc
Then from the chroot environment: update-grub
this will write a menu.lst (the GRUB config) for you

then install whatever you want using apt-get

No comments:

Post a Comment