Gentoo Logo
Gentoo Logo Side

Gentoo Linux Install Reference

Content:

1. Quick Install Reference

The installation ISOs are on the Gentoo Mirrors. Detailed descriptions of the different CDs are available in the Gentoo Store. A universal CD contains everything you need to install Gentoo Linux quickly and without a connection to the Internet. A Package CD is optional and contains pre-compiled packages such as KDE, GNOME, OpenOffice, Mozilla, Evolution and more.

Boot from the Universal CD. Press <F1> and/or <F2> to see what boot options are available. Press <ENTER> at the bootscreen to continue with the default kernel. You'll eventually receive a prompt.

Code Listing 1.1: Beginning settings

# date  (Make sure your time and date is correct. If wrong, set it with  date MMDDhhmmCCYY )
# modprobe module_name  (Optional - Load any necessary modules)
# net-setup eth0 (Configure the network)
# fdisk /dev/hda (Partition your drive)

The recommended setup is a 64 meg boot volume with ext2, a swap partition twice the size of your available RAM, and the rest for your root partition using ReiserFS.

Initialise your partitions using mke2fs (Ext2), mke2fs -j (Ext3), mkreiserfs (ReiserFS), mkfs.xfs (XFS), mkfs.jfs (JFS) and mkswap (swap partition). For instance: mke2fs -j /dev/hda3.

Continue by mounting the partitions and extracting the appropriate stage file.

Code Listing 1.2: Preparing the Installation

(Activate the swap partition)    # swapon /dev/hdax
(Mount the root partition)       # mount /dev/hdax /mnt/gentoo
(Create the boot mountpoint)     # mkdir /mnt/gentoo/boot
(Mount the boot partition)       # mount /dev/hdax /mnt/gentoo/boot
(Go to the mountpoint)           # cd /mnt/gentoo
(Extract a stage tarball...)     # tar -xvjpf /mnt/cdrom/stages/stage<your stage>.tar.bz2
(or download the latest tarball...) 
                                 # links http://www.gentoo.org/main/en/mirrors.xml
(    ... and extract)            # tar -xvjpf stage<your stage>.tar.bz2
(Optional: unpack a portage tree)# tar -xvjf /mnt/cdrom/snapshots/portage-*.tar.bz2 \
                                   -C /mnt/gentoo/usr
(Optional: copy over distfiles)  # cd /mnt/gentoo/usr/portage; mkdir distfiles;
                                 # cp /mnt/cdrom/distfiles/* distfiles/
(Select a mirror)                # mirrorselect -a -s4 -o | grep 'GENTOO_MIRRORS=' \
                                   >> /mnt/gentoo/etc/make.conf
(Copy over nameserver information)
                                 # cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
(Mount the proc filesystem)      # mount -t proc none /mnt/gentoo/proc
(Chroot into the new environment)# chroot /mnt/gentoo /bin/bash
(Load the necessary variables)   # env-update; source /etc/profile
(Network-only, non-GRP: update Portage)
                                 # emerge --sync

Now we install Gentoo:

Code Listing 1.3: Installing Gentoo

(Change USE, CFLAGS and CXXFLAGS. Stage1 can also change CHOST)  
                                  # nano -w /etc/make.conf
(Stage1 only: bootstrap system)   # cd /usr/portage; scripts/bootstrap.sh
(Stage1, Stage2 only: install base system)
                                  # emerge system

Next we set up the necessary information:

Code Listing 1.4: Setting up Configuration Files

(Set timezone information) # ln -sf /usr/share/zoneinfo/<path to time zone file> /etc/localtime
(Edit fstab file)          # nano -w /etc/fstab

Use the following as a template (don't copy verbatim) for /etc/fstab:

Code Listing 1.5: /etc/fstab

# <fs>          <mountpoint>    <type>          <opts>                  <dump/pass>
/dev/hdax       /boot           ext2            noauto,noatime          1 2
/dev/hdax       none            swap            sw                      0 0
/dev/hdax       /               reiserfs        noatime                 0 1
/dev/cdroms/cdrom0 /mnt/cdrom   auto            noauto,user             0 0
none            /proc           proc            defaults                0 0
none            /dev/shm        tmpfs           nodev,nosuid,noexec     0 0

Continue by installing the Linux kernel:

Code Listing 1.6: Installing the Kernel

(Install the kernel sources)    # emerge <kernel-package-here>
(Configure your kernel using genkernel...) 
                                # emerge genkernel; genkernel --menuconfig all
(or (1) manually build your kernel)
                                # cd /usr/src/linux; make menuconfig;
(   (2) Include VM fs, /proc fs, /dev fs,  /dev fs auto mount at boot)
(   (3) Compile your kernel) 
           (for a 2.4 kernel)   # make dep && make clean bzImage modules modules_install
           (for a 2.6 kernel)   # make && make modules_install
(   (4) Copy over the kernel)   # cp arch/i386/boot/bzImage /boot; cp System.map /boot

Now install other tools you might want:

Code Listing 1.7: Install important system tools

(Install system logger; choice: sysklogd, metalog, msyslog, syslog-ng) 
                                          # emerge syslog-ng 
(Have the systemlogger automatically started at boot)
                                          # rc-update add syslog-ng default
(Install cron daemon; choice: vixie-cron, dcron, fcron)                
                                          # emerge vixie-cron
(Have the cron daemon automatically started at boot)                   
                                          # rc-update add vixie-cron default   
(genkernel users only: install hotplug)   # emerge hotplug
(genkernel users only: have hotplug automatically started at boot)     
                                          # rc-update add hotplug default
(Non-ext2,ext3 users only; choice: reiserfsprogs, xfsprogs, jfsutils)  
                                          # emerge reiserfsprogs
(Domain name init script)                 # rc-update add domainname default

If you need specialised kernel ebuilds, now is a good time to install them:

Code Listing 1.8: Install Specialised Kernel Ebuilds

# emerge pcmcia-cs (or nforce-net, nforce-audio, e100, e1000, ati-drivers, rp-pppoe)
# VIDEO_CARDS="yourcard" emerge xfree-drm   (for ATI Radeon up to 9200, Rage128, 
                                            Matrox, Voodoo and other cards)

Finalise the settings for your Gentoo system:

Code Listing 1.9: Finalise the Configuration Settings

(Set root password)          # passwd
(Create a user)              # useradd your_user -m -G users,wheel,audio -s /bin/bash
(Set password for that user) # passwd your_user
(Set the system hostname)    # echo mymachine > /etc/hostname
(Set the system domainname)  # echo mydomain.com > /etc/dnsdomainname
(Set the hostsfile, ex:"127.0.0.1 localhost mymachine")  
                             # nano -w /etc/hosts
(Configure basic system settings; follow comments)       
                             # nano -w /etc/rc.conf

Code Listing 1.10: Set up Networking

(Setup networking; dhcp-users should set iface_eth0="dhcp")      
                              # nano -w /etc/conf.d/net
(List modules to be loaded at startup)
                              # nano -w /etc/modules.autoload.d/kernel-<version>
(Non-PCMCIA only: start networking automatically at boot)        
                              # rc-update add net.eth0 default
(Only if you have multiple network interfaces:)
   (1) Create initscripts for each interface)                    
                              # ln -s /etc/init.d/net.eth0 /etc/init.d/net.ethx
   (2) Automatically start at boot if no PCMCIA)
                              # rc-update add net.ethx default
(PCMCIA only: verify /etc/conf.d/pcmcia and load PCMCIA at boot) 
                              # rc-update add pcmcia boot

Now install a bootloader.

Code Listing 1.11: Install and configure GRUB

# emerge grub
# grub
grub> root (hd0,0)
grub> setup (hd0)
grub> quit
# nano -w /boot/grub/grub.conf
default 0
timeout 15
splashimage=(hd0,0)/grub/splash.xpm.gz

title=Gentoo Linux
  root (hd0,0)
  # genkernel users:
  kernel /kernel-<kernel version> root=/dev/ram0 init=/linuxrc real_root=/dev/hda3
  initrd /initrd-<kernel version>
  # non-genkernel users:
  kernel /kernel-<kernel version> root=/dev/hda3

Code Listing 1.12: Install and configure LILO

# emerge lilo
# nano -w /etc/lilo.conf
boot=/dev/hda
prompt
timeout=50
default=gentoo

image=/boot/kernel-<kernel version> 
  label=gentoo
  read-only
  # genkernel users:
  append="init=/linuxrc real_root=/dev/hda3"
  root=/dev/ram0
  initrd=/boot/initrd-<kernel version>
  # non-genkernel users:
  root=/dev/hda3

# /sbin/lilo

Now unmount all partitions and reboot into your new system:

Code Listing 1.13: Finishing off and installing GUI

(Exiting the chroot)         # exit; cd /
(Unmounting partitions)      # umount /mnt/gentoo/boot /mnt/gentoo/proc /mnt/gentoo
(Reboot; Remove the universal CD from the tray) 
                             # reboot
(After booting:)
(ADSL-users only)            # adsl-setup
(GRP-users only)
   (1) Mount Package CD      # mount /dev/cdrom /mnt/cdrom  
   (2) Copy over packages    # mkdir /usr/portage/packages
                             # cp -a /mnt/cdrom/* /usr/portage/packages/
   (3) Install extra software# USE="bindist" emerge -k xfree gnome kde mozilla openoffice-bin
   (4) Configure your Xserver# /usr/X11R6/bin/xf86config

You can get more information from the Gentoo Documentation.


The contents of this document are licensed under the Creative Commons - Attribution / Share Alike license.
Print
line
Updated October 10, 2004
line
Steven Wagner
Author

Sven Vermeulen
Editor

line
Summary:  The Quick install reference covers all details of the install process in a non-verbose manner. Users should already have prior experience with installing Gentoo Linux if they want to follow this guide.
line
The Gentoo Linux Store
line
Copyright 2001-2004 Gentoo Foundation, Inc. Questions, Comments, Corrections? Email [email protected].