Make sure you are in the /mnt/gentoo directory, which is the mountpoint of your root filesystem:
cd /mnt/gentoo
Now, extract the Stage 3 base system tarball into the current directory:
tar xvjpf /mnt/cdrom/stages/stage3-i686-*.tar.bz2
Extract the Portage snapshot tarball into the usr/ directory:
tar xvjf /mnt/cdrom/snapshots/portage-*.tar.bz2 -C usr
Copy the distribution and GRP (Gentoo binary packages) files into your new Portage directory:
cp -R /mnt/cdrom/distfiles usr/portage/distfiles cp -a /mnt/cdrom/packages usr/portage/packages
If you would like more information on this step, Gentoo.org
Create a chroot jail for your new Gentoo system (yes, believe it or not, you almost have a fully functional system built in the /mnt/gentoo directory):
chroot /mnt/gentoo /bin/bash
Update your environment (to completely immerse yourself in the Matrix):
env-update source /etc/profile
If you would like more information on this step, Gentoo.org
Make a symbolic link (AKA symlink AKA soft link) from the zoneinfo file that correctly describes your time zone to /etc/localtime:
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtimeif you are in North America's Eastern Standard Time zone. If you are in Ireland, you want to use zoneinfo/Eire; if in Japan, zoneinfo/Japan; if in California, zoneinfo/America/Los_Angeles; if in Bulgaria, zoneinfo/Europe/Sofia; and so on. You should be able to figure it out. :)
If you would like more information on this step, Gentoo.org
/etc/fstab tells Linux all it needs to know about your filesystems. Open it
nano -w /etc/fstaband edit it (Nano is the GNU clone of Pico, if that helps you; Emacs / Readline style movement generally works; look at the bottom line of Nano for a quick keystroke reference) to look like this:
# /etc/fstab: static file system information. # # noatime turns off atimes for increased performance (atimes normally aren't # needed; notail increases performance of ReiserFS (at the expense of storage # efficiency). It is safe to drop the noatime options if you want and to # switch between notail and tail freely. # <fs> <mount point> <type> <opts> <dump/pass> # NOTE: If your BOOT partition is ReiserFS, add the notail option to opts. /dev/hda1 /boot ext2 noauto 1 1 /dev/hda3 / reiserfs defaults 0 0 /dev/hda5 /opt xfs defaults 0 0 /dev/hda6 /tmp xfs defaults 0 0 /dev/hda7 /usr xfs defaults 0 0 /dev/hda8 /var xfs defaults 0 0 /dev/hda9 /home xfs defaults 0 0 /dev/hda2 none swap sw 0 0 /dev/cdroms/cdrom0 /mnt/cdrom iso9660 noauto,ro,user 0 0 none /proc proc defaults 0 0
If you have a utility / diagnostics / whatever partition, remember to increment the partition number (and skip the dreaded hda4)!
If you would like more information on this step, Gentoo.org
This will be your first experience with emerge, which is the program used for manipulating Portage, the Gentoo package system. We will emerge (AKA install) the binary xfs-sources kernel:
emerge -k xfs-sourcesThe -k switch is what tells Portage to use a binary package as opposed to the preferred default source packages. (Though actually, the "binary" kernel package is not much different from the "source" one.)
For some reason, some part of the GRP install seems to create a boot symlink to /boot in the /boot directory, which has the unfortunate result of creating an infinitely deep directory structure. Said foppery will prevent genkernel from installing the kernel. Kill the symlink:
rm /boot/book
Now, emerge the genkernel script and use it to compile and install your kernel:
emerge -k genkernel genkernel
When genkernel finishes, make sure you have the following files in /boot:
/boot/System.map-version /boot/kernel-versionwhere version is the Linux kernel version (e.g. 2.4.20) plus the Gentoo kernel name (in this case xfs) and the Gentoo ebuild release (e.g r3). If these files do not exist, you will have to install the kernel manually:
version=`ls -1 /usr/src/ | grep linux- | awk -F'linux' '{ print $2 }'` cp /usr/src/linux/System /boot/System.map$version cp /usr/src/linux/arch/i386/boot/bzImage /boot/kernel$version
If you would like more information on this step, Gentoo.org
You will install the most standard system logger, sysklogd, and cron daemon, vcron:
emerge -k sysklogd vcronAfter the packages are installed, add them to the default run-level:
rc-update add sysklogd default rc-update add vcron default
If you would like more information on this step, Gentoo.org
Since you have reiserfs and XFS filesystems, you should install the tools for both:
emerge -k reiserfsprogs xfsprogs
And if you are installing on a laptop, you will want to install the pcmcia-cs package and add it to the boot run-level:
emerge -k pcmcia-cs rc-update add pcmcia boot(this will involve a compile--a binary package is not distributed on the LiveCD).
If you would like more information on this step, Gentoo.org
If you forget to set a password for the root account, you will not be able to login to your box! Do it now:
passwd rootEnter a good password, then enter it again for verification.
If you would like more information on this step, Gentoo.org
If you are on a LAN, or are connected to the Internet by an Ethernet NIC (e.g. you have a cable or DSL modem), you will want to configure your network settings. If you dial up to the Internet, skip ahead to the next step.
Set your hostname and domain name:
echo 'hostname.domain.tld' >/etc/hostname echo 'domain.tld' >/etc/dnsdomainname
Add at least one nameserver to your /etc/resolve.conf:
echo 'nameserver 123.456.789.1' >/etc/resolv.conf echo 'nameserver 123.456.789.2' >>/etc/resolv.confPlease note that in the first step, you are truncating your /etc/resolv.conf, and in the second, you are appending to it (>> versus >)!
Now, configure your primary Network Interface Card (NIC) by entering:
nano -w /etc/conf.d/netEdit the file to look something like this (note that you only need to edit the lines coloured red):
# /etc/conf.d/net: # $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/conf.d/net,v 1.7 2002/11/18 19:39:22 azarah Exp $ # Global config file for net.* rc-scripts # This is basically the ifconfig argument without the ifconfig $iface # iface_eth0="192.168.4.209 broadcast 192.168.4.255 netmask 255.255.255.0" #iface_eth1="207.170.82.202 broadcast 207.0.255.255 netmask 255.255.0.0" # For DHCP set iface_eth? to "dhcp" # For passing options to dhcpcd use dhcpcd_eth? # #iface_eth0="dhcp" #dhcpcd_eth0="..." # For adding aliases to a interface # #alias_eth0="192.168.0.3 192.168.0.4" # NB: The next is only used for aliases. # # To add a custom netmask/broadcast address to created aliases, # uncomment and change accordingly. Leave commented to assign # defaults for that interface. # #broadcast_eth0="192.168.0.255 192.168.0.255" #netmask_eth0="255.255.255.0 255.255.255.0" # For setting the default gateway # gateway="eth0/192.168.4.254"In the iface_eth0="192.168.4.209 broadcast 192.168.4.255 netmask 255.255.255.0" line, replace 192.168.4.209 with your IP address. Replace 192.168.4.255 with your broadcast address (which is usually just your IP address, except the number after the third dot is 255). If you know that you are not in a class C (or its CIDR equivalent, */24) network, replace 255.255.255.0 with your network mask. If you do not know these settings, consult your ISP, sysadmin, or local networking guru.
If you would like more information on this step, Gentoo.org
You will need to install a bootloader (in this case, GRUB) in order to boot into Linux:
emerge -k grub
Now, enter
nano -w /boot/grub/grub.confto create a GRUB configuration file. Edit it to look like this:
default 0 timeout 10 splashimage=(hd0,0)/grub/splash.xpm.gz title=Gentoo 1.4 (Linux version) root (hd0,0) kernel (hd0,0)/kernel-version root=/dev/hda3 initrd (hd0,0)/initrd-versionwhere version is the Linux kernel version (e.g. 2.4.20) plus the Gentoo kernel name (in this case xfs) and the Gentoo ebuild release (e.g r3); i.e. the output of:
version=`ls -1 /usr/src/ | grep linux- | awk -F'linux' '{ print $2 }'`
If you have a utility / diagnostics / whatever partition, you should change (hd0,0) to (hd0,1)!
The Gentoo instructions for this step (see below) have you enter (hd0,0)/boot instead of just (hd0,0)/. In my experience, GRUB cannot find any files prefixed with /boot. This makes sense in that (hd0,0) refers to the /boot partition, and is probably why the /boot/boot infinite symlink is created. What a kludge!
To invoke the GRUB shell (one of the big reasons why it is the best bootloader, period), enter:
grub --no-floppyYou will be presented with a prompt:
GNU GRUB version 0.93 (640K lower / 3072K upper memory) [ Minimal BASH-like line editing is supported. For the first word, TAB lists possible command completions. Anywhere else TAB lists the possible completions of a device/filename. ] grub>To tell GRUB that your boot partition is the first partition (or second, if you have a utility / diagnostics / whatever partition) of the first hard drive, enter:
root (hd0,0)
If you have a utility / diagnostics / whatever partition, you should change (hd0,0) to (hd0,1)!
GRUB will report:
Filesystem type is ext2fs, partition type 0x83
To install GRUB onto the Master Boot Record (MBR) of your first hard drive, enter:
setup (hd0)
GRUB will report:
Checking if "/boot/grub/stage1" exists... yes Checking if "/boot/grub/stage2" exists... yes Checking if "/boot/grub/e2fs_stage1_5" exists... yes Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 16 sectors are embedded. succeeded Running "install /boot/grub/stage1 (hd0) (hd0)1+16 p (hd0,0)/boot/grub/stage2 /boot/grub/grub.conf"... succeeded Done.
To exit GRUB, enter:
quit
If you would like more information on this step, Gentoo.org
If you are installing Gentoo on a server, you probably do not want to install X. Skip to the next step.QND
Using Portage and GRP, installing XFree86 is a simple as entering:
emerge -k xfreeAgain, the -k flag tells emerge to use binary packages when available.
If you would like more information on this step, Gentoo.org
To escape from the chroot jail, enter:
exitor hit Ctrl+d.
Unmount all of your filesystems:
cd / for i in /mnt/gentoo/*; do umount /mnt/gentoo/$i; done umount -l /mnt/gentooand reboot:
reboot
Make sure to remove the bootable CD as soon as you are able (i.e. right after the machine resets). If all is well, you will see a slick GRUB menu that will wait 10 seconds, then boot into your new Gentoo Linux system!
If you would like more information on this step, Gentoo.org
Login to the system with the root password that you set in Step 14QND.
Insert the Gentoo LiveCD, Disc 2 into your CD-ROM drive and enter:
cp /mnt/cdrom/packages/All/* usr/portage/packages/All/which will copy around 450MB worth of binary packages onto your hard drive. Don't worry, it is only temporary. :)
Install a decent editor, vim, and sudo a package that lets you run commands with root privileges without having to be root (so you can avoid the onset of carpal tunnel due to typing su - a thousand times a day):
emerge -k vim sudo gentoolkit
If you are installing Gentoo on a server, you are done. Create some user accounts and away you go! You should skip the rest of the steps in this guide.
Now, install the window manager of your choice:
emerge -k gnomeOpen /etc/rc.conf in a text editor (e.g. nano or vim) and find the line:
#DISPLAYMANAGER="xdm"Add a new line right below it:
DISPLAYMANAGER="gdm"and save and exit the file.
emerge -k kdeOpen /etc/rc.conf in a text editor (e.g. nano or vim) and find the line:
#DISPLAYMANAGER="xdm"Add a new line right below it:
DISPLAYMANAGER="kdm"and save and exit the file.
To install the Mozilla web browser, enter:
emerge -k mozilla
Generate an XFree86 configuration file:
cd /etc/X11 XFree86 -configure mv ~/XF86Config.new ./XF86Config-4Open the newly created /etc/X11/XF86Config-4 file in the editor of your choice (e.g. nano or vim) and find the lines:
Section "Screen" Identifier "Screen0"Add a new line right beneath them:
DefaultDepth 16for 16 million colours, or:
DefaultDepth 24for 24 million colours.
Save the file and exit.
To have X start automatically on boot, enter:
rc-update add xdm default
To start XFree86, using either GNOME or KDE, enter:
/etc/init.d/xdm startIf all is well, you should be presented with a graphical login screen. Voila, you have installed Gentoo with XFree86!