Knowledgebase: Gentoo
How to Install Gentoo
Posted by Gurpreet Singh on 22 August 2011 03:44 AM
Gentoo being a groudup installation has always been a hard aspect not having a installer. But Gentoo 6.0 did bring it in. Although it does need some tweaks. Below is a simple How-to to install Gentoo.

Gentoo Linux x86 Quick Install Guide
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 networkless 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 links.

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 networkless 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 networkless 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 flags, 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 networkless 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 -sfn.

Bootstrapping (not available for networkless installations) happens using scripts/ in the /usr/portage directory.
System installation (not available for networkless 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 copying correct file from /usr/share/zoneinfo over the /etc/localtime file.

Install a kernel source (gentoo-sources and vanilla-sources are available for networkless 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

Users of a 2.4 kernel need to run 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 networkless 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.
(0 vote(s))
Not helpful

Comments (0)
Post a new comment
Full Name:
CAPTCHA Verification 
Please enter the text you see in the image into the textbox below (we use this to prevent automated submissions).