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.
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.
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
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:
To begin installing with the fast binary Build CD, grab the latest
(
When the CD successfully boots, you will be greeted with a bunch of text and a
Next, you'll be greeted with a small list of commands available on the boot
CD, including
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 aic7xxx # modprobe sr_mod # modprobe sd_mod
Above, we modprobe the
You are now ready to start setting up your partitions.
Jump to
To begin the install process, first grab the latest 16Mb build CD
ISO image (
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.
When the CD successfully boots, you will be greeted with a bunch of text and a
Next, you'll be greeted with a small list of commands available on the boot
CD, including
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 aic7xxx # modprobe sr_mod # modprobe sd_mod
Above, we modprobe the
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.
If you are not using cardmgr to auto-load the appropriate network card module,
then you need to load it using the
# modprobe pcnet32(replace pcnet32 with your NIC module)
The new -r11+ boot CDs allow you to configure a working network, allowing you to use
Network configuration is simple with DHCP; If your ISP is not using DHCP, skip down to the static configuration section below.
# dhcpcd eth0
If you receive dhcpConfig warnings, don't panic; the errors are most likely cosmetic. Skip down to Network testing below.
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
# /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
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
Now that your network has been configured, the
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 should now be configured and useable. You should be able to use the included
You are now ready to start setting up your partitions.
Jump to
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.
This guide walks you through setting up Gentoo on a Linux system that has the following configuration:
Name | Partition | Description |
---|---|---|
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.
If you already have the extra partition sitting around with no data on it, then you can just proceed
to the next chapter,
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
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.
Now that the kernel can see our network card and disk controllers, it's time to set up disk partitions for Gentoo Linux.
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
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
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:
Partition | Size | Type | example device |
---|---|---|---|
Once you've created your partitions using
# mkswap /dev/hda2
You can use the
# mke2fs /dev/hda1
To create an XFS filesystem, use the
# mkfs.xfs /dev/hda3
If you'd like to use ext3, you can create ext3 filesystems using
# mke2fs -j /dev/hda3
To create ReiserFS filesystems, use the
# mkreiserfs /dev/hda3
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
# 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
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
Now it's time to extract the compressed build image tarball to
# 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
# 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.
Now, "build from scratch" people will need to run
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
The Portage tree will be downloaded; it's about 10Mb in size.
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
Bootstrappers should first edit the file
# nano -w /etc/make.conf(Adjust these settings)
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.
# export PORTAGE_TMPDIR="/otherdir/tmp"
The
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 systemThe --usepkg option tells emerge to check for a pre-built binary package first and to use it if available.
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.
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
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
# emerge --usepkg sys-apps/sysklogd # rc-update add sysklogd defaultor # emerge --usepkg app-admin/syslog-ng # rc-update add syslog-ng defaultor # emerge --usepkg app-admin/metalog # rc-update add metalog default
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
# emerge --usepkg sys-apps/xfsprogs
If you're using LVM, you should emerge the
# emerge --usepkg sys-apps/lvm-user
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: 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
Before you forget, set the root password by typing:
# passwd
Look for your timezone (or GMT if you using Greenwich Mean Time) in
# ln -sf /usr/share/zoneinfo/path/to/timezonefile /etc/localtime
Edit this file so that it contains your fully-qualified domain name on a single line, i.e.
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
Add the names of any modules that are necessary for the proper functioning of your system to
3c59x
Edit the
# nano -w /etc/conf.d/net # rc-update add net.eth0 default
If you have multiple network cards you need to create additional
# 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
# nano -w /etc/rc.conf
Follow the directions in the file to configure the basic settings.
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,
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
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
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.
After configuring Lilo, skip ahead to
The most critical part of understanding GRUB is getting comfortable with how GRUB refers to hard drives and partitions.
Your Linux partition
The easiest way to install grub is to simply type
# grub
You'll be presented with the
grub> root (hd0,0) grub> setup (hd0) grub> quit
Here's how the two commands work. The first
Now, create the menu.lst file (
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
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.
Also, if you need to pass any options to the kernel, simply
add them to the end of the
Now, Gentoo Linux is installed. The only remaining step is to exit the chrooted shell, safely unmount your partitions and reboot the system:
# exitThis exits the chrooted shell; you can also type # cd / # umount /mnt/gentoo/boot # umount /mnt/gentoo/proc # umount /mnt/gentoo # reboot^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
If you wish to continue with installing X Windows, Sound, etc., then this
To learn more about GRUB, visit
For more in-depth Linux installation (non-distro specific), you may wish to check
out the following:
For in-depth review of Linux filesystems and each's strengths and weaknesses, visit
You may also wish to visit
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