Installing Gentoo Linux


Here's what I learned while installing Gentoo over the Net using the x86 version of "Gentoo 2006.0 Minimal CD/InstallCD". Do not read the Linux 2006.0 x86 Handbook, as this is meant for networkless installation, and read Gentoo Linux x86 Handbook instead.

If you are using an on-board LAN adapter such as the nVidia port (driver) on an ASRock motherboard, it might not be supported by standard kernels. In this case, either use a full CD, or borrow a standard PCI LAN adapter just to install Gentoo and the required LAN driver. Once you're up and running, you can download and install the nVidia driver for the on-board LAN and audio adapters.


We'll install Gentoo through the Net using the Mininal CD:

  1. Get a Linux-friendly network card, make sure a DHCP server is available to give this host an IP configuration, burn the ISO image, and boot from the CD
  2. After you get a prompt, if you are not using a US keyboard, you might need to reload the layout using the loadkeys command followed by the ISO name of the layout, eg. loadkeys fr
  3. Partition your hard disk using either fdisk or cfidsk
  4. Create filesystems using eg. mke2fs /dev/hda1
  5. Initialize the swap partition, eg. mkswap /dev/hda2 ; swapon
  6. Mount and move into the new hard disk: mount /dev/hda1 /mnt/gentoo ; cd /mnt/gentoo
  7. Use the date command to check that the date is correct (must be in the format MMDDhhmmYYYY)
  8. Download a stage3 file (i586, i686, x86?) and Portage from a mirror using "links"; Stages are located in /releases/x86/2006.0/stages/ , while Portage files are located under /snapshots
    1. Unpack the stage3 tar file: tar xvjpf stage3.tar.bz2
    2. Unpad the Portage file: tar xvjf /mnt/gentoo/portage-<date>.tar.bz2 -C /mnt/gentoo/usr
  9. Add a list of mirrors in the Portage file: mirrorselect -i -o >> /mnt/gentoo/etc/make.conf
  10. Set the rsync servers: mirrorselect -i -r -o >> /mnt/gentoo/etc/make.conf
  11. Copy DNS info: cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
  12. Mount proc and dev: mount -t proc none /mnt/gentoo/proc ; mount -o bind /dev /mnt/gentoo/dev
  13. Chroot to the hard disk:
    1. chroot /mnt/gentoo /bin/bash
    2. env-update
    3. source /etc/profile
    4. export PS1="(chroot) $PS1"
  14. Update the Portage tree using rsync: emerge --sync . Do not update Portage itself at this point even if warned that a new version is available
  15. Configure the kernel:
    1. Set the timezone (let's use London): ls /usr/share/zoneinfo ; cp /usr/share/zoneinfo/Europe/London /etc/localtime
    2. USE="-doc symlink" emerge gentoo-sources
    3. Check that the source code was correctly used through ls -l /usr/src/linux
    4. emerge genkernel
    5. zcat /proc/config.gz > /usr/share/genkernel/x86/kernel-config-2.6
    6. emerge coldplug
    7. rc-update add coldplug boot
    8. find /lib/modules/2.6 -type f -iname '*.o' -or -iname '*.ko'
    9. nano -w /etc/modules.autoload.d/kernel-2.6



Even though we're prompted to choose a keyboard (eg. 16 for French), Gentoo forgets this setting, and reverts to US keyboard layout. To choose a new layout once Gentoo is up and running, use eg. "loadkeys fr".