Gentoo Logo

Gentoo Linux x86 Quick Install Guide

Content:

1. Quick Install Guide

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: Initial 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.

Warning: For ext3 partitions, you need to specify mount -t ext3 explicitly. This is due to a bug in the e2fsprogs package.

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 go onto setting our profile and installing Gentoo. A profile is a building block for any Gentoo system. Not only does it specify default values for CHOST, CFLAGS and other important variables, it also locks the system to a certain range of package versions. This is all maintained by the Gentoo developers.

Code Listing 1.3: Installing Gentoo

(Verify current profile)          # ls -l /etc/make.profile
(Change ONLY IF REQUIRED or if you want a 2.4 kernel)   
                                  # ln -snf /usr/portage/profiles/default-linux/x86/2005.0/2.4 /etc/make.profile
(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. Use --emptytree if you modified USE flags. Else --newuse will do. 
 One of these options is a must. )
                                  # emerge --emptytree system OR emerge --newuse 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            defaults,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)
(   (3) Compile your kernel) 
           (for a 2.6 kernel)   # make && make modules_install   
           (for a 2.4 kernel)   # make dep && make clean bzImage modules 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 *plug)     # emerge coldplug hotplug
(genkernel users only: have coldplug automatically started at boot)     
                                          # rc-update add coldplug boot
(Non-ext2,ext3 users only; choice: reiserfsprogs, xfsprogs, jfsutils)  
                                          # emerge reiserfsprogs
(Optional: install DHCP client)           # emerge dhcpcd 
(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 x11-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 default

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 ramdisk=8192
  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 ramdisk=8192"
  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 xorg-x11 gnome kde mozilla openoffice-bin
  (4) Configure your Xserver # /usr/X11R6/bin/xorgconfig

You can get more information from the Gentoo Documentation.



Print

Updated April 16, 2005

Summary: The Quick install guide 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.

Steven Wagner
Author

Sven Vermeulen
Editor

Donate to support our development efforts.

Tek Alchemy

Tek Alchemy offers dedicated servers and other hosting solutions running Gentoo Linux.

php|architect

php|architect is the monthly magazine for PHP professionals, available worldwide in print and electronic format. A percentage of all the sales will be donated back into the Gentoo project.

The Gentoo Linux Store
SevenL.net

Seven L Networks provides customizable Dedicated Servers for your customized Gentoo install. Colocation and other hosting services are also provided.

$99/mo dedicated servers

No BS Dedicated Gentoo Linux Servers from vr.org.

Copyright 2001-2005 Gentoo Foundation, Inc. Questions, Comments, Corrections? Email www@gentoo.org.