Tuesday, January 31, 2006

Install a Debian system in Gentoo

Prepare a spare partition and mount it somewhere, say /mnt/debinst. Install debootstrap and run it:
Code:
# emerge -av debootstrap
# debootstrap --arch i386 sarge /mnt/debinst http://ftp.hk.debian.org/debian/


You can substitute any Debian archive mirror for http://ftp.hk.debian.org/debian/ in the command above, preferably a mirror close to you network-wise. Mirrors are listed at http://www.debian.org/misc/README.mirrors. If you have a sarge Debian GNU/Linux CD mounted at /cdrom, you could substitute a file URL instead of the http URL: file:/cdrom/debian/

Now chroot into the Debian system:
Code:
# chroot /mnt/debinst /bin/bash


Prepare a /etc/fstab and mount proc:
Code:
# nano -w /etc/fstab
# mount -t proc proc /proc


To configure networking, edit /etc/network/interfaces (take a look at /usr/share/doc/ifupdown/examples/network-interfaces.gz):
Code:
cat > /etc/network/interfaces << "EOF"
######################################################################
# /etc/network/interfaces -- configuration file for ifup(8), ifdown(8)
# See the interfaces(5) manpage for information on what options are
# available.
######################################################################

# We always want the loopback interface.
#
auto lo
iface lo inet loopback

# To use dhcp:
#
auto eth0
iface eth0 inet dhcp

# An example static IP setup: (broadcast and gateway are optional)
#
# auto eth0
# iface eth0 inet static
# address 192.168.0.42
# network 192.168.0.0
# netmask 255.255.255.0
# broadcast 192.168.0.255
# gateway 192.168.0.1
EOF


and /etc/hostname:
Code:
# echo DebianHostName > /etc/hostname


Set your timezone, add a normal user, and choose your apt sources by running:
Code:
# /usr/sbin/base-config new


To configure locale settings and upgrade glibc:
Code:
# apt-get install locales


Install a kernel:
Code:
# apt-cache search kernel-image
# apt-get install kernel-image-2.X.X-arch-etc


You should add modules you want automatically loaded to /etc/modules.
Now install a couple of system tools:
Code:
# apt-get install grub reiserfsprogs hdparm sudo hotplug
(If you want to install grub, do the following:)
# grub-install /dev/hda
# update-grub


Install some X stuff:
Code:
# apt-get install x-window-system-core kde-core mozilla-firefox


Now add an entry for your newly installed Debian system in your grub.conf and reboot!