Gentoo Linux 1.0_rc6 Installation Instructions Daniel Robbins Chris Houser Jerry Alexandratos Grant Goodyear Michael Lang This Gentoo Installation Guide walks you through the most common ways of installing Gentoo onto your x86-compatable system. The installation steps assumes you have some Linux experience and are comfortable with setting up disk partitions and creating filesystems. 1.5.0 14 March 2002 Getting Started
Overview

The Gentoo Distribution is what is known as a "build from scratch" meta-distribution which basically means that focus is on providing an easy method of building your entire Linux box directly from the source. Because of this, your primary objective in getting the installation going is to get your partitions prepped and then connected to the Internet so that the source code packages can be downloaded and built by the portage system.

To install Gentoo, you will need to have a 486+ processor and ideally at least 64 Megabytes of RAM.

Gentoo linux has been successfully built with 64MB of RAM and 64MB of swap space, but the build process is painfully slow under these conditions.

In addition to the "minimal build" CD, which has just enough tools to set up your partitions and connect to the Internet, there is an alternative "fast binary build" installation CD which contains everything you need pre-compiled for a "comfortable" system and is also covered here. This is handy for those in a rush and just want to get Gentoo up and running.

While the "Fast Binary Build" CD will get you up and running the fastest, you will be cheating yourself out of Gentoo's primary strength, which is building each and every package just for your machine and optimized specifically for your needs. In other words, you are encouraged to "build from scratch" as we feel the end result is more than worth it and the difficulty of doing so has been reduced to a fairly simple and elegant process.

The ISO images, when burned to CD, creates a CD that will boot from nearly any modern IDE CD-ROM drive, as well as many SCSI CD-ROMs. Included on the CD-ROM is Linux support for IDE (built-in to the kernel) as well as support for all SCSI devices (available as modules). In addition, modules for literally every kind of network card that Linux supports, as well as tools to allow you to configure your network and establish outbound ssh connections and download files.

Choosing an Installation Method

This document details several ways of getting Gentoo off the ground and running (Penguins don't fly, but this one might!). As such, choose your preferred method from below and skip ahead to the appropriate section:

  1. Download the fast binary build ISO image (~615 mb) and burn to CD. You will boot with this CD, configure your partition and then build your machine directly from the CD rather than from the Internet. Jump to Installing from Fast Binary Build Boot CD. You must have at least a Pentium class or better system to use this method. The other "from scratch" methods will work for all x86-compatable systems.

  2. Download the minimal build ISO image (~17 mb) and burn to CD. You will boot with this CD and then create your partitions and configure your network card to connect to the Internet where you can then begin the process of downloading and building your system directly from the source. Jump to Installing from Minimal Boot CD.

  3. Download the minimal build tarball file (~9 mb) to your existing linux system. You will piggy-back on your current distro's network configuration, prep a partition to hold Gentoo and get a basic working Gentoo sub-environment operational from which you can then download and build your complete Gentoo system. Jump to Installing from Existing Distro.
All ISO CD images and tarballs may be found at: http://www.ibiblio.org/gentoo/snapshots/build/

If you are planning on using the "minimal build" CD install method, you will want to use the "build-ix86" tbz2 image. But, if you are using the "fast binary" install method, you should use the "build-i586" tbz2 image. The "build-i586" image is included on the "build-i586" ISO; it contains a fully-bootstrapped i586-optimized Gentoo Linux system and a snapshot of our Portage tree. With the "build-i586" image, there is no need to boostrap or to run "emerge rsync" to grab the Portage tree from cvs.gentoo.org.
Installing from Fast Binary Build CD
Booting up

To begin installing with the fast binary Build CD, grab the latest (build-i586-1.0_rc6.iso at the time of this writing) ~614mb ISO file and burn to a blank CD then reboot your computer with this CD in the drive.

You may have to change boot device order in your CMOS Settings so that CD-ROM is checked before booting to Hard drive.

When the CD successfully boots, you will be greeted with a bunch of text and a boot: prompt at the bottom of the screen. At this prompt, hit enter, and Linux will begin loading from the CD.

Next, you'll be greeted with a small list of commands available on the boot CD, including nano (a pico editor clone) and instructions for setting up the network. Then, you'll be prompted to select your preferred keymap, followed by PCI autodection. The PCI autodetection process will automatically load the appropriate kernel modules for many popular PCI SCSI and ethernet devices. After this, you can hit enter to enter the minimal boot CD Linux environment. You should have a root ("#") prompt on the current console. You can also open new consoles by typing alt-f2, alt-f3, etc and then hitting enter.

Loading Hardware Access Modules

Now, if you want to be able to access any SCSI hardware that wasn't detected during the PCI autodetection process, you'll need to load the appropriate modules from /lib/modules, again using modprobe:

# modprobe aic7xxx
# modprobe sr_mod
# modprobe sd_mod

Above, we modprobe the aic7xxx SCSI driver and then make sure that SCSI CD-ROM (sr_mod) and disk (sd_mod) support is loaded.

hdparm is now included on -r10 and later of the iso. If any of your drives require tweaking, now would be a good time to do so. If you are doing a "fast binary" install and plan to use only those packages included on the CD, then setting up a network is not required. However, we always recommend doing it if possible since it can come in handy a lot of the time. To set up your network card, see instructions for Loading your Network Adaptor below.

You are now ready to start setting up your partitions. Jump to Setting up Partitions.

Installing from Minimal Build CD
Booting Up

To begin the install process, first grab the latest 16Mb build CD ISO image (build-ix86-1.0_rc6-r17.iso is the latest at the time this article was written) from from the images site noted above.

The Pentium+ fast binary CD can also be used as a "from scratch" CD for i486+ systems.

Once you're done downloading the ISO image file, burn the ISO image to a CD using your preferred CD burning software then boot your computer with the CD in the drive.

You may have to change boot device order in your CMOS Settings so that CD-ROM is checked before booting to Hard drive.

When the CD successfully boots, you will be greeted with a bunch of text and a boot: prompt at the bottom of the screen. At this prompt, hit enter, and Linux will begin loading from the CD.

Next, you'll be greeted with a small list of commands available on the boot CD, including nano (a pico editor clone) and instructions for setting up the network. Then, you'll be prompted to select your preferred keymap, followed by PCI autodection. The PCI autodetection process will automatically load the appropriate kernel modules for many popular PCI SCSI and ethernet devices. After this, you can hit enter to enter the minimal boot CD Linux environment. You should have a root ("#") prompt on the current console. You can also open new consoles by typing alt-f2, alt-f3, etc and then hitting enter.

Loading Hardware Access Modules

We're almost ready to begin installing Gentoo Linux, but first we need take the necessary steps so that the kernel recognizes our network cards, and optionally any SCSI hardware that is in our system that PCI autodetection missed.

If you want to be able to access any SCSI hardware that wasn't detected during the PCI autodetection process, you'll need to load the appropriate modules from /lib/modules, again using modprobe:

# modprobe aic7xxx
# modprobe sr_mod
# modprobe sd_mod

Above, we modprobe the aic7xxx SCSI driver and then make sure that SCSI CD-ROM (sr_mod) and disk (sd_mod) support is loaded.

hdparm is now included on -r10 and later of the iso. If any of your drives require tweaking, now would be a good time to do so.
Loading your Network Adaptor

If you are installing on a laptop and your network card is a PCMCIA card, then your first step is to get the PCMCIA module loaded to support your cardbus.

# insmod pcmcia_core
# insmod i82365
# insmod ds
# cardmgr -f

As the cardmgr detects which hardware is present, your speaker should emit a few reassuring beeps, and your PCMCIA network card should hum to life. You can of course insert the PCMCIA card after loading cardmgr too, if that's preferrable.

Technically, you do not need to run cardmgr if you know exactly which module your PCMCIA card requires. But if you don't, loading all PCMCIA modules and seeing which sticks won't work, as all PCMCIA modules load obligingly and hang around for a PCMCIA card to drop by. cardmgr will also unload the module(s) for any card when you remove it.

If you are not using cardmgr to auto-load the appropriate network card module, then you need to load it using the modprobe command. To view a list of all available network card modules, type ls /lib/modules/*/kernel/drivers/net/*. To load a particular module, type:

# modprobe pcnet32
	(replace pcnet32 with your NIC module)
Some of the more popular network cards are eepro100 and tulip. So try these first if you don't know which module is right for your card. If modprobe is successful in loading the module, then you will get the next # prompt with no error messages displayed.
Configuring Network

The new -r11+ boot CDs allow you to configure a working network, allowing you to use ssh, scp or wget as needed before even beginning the installation process. Even if you don't need to do these things now, you should go ahead and set up networking now. Once set up, Portage will be able to use your configured network once you are inside the chroot environment (required for installing Gentoo Linux).

DHCP

Network configuration is simple with DHCP; If your ISP is not using DHCP, skip down to the static configuration section below.

# dhcpcd eth0 
Some ISPs require you to provide a hostname. To do that, add a -h myhostname flag to the dhcpcd command line above.

If you receive dhcpConfig warnings, don't panic; the errors are most likely cosmetic. Skip down to Network testing below.

Static configuration

We need to setup just enough networking so that we can download sources for the system build, as well as the required localhost interface. Type in the following commands, replacing $IFACE with your network interface (typically eth0), $IPNUM with your IP address, $BCAST with your broadcast address, and $NMASK with your network mask. For the route command, replace $GTWAY with your default gateway.

# /sbin/ifconfig $IFACE $IPNUM broadcast $BCAST netmask $NMASK
# /sbin/route add -net default gw $GTWAY netmask 0.0.0.0 metric 1

Now, it's time to create the /etc/resolv.conf file so that name resolution (finding Web/FTP sites by name, rather than just by IP address) will work.

At the moment the only editor installed by default is nano, a small and very easy-to-use visual editor. Use nano with the -w option to turn off automatic line-wrapping.

Here is a template to follow for creating your /etc/resolv.conf file:

domain mydomain.com
nameserver 10.0.0.1
nameserver 10.0.0.2

Replace 10.0.0.1 and 10.0.0.2 with the IP addresses of your primary and secondary DNS servers respectively.

Network testing

Now that your network has been configured, the /sbin/ifconfig -a command should show (hopefully!) that your network card is working (look for UP and RUNNING in the output).

eth0      Link encap:Ethernet  HWaddr 00:50:BA:8F:61:7A
          inet addr:192.168.0.2  Bcast:192.168.0.255  Mask:255.255.255.0
          inet6 addr: fe80::50:ba8f:617a/10 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1498792 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1284980 errors:0 dropped:0 overruns:0 carrier:0
          collisions:1984 txqueuelen:100
          RX bytes:485691215 (463.1 Mb)  TX bytes:123951388 (118.2 Mb)
          Interrupt:11
Networking is go!

Networking should now be configured and useable. You should be able to use the included ssh, scp and wget commands to connect to other machines on your LAN or the Internet.

You are now ready to start setting up your partitions. Jump to Setting up Partitions.

Installing from Existing Distro
Overview

Many users will be encountering Gentoo after having already installed another popular distro such as Red Hat, Mandrake, Slackware, etc. on their machines. As such, you will be able to install Gentoo without burning a CD. The basic strategy is to free up at least one partition so that you many install Gentoo to a clean, mountable partition.

One of the main advantages of this approach is that you do not need a CD Burner in order to install Gentoo. However, if you want to install on of the more advanced file systems discussed in Setting up Partitions, you will need to compile support for that filesystem into your current distro's kernel and also download the appropriate packages for making the filesystems.

This guide walks you through setting up Gentoo on a Linux system that has the following configuration:

Boot/dev/hda1boot partition, containing kernel(s) and boot informationRoot/dev/hda2root partition, containing main filesystem (/etc, /usr, /bin, etc)Swap/dev/hda3swap partition (no longer a 128 Megabyte limit)Data/dev/hda4data partition, containing /home
Name Partition Description

Your configuration will likely differ slightly from the above. For example, Mandrake's default installation does not have the Boot partition, but rather, places the boot images in the /boot directory of the Root partition. You will need to spend some time figuring out which partitions you have. Once you have figured out your partitions and paths, you will be able to translate the literal paths here to suit your environment. The installation steps here will allow you to install Gentoo without damaging your existing distro's setup. In other words you'll be able to boot to your current distro as well as Gentoo's distro when we're done.
Determine where to Install Gentoo

If you have a second hard drive or additional unpartitioned space on your current hard drive, then you are in great shape to begin installing Gentoo. However, if your current hard drive is fully partitioned, then you will need to choose a partition from your currently available partitions to become Gentoo's Root.

It is highly recommended that you start by logging in only as root and only to a console to avoid "file busy" problems that may arise from having various apps and files opened. If you have a boot disk from your existing distro or can burn the minimal build CD for Gentoo, then a separate partition is not absolutely required as you can build Gentoo in a sub-directory of your current Root partition and then boot from a boot disk, delete the old system, and move the files in the chroot directory to root. However, this alternative will destroy your current distro.

If you already have the extra partition sitting around with no data on it, then you can just proceed to the next chapter, Setting up Partitions and begin setting up your partitions.

Probably the easiest partition to free up is the Data partition, especially if you have enough room to copy all files on this partition to your current Root partition. To do this, do the following:

# mkdir /tmphome
# mv /home/* /tmphome         // be sure you have enough disk space!
# umount /home
# rmdir /home
# mv /tmphome /home
It is recommended that you go ahead and comment out the line for mounting to /home from your /etc/fstab as you will no longer be mounting to this partition when booting to your current distro.

Now you are ready to continue with setting up your partitions. Because you already have a fully functional distro, you can get away with only setting up the file system for the new Gentoo Root partition. In other words, you can utilize your current Boot and Swap partitions with Gentoo.

When instructed to create the /mnt/gentoo directory and such, just create these on your current distro's Root partition.
Setting up Partitions

Now that the kernel can see our network card and disk controllers, it's time to set up disk partitions for Gentoo Linux.

If you are installing from an existing distro, you can utilize your existing distro's Boot partition as well as your existing Swap partition. You cannot, however use your existing distro's Root partition if you want to be able to boot to it as well as Gentoo. Keep these points in mind as you read the instructions for setting up partitions here.

Also, many distros don't have a separate boot partition by default. This is perfectly alright. You will find all your boot images in your current distro's /boot directory and it is here that you will copy your final bzImage file.

Here's a quick overview of the standard Gentoo Linux partition layout. We're going to create at least three partitions: a swap partition, a root partition (to hold the bulk of Gentoo Linux), and a special boot partition. The boot partition is designed to hold GRUB boot loader information as well as your Linux kernel(s). The boot partition gives us a safe place to store everything related to booting Linux. During normal day-to-day Gentoo Linux use, your boot partition should remain unmounted. This prevents your kernel from being made unavailable to GRUB (due to filesystem corruption) in the event of a system crash, preventing the chicken-and-egg problem where GRUB can't read your kernel (since your filesystem isn't consistent) but you can't bring your filesystem back to a consistent state (since you can't boot!)

Now, on to filesystem types. Right now, you have four filesystem options: XFS, ext2, ext3 (journaling) and ReiserFS. ext2 is the tried and true Linux filesystem but doesn't have metadata journaling. ext3 is the new version of ext2 with both metadata journaling and ordered data writes, effectively providing data journaling as well. ReiserFS is a B*-tree based filesystem that promises very good small file performance, and greatly outperforms both ext2 and ext3 when dealing with small files (files less than 4k), often by a factor of 10x-15x. However, we do not recommend ReiserFS at this time, due to repeated occurances of file-system corruption with the 2.4.x series kernels. ReiserFS has metadata journaling, but no data journaling. XFS is a high-performance enterprise-class filesystem with metadata journaling that is fully supported under Gentoo Linux.

If you're looking for the most standard filesystem, use ext2. If you're looking for the most rugged journalled filesystem, use ext3. If you're looking for a high-performance filesystem with journaling support, use XFS; both ext3 and XFS are mature and refined. All filesystems except ReiserFS are production-ready. Here are our basic recommended filesystem sizes and types:

boot partition, containing kernel(s) and boot information>10 Megabytesext2/3 highly recommended (easiest); if ReiserFS then mount with -o notail/dev/hda1swap partition (no longer a 128 Megabyte limit)>=2*Amount of RAM in this system is recommended but no longer (as of kernel 2.4.10) requiredLinux swap/dev/hda2root partition, containing main filesystem (/usr, /home, etc)>=1.5 GigabytesXFS, ext3 recommended; ext2 ok/dev/hda3
Partition Size Type example device
At this point, create your partitions using fdisk. Note that your partitions should be of type 0x82 if swap and 0x83 for regular filesystems (whether XFS, ReiserFS or ext2). You can find more in-depth discussion of file systems at >http://www.gentoo.org/index-articles.html

Once you've created your partitions using fdisk, it's time to initialize the filesystems that will be used to house our data. Initialize swap as follows:

# mkswap /dev/hda2

You can use the mke2fs command to create ext2 filesystems:

# mke2fs /dev/hda1

To create an XFS filesystem, use the mkfs.xfs command:

# mkfs.xfs /dev/hda3
You may want to add a couple of additional flags to the mkfs.xfs command: -d agcount=3 -l size=32m. The -d agcount=3 command will lower the number of allocation groups. XFS will insist on using at least 1 allocation group per 4 GB of your partition, so, for example, if you hava a 20 GB partition you will need a minimum agcount of 5. The -l size=32m command increases the journal size to 32 Mb, increasing performance. If you are installing an XFS partition over a previous ReiserFS partition, later attempts to mount may fail without an explicit mount -t xfs. The solution is to zero out the partition before creating the XFS filesystem: dd if=/dev/zero of=/dev/hdx bs=1k.

If you'd like to use ext3, you can create ext3 filesystems using mke2fs -j:

# mke2fs -j /dev/hda3

To create ReiserFS filesystems, use the mkreiserfs command:

# mkreiserfs /dev/hda3
Again, we do not recommend ReiserFS at this time. While ReiserFS has worked fine for many, filesystem corruption has been too common a problem with ReiserFS and the 2.4.x series kernels. You can find out more about using ext3 under Linux 2.4 at http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html.
Mounting Partitions

If you are not installing from an existing distro, then you need to activate our new swap, since we may need the additional virtual memory that provides later:

# swapon /dev/hda2

Next, we'll create the /mnt/gentoo and /mnt/gentoo/boot mountpoints, and we'll mount our filesystems to these mountpoints.

# mkdir /mnt/gentoo
# mount /dev/hda3 /mnt/gentoo
# mkdir /mnt/gentoo/boot
# mount /dev/hda1 /mnt/gentoo/boot

If you are setting up Gentoo Linux with a separate /usr or /var, these would get mounted to /mnt/gentoo/usr and /mnt/gentoo/var, respectively.

If your boot partition (the one holding the kernel) is ReiserFS, be sure to mount it with the -o notail option so GRUB gets properly installed. Make sure that notail ends up in your new /etc/fstab boot partition entry, too. We'll get to that in a bit.
Mounting the CD-ROM If you're installing from another distro and didn't burn a CD image, then move on to the next step.

Even though we've booted from the CD-ROM, the CD-ROM itself is not mounted under our minimal Linux boot CD environment. We'll need to mount it so that we can access the compressed build image tarball contained on the CD-ROM. To mount the CD-ROM, one typically types:

# mount /dev/cdroms/cdrom0 /mnt/cdrom -o ro -t iso9660

With the CD-ROM mounted, you should be able to see the build-???.tbz2 file by typing ls /mnt/cdrom.

Unpacking and chroot

Now it's time to extract the compressed build image tarball to /mnt/gentoo. Then, we'll chroot over to the new Gentoo Linux build installation.

Be sure to use the p option with tar. Forgetting to do this will cause certain files to contain incorrect permissions.
# cd /mnt/gentoo
# tar -xvjpf /mnt/cdrom/build-*.tbz2
# mount -o bind /proc /mnt/gentoo/proc  // see note below if installing from other distro
# cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
If you are installing from another distro and you're not currently on a 2.4.x kernel, then the mount -o bind may cause some problems. Instead use the following:
#  mount -t proc none /mnt/gentoo/proc

If you want to use the many pre-built packages included on the i586 CD, an additional step is needed at this point:

# mkdir /mnt/gentoo/usr/portage/packages
# mount -o bind /mnt/cdrom/packages /mnt/gentoo/usr/portage/packages

Now, all users (both "ix86" and "i586" guys) should use the following commands to initialize your new Gentoo Linux chroot environment:

# chroot /mnt/gentoo /bin/bash
# env-update
Regenerating /etc/ld.so.cache...
# source /etc/profile
(none) / # ooh!  A new prompt!

After you execute these commands, you'll be "inside" your new Gentoo Linux environment.

Rsync

Now, "build from scratch" people will need to run emerge rsync. This command will tell emerge to connect to cvs.gentoo.org and download the latest version of our Portage ports tree.

If you are doing a "fast binary" install, this step is optional, since a Portage tree snapshot was already added to your build image. You can choose to emerge rsync if you want to have the latest and greatest packages, or you can choose to skip the step to ensure that you will use only the pre-built binary packages included on your "i586" CD. If you want or need to emerge rsync, simply type:

# emerge rsync

The Portage tree will be downloaded; it's about 10Mb in size.

Bootstrap
If you are using the "fast binary" install method, then we've already bootstrapped for you. There is no reason for you to bootstrap again, unless you decided to do an emerge rsync and want to ensure that you have an up-to-the-minute current Gentoo Linux system. Most "fast binary" installers will not want to bootstrap again, since it can take up to an hour even on very fast machines. Another important note: If you're installing this CD at FOSDEM, type nano -w /etc/hosts and add a line to this file that reads 10.1.1.1 cvs.gentoo.org. This will trick your system into using the our local mirror at FOSDEM rather than connecting to our actual server in Austin, Texas, USA. This will make things go a lot faster :). Remember to remove this line from /etc/hosts when you get home so that your system will connect to the real cvs.gentoo.org from that point forward.

Now that you have a working copy of the Portage tree, "ix86" installers need to bootstrap their Gentoo Linux system. "i586" installers already have a bootstrapped system and should generally skip the entire bootstrap process and skip down to the Building the base system section below.

Bootstrappers should first edit the file /etc/make.conf. In this file, you should set your USE flags, which specify optional functionality that you would like to be built into packages; the commented-out defaults are recommended. You also should set appropriate CHOST, CFLAGS and CXXFLAGS settings for the kind of system that you are creating. If necessary, you can also set proxy information here if you are behind a firewall.

# nano -w /etc/make.conf (Adjust these settings)
People who need to substantially tweak the build process should take a look at the /etc/make.globals file. This file comprises gentoo defaults and should never be touched. If the defaults do not suffice, then new values should be put in /etc/make.conf, as entries in make.conf override the entries in make.globals.

Now, it's time to start the "bootstrap" process. This process will last 1-2 hours depending on how zippy your machine is; it takes about 45 minutes on my 900Mhz AMD Athlon system. During this time, the extracted build image will be prepped for compiling the rest of the system. The GNU compiler suite will be built, as well as the GNU C library. These are time consuming builds and make up the bulk of the bootstrap process:

# cd /usr/portage
# scripts/bootstrap.sh

The "bootstrap" process will now begin.

Portage by default uses /var/tmp during package building, often using several hundred megabytes of temporary storage. If you would like to change where Portage stores these temporary files, set a new PORTAGE_TMPDIR before starting the bootstrap process, as follows:
# export PORTAGE_TMPDIR="/otherdir/tmp"

The bootstrap.sh will build binutils, gcc, gettext, and glibc, rebuilding binutils, gcc, and gettext after glibc is built. Needless to say, this process takes a while. Have a nice nap.

Building the Base System

Once your build image has been bootstrapped (again, "i586" users have a pre-bootstrapped system), it's time to build or install the rest of the base system. If you are using the "fast binary" i586 install, pre-built packages will be automatically used if available in order to save time. Otherwise, packages will be auto-built from sources. The following commands will work for both "ix86" and "i586" installers:

# export CONFIG_PROTECT=""
# emerge --usepkg --pretend system
	[lists the packages to be installed]
# emerge --usepkg system
The --usepkg option tells emerge to check for a 
pre-built binary package first and to use it if available.
The export CONFIG_PROTECT="" line ensures that any new scripts installed to /etc will overwrite the old scripts (stored in sys-apps/baselayout), bypassing Portage's new config file management support. Type emerge --help config for more details.

If you're doing a "build from scratch" install, it's going to take a while to finish building the entire base system. Your reward is that it will be thoroughly optimized for your system. The drawback is that you have to find a way to keep yourself occupied for some time to come. The author suggests "Star Wars - Super Bombad Racing" for the PS2.

Installing the Kernel and System Logger

At the moment the Gentoo Linux default system does not include a kernel; you have to install it yourself. Here are the steps to compile and configure your own custom kernel:

# emerge --usepkg sys-kernel/linux-sources
# cd /usr/src/linux
# make menuconfig
# make dep clean bzImage modules modules_install
# mv /boot/bzImage /boot/bzImage.orig [if bzImage already exists]
# cp /usr/src/linux/arch/i386/boot/bzImage /boot
For those installing from another distro, reviewing your current distro's /etc/modules.autoload file (be sure to look outside your current Gentoo console!) can remove the guesswork out of deciding which modules you will want to use with your new kernel. You can also choose to build these into the kernel rather than as modules as your current distro has done. For your kernel to function properly, there are several options that you will need to ensure are in the kernel proper -- that is, they should be enabled and not compiled as modules. You will need to enable the "Experimental Features" options to see several of these selections. Under the "File systems" section, be sure to enable the "Device File System" (note that you don't need to enable the "/dev/pts file system support" option). You'll also need to enable the "Virtual Memory Filesystem". Be sure to enable "ReiserFS" if you have any ReiserFS partitions; the same goes for "Ext3". If you're using XFS, enable the "SGI XFS filesystem support" option. It's always a good idea to leave ext2 enabled whether you are using it or not. Also, most people using IDE hard drives will want to enable the "USE DMA by default" option; otherwise, your IDE drives may perform very poorly. Of course, remember to enable "IDE disk" support as well -- otherwise your kernel won't be able to see your IDE disks. For those who want rock-solid stability, it is now possible to install Gentoo Linux with a 2.2 kernel. Such stability will come at a price: you will lose many of the nifty features that are new to the 2.4 series kernels (such as XFS and tmpfs filesystems, iptables, and more), although the Gentoo 2.2. kernel sources have been patched with Reiserfs and devfs support. Gentoo linux bootscripts require either tmpfs or ramdisk support in the kernel, so 2.2 kernel users need to make sure that ramdisk support is compiled in (ie, not a module). It is vital that a gentoo=notmpfs flag be added to the kernel line in /boot/grub/menu.lst for the 2.2 kernel so that a ramdisk is mounted for the bootscripts instead of tmpfs. If you choose not to use devfs, then gentoo=notmpfs,nodevfs should be used instead.

Your new custom kernel (and modules) are now installed. Now you need to choose a system logger that you would like to install. We offer sysklogd, which is the traditional set of system logging daemons. We also have syslog-ng as well as metalog. Power users seem to gravitate away from sysklogd (not very good performance) and towards syslog-ng and metalog. If in doubt, you may want to try metalog, since it seems to be quite popular. To merge your logger of choice, type one of the next three lines:

# emerge --usepkg sys-apps/sysklogd
# rc-update add sysklogd default
or
# emerge --usepkg app-admin/syslog-ng
# rc-update add syslog-ng default
or
# emerge --usepkg app-admin/metalog
# rc-update add metalog default
In the case of syslog-ng you need to create /etc/syslog-ng/syslog-ng.conf. See /etc/syslog-ng for a sample configuration file. Metalog flushes output to the disk in blocks, so messages aren't immediately recorded into the system logs. If you are trying to debug a daemon, this performance-enhancing behavior is less than helpful. When your Gentoo Linux system is up and running, you can send metalog a USR1 signal to temporarily turn off this message buffering (meaning that tail -f /var/log/everything/current will now work in real time, as expected), and a USR2 signal to turn buffering back on again.
Install additional packages

You may need to install some additional packages in the Portage tree if you are using any optional features like XFS or LVM. If you're using XFS, you should emerge the xfsprogs ebuild:

# emerge --usepkg sys-apps/xfsprogs

If you're using LVM, you should emerge the lvm-user ebuild:

# emerge --usepkg sys-apps/lvm-user
Final configuration

Your Gentoo Linux system is almost ready for use. All we need to do now is configure a few important system files and install the GRUB boot loader. The first file we need to configure is /etc/fstab. Remember that you should use the notail option for your boot partition if you chose to create a ReiserFS filesystem on it. Remember to specify ext2, ext3 or reiserfs filesystem types as appropriate.

Use something like the /etc/fstab listed below, but of course be sure to replace "BOOT", "ROOT" and "SWAP" with the actual block devices you are using (such as hda1, etc.) If you are installing from another distro, you have a head start on editing these various configuration files as your distro already has fully configured configuration files. As such, you may wish to start another console session outside the current Gentoo session and copy files into your gentoo directory structure and edit these files as appropriate. To avoid confusion, remember that the instructions here are all inside the Gentoo console we chroot'd earlier

# /etc/fstab: static file system information.
#
# noatime turns of atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to 
# switch between notail and tail freely.

# <fs>          	<mountpoint>    <type>  	<opts>      		<dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.

/dev/BOOT		/boot		ext2		noauto,noatime		1 2
/dev/ROOT		/		ext3		noatime			0 1
/dev/SWAP		none            swap		sw			0 0
/dev/cdroms/cdrom0	/mnt/cdrom	iso9660		noauto,ro		0 0
proc			/proc           proc		defaults		0 0

If you are installing from another distro, you may not have a Boot partition to mount as this may simply be a /boot directory on your current Root partition. If this is the case, simply comment out the boot mount line in Gentoo's fstab skeleton shown above.
Set the root password

Before you forget, set the root password by typing:

# passwd
/etc/localtime

Look for your timezone (or GMT if you using Greenwich Mean Time) in /usr/share/zoneinfo. Then, make a symbolic link by typing:

# ln -sf /usr/share/zoneinfo/path/to/timezonefile /etc/localtime
/etc/hostname

Edit this file so that it contains your fully-qualified domain name on a single line, i.e. mymachine.mydomain.com.

/etc/hosts

This file contains a list of ip addresses and their associated hostnames. It's used by the system to resolve the IP addresses of any hostnames that may not be in your nameservers. Here's a template for this file:

127.0.0.1      localhost
# the next line contains your IP for your local LAN, and your associated machine name
192.168.1.1    mymachine.mydomain.com	mymachine
Final network configuration

Add the names of any modules that are necessary for the proper functioning of your system to /etc/modules.autoload file (you can also add any options you need to the same line.) When Gentoo Linux boots, these modules will be automatically loaded. Of particular importance is your ethernet card module, if you happened to compile it as a module:

3c59x
For those installing from existing distro, don't simply copy this file over as it may be loading modules you decided to build into the kernel. Review carefully before saving changes

Edit the /etc/conf.d/net script to get your network configured for your first boot:

# nano -w /etc/conf.d/net
# rc-update add net.eth0 default

If you have multiple network cards you need to create additional net.ethx scripts for each one (x = 1, 2, ...):

# cd /etc/init.d
# cp net.eth0 net.ethx
# rc-update add net.ethx default

If you have a PCMCIA card installed, have a quick look into /etc/init.d/pcmcia to verify that things seem all right for your setup, then add

depend() {
	need pcmcia
}
on top of your /etc/init.d/net.ethx file, for the pcmcia drivers to be autoloaded whenever your network is loaded.

Configure basic settings
# nano -w /etc/rc.conf

Follow the directions in the file to configure the basic settings.

Configuring a Boot Loader
Overview

Before you can successfully boot to your new Gentoo installation, you must configure a boot loader by telling it where your Gentoo boot image file is and where Gentoo resides on your computer. The boot loader is the very first thing your computer will be looking for when you reboot your machine and its job is to simply direct the boot up process to the appropriate OS image file so that the specified operating system can begin to load and boot up.

For those installing Gentoo via another distro and have Lilo as their current boot loader, you have the option of converting over to GRUB, or continuing to use Lilo as your boot loader. You will probably find Lilo easiest to get working in this senario as working boot loader and configuration file are readily available for configuring. See the next section, Configuring Lilo.

For those installing from CD, you are encouraged to use the GRUB boot loader as it has much better support for loading a variety of different operating systems as well as decoupling each operating system's boot image from the boot loader itself. This means that, unlike Lilo, you do not have to regenerate the boot images that are written to the MBR (Master Boot Record) each time you build a kernel. If you wish to use GRUB, then skip the Configuring Lilo section altogether and begin with Configuring GRUB section below.

Configuring Lilo

If you are installing from a current distro, then in all likelihood, you have lilo already installed as your current dual booter. If you currently use GRUB or if you are installing from CD, then skip on ahead to Configuring GRUB as this section is for installing from a current distro with Lilo as their current booter.

Once your bzImage is built, you need to access your current distro's boot directory. The following will exit your gentoo console and allow you to copy the new bzImage to its appropriate location:

#  exit     // returns to your current distro's console
#  cp /mnt/gentoo/boot/bzImage /boot/bzImage

Now edit /etc/lilo.conf to add an entry for Gentoo, following the example set forth in your current lilo.conf. Alternatively, you can just do the following if you have installed Gentoo to /dev/hda4 (just an example, use your real path!)

image=/boot/bzImage
        label=Gentoo
        root=/dev/hda4  // set this to your Gentoo partition!

Finally, run Lilo to regenerate the boot image and write changes to the MBR:

# lilo -v

If you did everything correctly, lilo should have reported no errors and you should have seen your new Gentoo entry written to MBR. You are now set to choose Gentoo when you reboot.

If you rebuild your kernel at a later date, you must re-run lilo after copying the new bzImage file to the /boot directory.

After configuring Lilo, skip ahead to Installation Complete!

Configuring GRUB

The most critical part of understanding GRUB is getting comfortable with how GRUB refers to hard drives and partitions. Your Linux partition /dev/hda1 is called (hd0,0) under GRUB. Notice the parenthesis around the hd0,0 - they are required. Hard drives count from zero rather than "a", and partitions start at zero rather than one. So, /dev/hdb3 gets translated to (hd1,2), and /dev/hdd7 gets translated to (hd3,6). After you've gotten the feel for that, convert your boot and root partition names to the GRUB format and write them down. Now, it's time to install GRUB.

You will find excellent documentation for GRUB at http://www.gnu.org/manual/grub-0.90/grub.html

The easiest way to install grub is to simply type grub at your chrooted shell prompt:

# grub

You'll be presented with the grub> grub command-line prompt. Now, you need to type in the right commands to install the GRUB boot record onto your hard drive. In my example configuration, I want to install the GRUB boot record on my hard drive's MBR (master boot record), so that the first thing I see when I turn on the computer is the GRUB prompt. In my case, the commands I want to type are:

grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Here's how the two commands work. The first root ( ) command tells GRUB the location of your boot partition (in our example, /dev/hda1 or (hd0,0) in GRUB terminology. Then, the second setup ( ) command tells GRUB where to install the boot record - it will be configure to look for its special files at the root ( ) location that you specified. In my case, I want the boot record on the MBR of the hard drive, so I simply specify /dev/hda (also known as (hd0)). If I were using another boot loader and wanted to set up GRUB as a secondary boot-loader, I could install GRUB to the boot record of a particular partition. In that case, I'd specify a particular partition rather than the entire disk. Once the GRUB boot record has been successfully installed, you can type quit to quit GRUB. Gentoo Linux is installed, but we need to create the /boot/grub/menu.lst file so that we get a nice GRUB boot menu when the system reboots. Here's how to do it.

Now, create the menu.lst file (nano -w /boot/grub/menu.lst), and add the following to it:

default 0
timeout 30
splashimage=(hd0,0)/boot/grub/splash.xpm.gz

title=My example Gentoo Linux
root (hd0,0) 
kernel /boot/bzImage root=/dev/hda3 

# Below needed only for people who dual-boot
title=Windows NT Workstation
root (hd0,5) 
chainloader +1
The menu.lst file should end in "lst" as in "list", not "1st" as in "first". Also, (hd0,0) should be written without any spaces inside the parentheses.

After saving this file, Gentoo Linux installation is complete. Selecting the first option will tell GRUB to boot Gentoo Linux without a fuss. The second part of the menu.lst file is optional, and shows you how to use GRUB to boot a bootable Windows partition.

Above, (hd0,0) should point to your "boot" partition (/dev/hda1 in our example config) and /dev/hda3 should point to your root filesystem. (hd0,5) contains the NT boot loader.

Also, if you need to pass any options to the kernel, simply add them to the end of the kernel command. We're already passing one option (root=/dev/hda3), but you can pass others as well. In particular, you can turn off devfs by default (not recommended unless you know what you're doing) by adding the gentoo=nodevfs option to the kernel command.

Unlike in earlier versions of Gentoo Linux, you no longer have to add devfs=mount to the end of the kernel line to enable devfs. In rc6 devfs is enabled by default.
Installation Complete!

Now, Gentoo Linux is installed. The only remaining step is to exit the chrooted shell, safely unmount your partitions and reboot the system:

# exit 
This exits the chrooted shell; you can also type ^D
# cd / 
# umount /mnt/gentoo/boot
# umount /mnt/gentoo/proc
# umount /mnt/gentoo
# reboot
After rebooting, it is a good idea to run the update-modules command to create the /etc/modules.conf file. Instead of modifying this file directly, you should generally make changes to the files in /etc/modules.d.

If you have any questions or would like to get involved with Gentoo Linux development, consider joining our gentoo-user and gentoo-dev mailing lists (there's a "click to subscribe" link on our main page).

If you wish to continue with installing X Windows, Sound, etc., then this Desktop Guide will get you well on your way.

Resources

To learn more about GRUB, visit http://www.gnu.org/manual/grub-0.90/grub.html

For more in-depth Linux installation (non-distro specific), you may wish to check out the following: http://www.linuxdocs.org/HOWTOs/HOWTO-INDEX/os.html.

For in-depth review of Linux filesystems and each's strengths and weaknesses, visit http://www.gentoo.org/index-articles.html. You will also find other articles about Linux sub-systems here.

You may also wish to visit http://www.zip.com.au/~akpm/linux/ext3/ext3-usage.html to find out more about using ext3 under Linux 2.4.

You can find a whole community of Gentoo users and fans willing to help you with installation issues and troubleshooting on IRC at irc.opensourceprojects.net on the #gentoo channel. You can also subscribe to a mailing list just for new Gentoo users and those installing and configuring Gentoo at Gentoo-Newbies