Gentoo Linux x86 Quick Install Guide

Sven Vermeulen  Author
Steven Wagner Author

Updated August 20, 2005

1. Quick Install Guide

Installation Media

Download a CD from one of our mirrors. You can find the ISOs in releases/<architecture>/<release>/installcd. The minimal installation CD is only useful for Internet-based installations; with the universal installation CD you can perform a network less installation as well.

Burn the CD and boot it. Press F2 at the boot screen to find out what boot options exist. Once booted, you need to start the pcmcia init script if you need PCMCIA support.

The installation CDs allow you to start an sshd server, add additional users, run irssi (a command-line chat client) and surf the web using lynx or links2.

Network Configuration

If your network does not work already, you can use net-setup to configure your network. You might need to load support for your network card using modprobe prior to the configuration. If you have ADSL, use adsl-setup and adsl-start. For PPTP support, first edit /etc/ppp/chap-secrets and /etc/ppp/options.pptp and then use pptp <server ip>.

For wireless access, use iwconfig to set the wireless parameters and then use either net-setup again or run ifconfig, dhcpcd and/or route manually.

If you are behind a proxy, do not forget to initialize your system using export http_proxy, ftp_proxy and RSYNC_PROXY.

Preparing the Disks

Use fdisk or cfdisk to create your partition layout. You need at least a swap partition (type 82) and one Linux partition (type 83).

Use mke2fs, mke2fs -j, mkreiserfs, mkfs.xfs and mkfs.jfs to create file systems on your Linux partitions. Initialize your swap partition using mkswap and swapon.

Mount the freshly created file systems on /mnt/gentoo. Create directories for the other mount points (like /mnt/gentoo/boot) if you need them.

Setting Up The Stage

First make sure your date is set correctly using date MMDDhhmmYYYY. Next, download a stage from one of our mirrors or use the one available on the installation CD (/mnt/cdrom/stages). Go to /mnt/gentoo and unpack the stage using tar -xvjpf <stage tarball>.

Install a Portage snapshot if you are performing a network less installation: go to /mnt/gentoo/usr and run tar -xvjf /mnt/cdrom/snapshots/<snapshot>. Other users can download a portage snapshot and install it likewise.

For a network less installation, copy over the source code files from /mnt/cdrom/distfiles/ to /mnt/gentoo/usr/portage/distfiles/.

Edit /mnt/gentoo/etc/make.conf to suit your needs (USE flag, CFLAGS and CXXFLAGS). You can use the nano editor for this.

Installing the Gentoo Base System

Mount the /proc file system first, copy over the /etc/resolv.conf file and then chroot into your Gentoo environment.

Code Listing 1.1: Preparing and chrooting

# mount -t proc none /mnt/gentoo/proc
# cp /etc/resolv.conf /mnt/gentoo/etc/
# chroot /mnt/gentoo /bin/bash
# env-update && source /etc/profile

If you are not running a network less installation, issue emerge –sync to update your Portage tree.

Next, make sure /etc/make.profile points to the right profile. The default one should suffice for most users; sub profiles are available for different kernels (like 2.4/ for 2.4-kernel based profiles). Change the profile using ln -sf.

  • Bootstrapping (not available for network less installations) happens using scripts/ in the /usr/portage directory.
  • System installation (not available for network less installations) happens using emerge -e system (or -N if you haven’t altered the default CFLAGS/CXXFLAGS).

Kernel Configuration

Set your time zone information by changing the /etc/localtime symbolic link to the correct location in /usr/share/zoneinfo using ln -sf.

Install a kernel source (gentoo-sources and vanilla-sources are available for network less installations) and configure it using make menuconfig followed by make &&make modules_install inside /usr/src/linux. Copy the arch/i386/boot/bzImage file over to /boot. You can also emerge genkernel and use genkernel all.

Genkernel users will need to emerge coldplug and rc-update add coldplug default.

Configuring the System

Edit your /etc/fstab; an example follows:

Code Listing 1.2: Example fstab

/dev/hda1   /boot     ext2    defaults,noatime     1 2
/dev/hda2   none      swap    sw                   0 0
/dev/hda3   /         ext3    noatime              0 1
none        /proc     proc    defaults             0 0
none        /dev/shm  tmpfs   nodev,nosuid,noexec  0 0
/dev/cdroms/cdrom0    /mnt/cdrom    auto      noauto,user    0 0

Edit /etc/conf.d/hostname and /etc/conf.d/domainname, run rc-update add domainname default and edit /etc/conf.d/net to configure your network. Add the net.eth0 init script to the default run level. If you have multiple NICs, symlink them to the net.eth0 init script and add them to the default run level as well.

Edit /etc/hosts; examples are given below:

Code Listing 1.3: Example /etc/hosts

(For static IPs)     localhost   jenny.homenetwork jenny   benny.homenetwork benny   tux.homenetwork tux

(For a dynamic IP)     localhost.homenetwork tux localhost

Emerge pcmcia-cs and add it to the default run level if you need it.

Set the root password using passwd.

Set the necessary system configuration in /etc/rc.conf, /etc/conf.d/rc, /etc/conf.d/keymaps, /etc/conf.d/clock.

Installing System Tools

2.4 kernel users need to emerge –unmerge udev and emerge devfsd.

Install a system logger like syslog-ng and add it to the default run level. Do the same for a cron daemon like vixie-cron (optional).

Install the necessary file system tools (xfsprogs, reiserfsprogs or jfsutils) and networking tools (dhcpcd or rp-pppoe).

Configuring the Bootloader

Emerge grub or lilo. Edit /boot/grub/grub.conf or /etc/lilo.conf to your likings. Below you will find an example for each.

Code Listing 1.4: Example grub.conf

default 0
timeout 30

# genkernel users
title=Gentoo Linux 2.6.11-r3
root (hd0,0)
kernel /kernel-genkernel-x86-2.6.11-gentoo-r3 root=/dev/ram0 init=/linuxrc ramdisk=8192 real_root=/dev/hda3 udev
initrd /initramfs-genkernel-x86-2.6.11-gentoo-r3

# non-genkernel users (no initrd)
title=Gentoo Linux 2.6.11 r3
root (hd0,0)
kernel /kernel-2.6.11-gentoo-r3 root=/dev/hda3

# Only in case you want to dual-boot
title=Windows XP
root (hd0,5)
chainloader +1

Code Listing 1.5: Example lilo.conf


# For non-genkernel users

# For genkernel users
  append="init=/linuxrc ramdisk=8192 real_root=/dev/hda3 udev"

# For dual-booting

GRUB users need to install GRUB in the MBR using grub-install /dev/hda after copying /proc/mounts to /etc/mtab. LILO users need to run /sbin/lilo.

Exit the chrooted environment, unmount all file systems and reboot.

Finalizing the Installation

Log in as root, then add one or more users for day-to-day use using useradd -m -G <groups> <username>.

If you performed a network less installation, mount the packages CD at /mnt/cdrom and export PKGDIR="/mnt/cdrom" after which you can emerge -k <package> to install additional software like kde.

Thanks for installing Gentoo!