Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc
Warning: Beware: This page is very outdated.
Split-arrows.gifIt has been suggested that this article be split into multiple articles accessible from an index page.   (Discuss).
An Index page has been created that this article's contents should be split into: Template:GWikInstall please use it to make the article more atomic.
Merge-arrows.gifIt has been suggested that this article be Merged into one article with Advanced, GWikInstall    (Discuss)

Please format this article according to the guidelines and Wikification suggestions, then remove this notice {{Wikify}} from the article

Based on the forum guide by: --ali3nx, eMail



First of all, welcome to Gentoo. You are about to enter the world of choices and performance. Gentoo is all about choices. When installing Gentoo, this is made clear to you several times -- you can choose how much you want to compile yourself, how to install Gentoo, what system logger you want, etc.

Gentoo is a fast, modern metadistribution with a clean and flexible design. Gentoo is built around free software and doesn't hide from its users what is beneath the hood. Portage, the package maintenance system which Gentoo uses, is written in Python, meaning you can easily view and modify the source code. Gentoo's packaging system uses source code (although support for precompiled packages is included too) and configuring Gentoo happens through regular textfiles. In other words, openness everywhere.

What is Stage1 About?

Starting from a stage1 install allows you to have total control over the optimization settings and optional build-time functionality that is initially enabled on your system. This makes stage1 installs good for power users who know what they are doing. It is also a great installation method for those who would like to know more about the inner workings of Gentoo Linux.

A stage1 installation can only be performed when you have a working Internet connection.

Stage1Pros and Cons
+Allows you to have total control over the optimization settings and optional build-time functionality that is initially enabled on your system
+Suitable for powerusers that know what they are doing
+Allows you to learn more about the inner workings of Gentoo
-Takes a long time to finish the installation
-If you don't intend to tweak the settings, it is probably a waste of time
-Not suitable for networkless installations

Now take a look at the available installation media.

Gentoo LiveCDs

The Gentoo LiveCDs are bootable CDs which contain a self-sustained Gentoo environment. They allow you to boot Linux from the CD. During the boot process your hardware is detected and the appropriate drivers are loaded. They are maintained by Gentoo developers.

All LiveCDs allow you to boot, set up networking, initialize your partitions and start installing Gentoo from the Internet. However, some LiveCDs also contain all necessary source code so you are able to install Gentoo without a working network configuration.

As we are concerned with an install from stage1 the Minimal LiveCD is all that is required.

Gentoo's Minimal LiveCD

This is a small, no-nonsense, bootable CD, the sole purpose of which is to boot the system, prepare the networking and continue with the Gentoo installation. It does not contain any stages (or, in some cases, a single stage1 file), source code or precompiled packages. For example the x86 variant of this LiveCD can be found in the livecd/ subdirectory and is called install-x86-minimal-2006.0.iso.

Download, Burn and Boot a Gentoo LiveCD

Downloading and Burning the LiveCDs

We'll first start by downloading and burning the chosen LiveCD. We previously discussed the available LiveCDs, but where can you find it?

You can download the LiveCDs from one of our mirrors or via a torrent

Inside that directory you'll find so-called ISO-files. Those are full CD images which you can write on a CD-R. In case you wonder if your downloaded file is corrupted or not, you can check its MD5 checksum and compare it with the MD5 checksum we provide (such as install-x86-minimal-2004.3.iso.md5). You can check the MD5 checksum with the md5sum tool under Linux/Unix or md5sum for Windows.

To burn the downloaded ISO(s), you have to select raw-burning. How you do this is highly program-dependent. We will discuss cdrecord and K3B here; more information can be found in our Gentoo FAQ.

> cdrecord dev=/dev/hdc livecd.iso

Replace /dev/hdc with your CD-RW drive's device path and livecd.iso with the name of your ISO image file. :)

Booting the LiveCD(s)


Read this whole subsection before continuing, as you will probably not have the opportunity to read it before doing things later.

Once you have burned your installation CDs, it is time to boot them. Remove all CDs from your CD drives, reboot your system and enter the BIOS. This is usually done by hitting DEL, one of the function keys, or ESC, depending on your BIOS. Inside the BIOS, change the boot order so that the CD-ROM is tried before the hard disk. This is often found under "CMOS Setup". If you don't do this, your system will just reboot from the hard disk, ignoring the CD-ROM.

Now place the installation CD in the CD-ROM drive and reboot. You should see a boot prompt. At this screen, you can hit Enter to begin the boot process with the default boot options, or boot the LiveCD with custom boot options by specifying a kernel followed by boot options and then hitting Enter.


About the Gentoo Linux Installation

Optional: Starting the SSH Daemon

Setting up Gentoo is easiest via a ssh session from another machine, allowing you to read (this guide for example) while staying connected to a gentoo help channel on irc and being able to browse the net all in a GUI, making life easier in many ways.

First let's give the 'virtual' livecd root account a password

# passwd

and if it is easier for you to make alterations through sshd let's start it up

# /etc/init.d/sshd start

Run 'ifconfig' and note down the ip address of the system, you will need to 'ssh root@recordedip' to continue with the installation.

Optimizing Media Access

So you have the sexiest windows box in the universe eh...? Think it's quick..? I think not.

In Windows you do not have a way to make changes to the hard drives' performance parameters. Linux does. hdparm is the utility that allows you to set your hard disks and CD-ROM drives to utilize the fastest 32-bit and UDMA transfer modes supported by your hard disks.

Keep in mind that hdparm is intended more for IDE/UDMA/ATA-based systems because SATA and SCSI disks have the ability to dynamically affect these changes from the controller's chipset. Gentoo Linux adds hdparm in all the LiveCDs, even the minimal one. The results from using it can save you days of waiting for apps to compile if your motherboard's IDE chipset does not automatically set the hard drives' performance parameters to use 32bit I/O, multcount and read-ahead disk modes for your system.

Hard disks, CD-ROMs, CD-RWs, DVD-RWs all may require these modes to be set to allow your system to truly achieve the performance Linux can really offer. Below you will see four examples. The first is a non-optimized drive offering no DMA, 32bit I/O, multicount or unmaskirq usage. The second and third shows how to set these modes for hard disks and optical storage readers and writers. The fourth are the results of the settings.

The un-optimized view would or could look like this:

# hdparm /dev/hda

multcount    =  0 (off)
IO_support   =  0 (default 16-bit)
unmaskirq    =  0 (off)
using_dma    =  0 (off)
keepsettings =  0 (off)
readonly     =  0 (off)
readahead    = 256 (on)
geometry     = 16383/255/63, sectors = 78165360, start = 0

To set optimized transfer modes for most hard disks from the LiveCD do the following:

# hdparm -d1c1u1m16 /dev/hda

To set the optimized transfer modes for most CD-ROM/RW and DVD-ROM/RW devices from the LiveCD do the following if your LiveCD is in the master CD device for all CD-ROMs. If your LiveCD is the second of two CD devices, substitute cdroms0 with cdroms1 or use hdparm and set the parameters for both devices to ensure they achieve maximum performance. Your system runs from this CD while it builds, so giving it all the data bandwidth it can use would be very benificial. Keep in mind that CD-ROMs do not use multicount.

# hdparm -d1c1u1 /dev/cdroms/cdrom0

The optimized results:

# hdparm -d1c1u1m16 /dev/hda

setting 32-bit IO_support flag to 1
setting multcount to 16
setting unmaskirq to 1 (on)
setting using_dma to 1 (on)
multcount    = 16 (on)
IO_support   =  1 (32-bit)
unmaskirq    =  1 (on)
using_dma    =  1 (on)

Setting Up the Network

2004.3 is stable with loading networking on boot however there will be the odd occasion that you will need to go back to the drawing board and run through the paces manually and setup your networking if you don't have a dhcp server on your network.

# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:04:5A:8E:03:6D
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::204:5aff:fe8e:36d/64 Scope:Link
          RX packets:22023 errors:0 dropped:0 overruns:0 frame:0
          TX packets:18541 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:4518758 (4.3 MiB)  TX bytes:1445428 (1.3 MiB)
          Interrupt:10 Base address:0xec00

#  ping -c 5
PING ( 56(84) bytes of data.
64 bytes from icmp_seq=1 ttl=235 time=373 ms
64 bytes from icmp_seq=3 ttl=235 time=376 ms
64 bytes from icmp_seq=4 ttl=235 time=364 ms

--- ping statistics ---
5 packets transmitted, 3 received, 40% packet loss, time 4011ms
rtt min/avg/max/mdev = 364.373/371.535/376.466/5.230 ms, pipe 2

If you see packet traffic it's time to continue. If not head over to gentoo's irc chans for user support.

Note: Before heading over to irc, try running net-setup from the LiveCD. This will usually set things up properly.

Preparing the Disks

Fdisk Primer and Setting up Filesystems

First check your system for available disks. If this command prints nothing you have a problem that is outside the scope of this handbook:

Code: Check your system for available disks
# fdisk -l

Disk /dev/hda: 54.8 GB, 54896492544 bytes
255 heads, 63 sectors/track, 6674 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Using fdisk - fdisk in a nutshell..

Code: The manual of fdisk
The number of cylinders for this disk is set to 14593.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs

Command (m for help): m
Command action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)

Proceed to create each partition by entering options:

  1. n - new partition
  2. p - primary (or e for extended)
  3. # - this is the number of partition

Here is a guide for how you should setup the partitions

Filesystem    Type    Size  Mounted on
/dev/hda1     ext3    509M  /boot
/dev/hda2     swap    1.0G  <Linux Swap>
/dev/hda3     ext3   10.0G  /

Optional: Other Partitions

Some users may find it useful to have have folders such as '/opt' and '/home' mounted in differnt a) partitions and or b) drives. There can only be a maximum of either four primary partitions or three primary partitions and an 'extended partition' that can house many 'logical partitions', and due to this we allocate the rest of the space to the extended partition and then setup each logical partition as needed (inside that). Seems complicated but it is quite easy once you get the hang of it.

/dev/hda4     ext3    Rest  <Extended Partition>
/dev/hda5     ext3    1.0G  /opt
/dev/hda6     ext3    Rest  /home

Set hda1 to Active with "a" and also change the swap partition "type" of hda2 to swap By pressing "t" and entering type "82", which is the hex code for linux swap. See the fdisk manual above if you're confused.

What you'll see if correctly set up via fdisk

   Device Boot      Start         End      Blocks   Id  System
/dev/hda1   *           1         970      488848+  83  Linux
/dev/hda2             971        2909      977256   82  Linux swap
/dev/hda3            2910       22286     9766008   83  Linux

optionally seen if included in the partition table

/dev/hda4           22287      238216   108828720    5  Extended
/dev/hda5           22287       24225      977224+  83  Linux
/dev/hda6           24226      238216   107851432+  83  Linux

Filesystems and Mounting

Using ext2 or ext3 would be such a waste. It's slow, it cannot output I/O at the rates of reiserfs 3.6 or reiser4... Yes I tested Reiser4 stability for Gentoo and it's fsckin killa over 80MB/s I/O on hard drives *not* properly tuned with hdparm for udma133 with no raid.

Reiser4 was recently released as a stable filesystem. and if you've been folIowing the news on reiser4.. It's the fastest filesystem on the planet. I will be adding Reiser4 as an optional filesystem in this tutorial in the very near future as time permits.

To create file systems:

If you have a sata or SCSI system replace hda with sda appropriately in the following code examples.

# mkreiserfs /dev/hda1 && mkreiserfs /dev/hda3 && mkreiserfs /dev/hda5 && mkreiserfs /dev/hda6

or if you would like to stick with ext3

# mke2fs -j /dev/hda1 && mke2fs -j /dev/hda3 && mke2fs -j /dev/hda5 && mke2fs -j /dev/hda6


# mkswap /dev/hda2 && swapon /dev/hda2
# mount /dev/hda3 /mnt/gentoo && mkdir /mnt/gentoo/boot && mount /dev/hda1 /mnt/gentoo/boot

Installing the Gentoo Installation Files

Setting the Date/Time Right

Before you continue you need to check your date/time and update it. A misconfigured clock may lead to strange results in the future!

To verify the current date/time, run date:

# date
Fri Oct 29 16:21:18 CEST 2004

If the date/time displayed is wrong, update it using the date MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year). For instance, to set the date to October 29th, 16:21 in the year 2004:

# date 102916212004

Retrieving a Base System Stage

If you're planning a stage1 installation, use a generic x86 stage1 gentoo stage. It's the only stage that will let you build a full posix install with the native linux posix threading model that makes pthreading look like child's play. To use it you must compile every application to support it specifically toolchain, which primarily consists of glibc and gcc. For this example we're going for brutal speed and agility. So, if you've been following, it's stage1 we're planning to build. Precompilied applications in a can will leave you with broken libs or unsupported features. I find that the best results are obtained by compiling it all. Linux systems are akin to a tree; if the tree has no roots its leaves will fall and the tree will die.

# cd /mnt/gentoo/
# wget
# tar -xvjpf stage?-*.tar.bz2

or for the "current" stage

# cd /mnt/gentoo/
# wget
# tar -xvjpf stage1*

Updated make.conf

I have a completed make.conf available for everyone to download and edit to suit their requirements. I've made notes and comments where appropriate to reflect any known bugs and have done my best to make this configuration as heterogeneous as possible. Due to the amount of variables in Gentoo's make.conf they cannot be covered in this tutorial. If you require some assistance ingesting how make.conf works,

Code: take a look at the man page
man make.conf

and to get a better idea of how portage works, check out Gentoo's official portage documentation.

Configured for Athlon-XP Processors

Download the file by performing

During the creation of the article I ended up documenting anything and everything that was edited/created and the following file is what was actually used in the move from stage 1 to stage 2. If you look at the USE flags at the end of this list you will see some 'undeclared' flags in there such as sse which is also supported by this processor and these flags were found by performing the following:

File: /etc/make.conf
# **********************************************************************
# /etc/make.conf - Edited 4th Jan, 2005 - bsodmike
# **********************************************************************

#For Athlon-XP Processors:
# My personal 2100XP running @ 2700XP...

#processor       : 0
#vendor_id       : AuthenticAMD
#cpu family      : 6
#model           : 8
#model name      : AMD Athlon(tm) Processor
#stepping        : 1
#cpu MHz         : 2171.575
#cache size      : 256 KB
#fdiv_bug        : no
#hlt_bug         : no
#f00f_bug        : no
#coma_bug        : no
#fpu             : yes
#fpu_exception   : yes
#cpuid level     : 1
#wp              : yes
#flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 mmx fxsr
#                  sse syscall mmxext 3dnowext 3dnow
#bogomips        : 4276.22
# cat /proc/cpuinfo to find CPU Info


# Copyright 2000-2003 Daniel Robbins, Gentoo Technologies, Inc.
# Contains local system settings for Portage system
# $Header: /home/cvsroot/gentoo-src/portage/cnf/make.conf,v 1.70 2004/01/12 07:34:38 carpaski Exp $

# Please review 'man make.conf' for more information.

# Build-time functionality
# ========================
# The USE variable is used to enable optional build-time functionality. For
# example, quite a few packages have optional X, gtk or GNOME functionality
# that can only be enabled or disabled at compile-time. Gentoo Linux has a
# very extensive set of USE variables described in our USE variable HOWTO at
# The available list of use flags with descriptions is in your portage tree.
# Use 'less' to view them:  --> less /usr/portage/profiles/use.desc <--
# 'ufed' is an ncurses/dialog interface available in portage to make handling
# useflags for you. 'emerge app-admin/ufed'
# Example:
#USE="X gtk gnome -alsa"

# Host Setting
# ============
# If you are using a Pentium Pro or greater processor, leave this line as-is;
# otherwise, change to i586, i486 or i386 as appropriate. All modern systems
# (even Athlons) should use "i686-pc-linux-gnu". All K6's are i586.

# Host and optimization settings
# ==============================
# For optimal performance, enable a CFLAGS setting appropriate for your CPU.
# Please note that if you experience strange issues with a package, it may be
# due to gcc's optimizations interacting in a strange way. Please test the
# package (and in some cases the libraries it uses) at default optimizations
# before reporting errors to developers.
# -mcpu=<cpu-type> means optimize code for the particular type of CPU without
# breaking compatibility with other CPUs.
# -march=<cpu-type> means to take full advantage of the ABI and instructions
# for the particular CPU; this will break compatibility with older CPUs (for
# example, -march=athlon-xp code will not run on a regular Athlon, and
# -march=i686 code will not run on a Pentium Classic.
# CPU types supported in gcc-3.2 and higher: athlon-xp, athlon-mp,
# athlon-tbird, athlon, k6, k6-2, k6-3, i386, i486, i586 (Pentium), i686
# (PentiumPro), pentium, pentium-mmx, pentiumpro, pentium2 (Celeron),
# pentium3, and pentium4.
# Note that Gentoo Linux 1.4 and higher include at least gcc-3.2.
# CPU types supported in gcc-2.95*: k6, i386, i486, i586 (Pentium), i686
# (Pentium Pro), pentium, pentiumpro Gentoo Linux 1.2 and below use gcc-2.95*
# CRITICAL WARNINGS: ****************************************************** #
# K6 markings are deceptive. Avoid setting -march for them. See Bug #24379. #
# ************************************************************************* #
# Unset ONE of the cflag examples that best resembles your cpu
# You must uncomment one that matches your cpu
# Athlon class cpu's below
#CFLAGS="-march=athlon -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=athlon-tbird -O2 -fomit-frame-pointer -pipe"
CFLAGS="-march=athlon-xp -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=athlon-4 -O2 -fomit-frame-pointer -pipe"

# Pentium class cpu's below
#CFLAGS="-march=pentium-mmx -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=pentium2 -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=pentium3 -O2 -fomit-frame-pointer -pipe"
#CFLAGS="-march=pentium4 -O2 -fomit-frame-pointer -pipe"

# If you set a CFLAGS above, then this line will set your default C++ flags to
# the same settings.
# Setting LDFLAGS is still experimental use them only if you are truly experienced
# man ld to learn how use flags affect gentoo linux
#LDFLAGS="-Wl,-O1 -Wl,--relax -Wl,--enable-new-dtags -Wl,--sort-common -s"
# Advanced Masking
# ================
# Gentoo is using a new masking system to allow for easier stability testing
# on packages. KEYWORDS are used in ebuilds to mask and unmask packages based
# on the platform they are set for. A special form has been added that
# indicates packages and revisions that are expected to work, but have not yet
# been approved for the stable set. '~arch' is a superset of 'arch' which
# includes the unstable, in testing, packages. Users of the 'x86' architecture
# would add '~x86' to ACCEPT_KEYWORDS to enable unstable/testing packages.
# '~ppc', '~sparc' are the unstable KEYWORDS for their respective platforms.
# Please note that this is not for development, alpha, beta, nor cvs release
# packages. "Broken" packages will not be added to testing and should not be
# requested to be added. Alternative routes are available to developers
# for experimental packages, and it is at their discretion to use them.
# Portage Directories
# ===================
# Each of these settings controls an aspect of portage's storage and file
# system usage. If you change any of these, be sure it is available when
# you try to use portage. *** DO NOT INCLUDE A TRAILING "/" ***
# PORTAGE_TMPDIR is the location portage will use for compilations and
#     temporary storage of data. This can get VERY large depending upon
#     the application being installed.
# PORTDIR is the location of the portage tree. This is the repository
#     for all profile information as well as all ebuilds. This directory
#     itself can reach 200M. WE DO NOT RECOMMEND that you change this.
# DISTDIR is where all of the source code tarballs will be placed for
#     emerges. The source code is maintained here unless you delete
#     it. The entire repository of tarballs for gentoo is 9G. This is
#     considerably more than any user will ever download. 2-3G is
#     a large DISTDIR.
# PKGDIR is the location of binary packages that you can have created
#     with '--buildpkg' or '-b' while emerging a package. This can get
#     upto several hundred megs, or even a few gigs.
# PORT_LOGDIR is the location where portage will store all the logs it
#     creates from each individual merge. They are stored as YYMMDD-$PF.log
#     in the directory specified. This is disabled until you enable it by
#     providing a directory. Permissions will be modified as needed IF the
#     directory exists, otherwise logging will be disabled.
# PORTDIR_OVERLAY is a directory where local ebuilds may be stored without
#     concern that they will be deleted by rsync updates. Default is not
#     defined.

# Fetching files
# ==============
# If you need to set a proxy for wget or lukemftp, add the appropriate "export
# ftp_proxy=<proxy>" and "export http_proxy=<proxy>" lines to /etc/profile if
# all users on your system should use them.
# Portage uses wget by default. Here are some settings for some alternate
# downloaders -- note that you need to merge these programs first before they
# will be available.
# Default fetch command (5 tries, passive ftp for firewall compatibility)
#FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp \${URI} -P \${DISTDIR}"
#RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp \${URI} -P \${DISTDIR}"
# Using wget, ratelimiting downloads
#FETCHCOMMAND="/usr/bin/wget -t 5 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
#RESUMECOMMAND="/usr/bin/wget -c -t 5 --passive-ftp --limit-rate=200k \${URI} -P \${DISTDIR}"
# Lukemftp (BSD ftp):
#FETCHCOMMAND="/usr/bin/lukemftp -s -a -o \${DISTDIR}/\${FILE} \${URI}"
#RESUMECOMMAND="/usr/bin/lukemftp -s -a -R -o \${DISTDIR}/\${FILE} \${URI}"
# Prozilla (turbo downloader)
#FETCHCOMMAND='/usr/bin/proz --no-getch -s ${URI} -P ${DISTDIR}'
# Portage uses GENTOO_MIRRORS to specify mirrors to use for source retrieval.
# The list is a space seperated list which is read left to right. If you use
# another mirror we highly recommend leaving the default mirror at the end of
# the list so that portage will fall back to it if the files cannot be found
# on your specified mirror. We _HIGHLY_ recommend that you change this setting
# to a nearby mirror by merging and using the 'mirrorselect' tool.

# Portage uses PORTAGE_BINHOST to specify mirrors for prebuilt-binary packages.
# The list is a single extry specifying the full address of the directory
# serving the tbz2's for your system. Running emerge with either '--getbinpkg'
# or '--getbinpkgonly' will cause portage to retrieve the metadata from all
# packages in the directory specified, and use that data to determine what will
# be downloaded and merged. '-g' or '-gK' are the recommend parameters. Please
# consult the man pages and 'emerge --help' for more information.

# Synchronizing Portage
# =====================
# Each of these settings effects how Gentoo synchronizes your Portage tree.
# Synchronization is handled by rsync and these settings allow some control
# over how it is done.
# SYNC is the server used by rsync to retrieve a localized rsync mirror
#     rotation. This allows you to select servers that are geographically
#     close to you, yet still distribute the load over a number of servers.
#     Please do not single out specific rsync mirrors. Doing so places undue
#     stress on particular mirrors.  Instead you may use one of the following
#     continent specific rotations:
#   Default:       "rsync://"
#   North America: "rsync://"
#   South America: "rsync://"
#   Europe:        "rsync://"
#   Asia:          "rsync://"
#   Australia:     "rsync://"

# RSYNC_RETRIES sets the number of times portage will attempt to retrieve
#     a current portage tree before it exits with an error. This allows
#     for a more successful retrieval without user intervention most times.
# RSYNC_TIMEOUT sets the length of time rsync will wait before it times out
#     on a connection. Most users will benefit from this setting as it will
#     reduce the amount of 'dead air' they experience when they run across
#     the occasional, unreachable mirror. Dialup users might want to set this
#     value up around the 300 second mark.

# Advanced Features
# =================
# MAKEOPTS provides extra options that may be passed to 'make' when a
#     program is compiled. Presently the only use is for specifying
#     the number of parallel makes (-j) to perform. The suggested number
#     for parallel makes is CPUs+1.
# PORTAGE_NICENESS provides a default increment to emerge's niceness level.
#     Note: This is an increment. Running emerge in a niced environment will
#     reduce it further. Default is unset.
# AUTOCLEAN enables portage to automatically clean out older or overlapping
#     packages from the system after every successful merge. This is the
#     same as running 'emerge -c' after every merge. Set with: "yes" or "no".
#     This does not affect the unpacked source. See 'noclean' below.
# FEATURES are settings that affect the functionality of portage. Most of
#     these settings are for developer use, but some are available to non-
#     developers as well.
#  'autoaddcvs'  causes portage to automatically try to add files to cvs
#                that will have to be added later. Done at generation times
#                and only has an effect when 'cvs' is also set.
#  'buildpkg'    causes binary packages to be created of all packages that
#                are merged.
#  'ccache'      enables ccache support via CC.
#  'cvs'         feature for developers that causes portage to enable all
#                cvs features (commits, adds) and all USE flags in SRC_URI
#                will be applied for digests.
#  'digest'      autogenerate a digest for packages.
#  'distcc'      enables distcc support via CC.
#  'fixpackages' allows portage to fix binary packages that are stored in
#                PKGDIR. This can consume a lot of time. 'fixpackages' is
#                also a script that can be run at any given time to force
#                the same actions.
#  'keeptemp'    prevents the clean phase from deleting the temp files ($T)
#                from a merge.
#  'keepwork'    prevents the clean phase from deleting the WORKDIR.
#  'noauto'      causes ebuild to perform only the action requested and
#                not any other required actions like clean or
#  'noclean'     prevents portage from removing the source and temporary files
#                after a merge -- for debugging purposes only.
#  'nostrip'     prevents stripping of binaries.
#  'notitles'    disables xterm titlebar updates (which contain status info).
#  'sandbox'     enable sandbox-ing when running emerge and ebuild
#  'strict'      causes portage to react strongly to conditions that
#                have the potential to be dangerous -- like missing or
#                incorrect Manifest files.
#  'userpriv'    allows portage to drop root privleges while it is compiling
#                as a security measure, and as a side effect this can remove
#                sandbox access violations for users.
#  'usersandbox' enables sandboxing while portage is running under userpriv.
#                unpack -- for debugging purposes only.
#FEATURES="sandbox ccache distcc"
FEATURES="sandbox ccache"
# CCACHE_SIZE sets the space use limitations for ccache. The default size is
#     2G, and will be set if not defined otherwise and ccache is in features.
#     Portage will set the default ccache dir if it is not present in the
#     user's environment, for userpriv it sets: ${PORTAGE_TMPDIR}/ccache
#     (/var/tmp/ccache), and for regular use the default is /root/.ccache.
#     Sizes are specified with 'G' 'M' or 'K'.
#     '4G' for 4 gigabytes, '4096M' for 4 gigabytes, etc... Default is 2G
# DISTCC_DIR sets the temporary space used by distcc.
# RSYNC_EXCLUDEFROM is a file that portage will pass to rsync when it updates
#     the portage tree. Specific chucks of the tree may be excluded from
#     consideration. This may cause dependency failures if you are not careful.
#     The file format is one pattern per line, blanks and ';' or '#' lines are
#     comments. See 'man rsync' for more details on the exclude-from format.


#  Use the USE= below during bootstrap to ensure you have no problems during bootstrap
#  IMPORTANT!!!  Adjust mmx, mmx2, sse, sse2, 3dnow, 3dnowext use flags appropriately
#                for your cpu type or you will have a bad day
#                public service message from ali3nx
#  USE adjusted to reflect gcj gcc ebuild bootstrap bug. 29/09/2004
#  wiki use edited by ali3nx  01/01/2005

USE="16bit aac acl acpi activefilter aim amd ansi apache2 \
     artworkextra audiofile authdaemond avantgo bash-completion \
     bcmath bdf bidi blender-game bluetooth bzip2 bzlib cap cddb cdinstall \
     cdparanoia cdrom cgi chroot cjk clanJavaScript clanVoice client \
     code imap jython kadu-modules kadu-voice kakasi kerberos krb4 \
     latex lcms leim libclamav libdsk libgd libgda libsamplerate libwww \
     live lua lufsusermount lzo lzw lzw-tiff m17n-lib maildir matroska \
     mbox mcal mdb memlimit migemo mime mixer mjpeg mls mmap mng \
     monkey mozcalendar mozdevelop mozp3p mozsvg mozxmlterm mp3 mpeg4 \
     mpi mplayer msn mule music mythtv mysql nagios-dns \
     nagios-ntp nagios-ping nagios-ssh native net netcdf network \
     neural nis nowin nptl nptlonly ntlm nviz oav objc ocaml \
     offensive ofx openal opie oscar ospfapi \
     parse-clocks pcap pcntl pcre pdf pg-hier pg-intdatetime \
     pg-vacuumdelay php physfs pic plotutils portaudio posix postgresql \
     povray ppds pri print procmail pthreads quotas quotes real \
     resperl rhino rogue rplay S3TC samba sasl servlet-2.3 servlet-2.4 session \
     sftplogging shared sharedmem silc simplexml skk slp smime sndfile \
     snortsam sockets socks5 softquota sox spl ssl stencil-buffer stroke \
     struts svg sysvipc szip t1lib tcsim tga theora tidy transcode \
     truetype-fonts type1-fonts uim underscores unicode usb v4l v4l2 vcd \
     vda videos virus-scan wddx winbind wmf wxwindows X509 xanim xatrix \
     xchatdccserver xchattext xemacs xface xgetdefault xine xmlrpc xosd \
     xpm xprint xrandr xscreensaver xsl xvid xvmc yahoo yaz yp yv12 zaptel \
     zeo zvbi"
- remove the "sasl" USE flag - if you have a circular dependency when "emerge --deep system"


In this file the 'GENTOO_MIRRORS' directive has been commented out. This is because in the next step we append a list of the current available mirrors to this file.

Also, beware of ACCEPT_KEYWORDS="~x86". Notice that the "~" before the architecture actually means that you're going to install your new system in the testing/unstable branch. If you want to remain in the stable branch, remove that character.

Configured for Pentium 4 Processors

For the Pentium 4 processor, the following make.conf settings work nicely. The P4 in my notebook has hyperthreading, which makes the kernel see 2 CPUs, hence the increased "jX" number in MAKEOPTS.

CFLAGS="-march=pentium4 -O3 -pipe -fomit-frame-pointer"

Selecting Fast Mirrors

Note: Some people find that doing this will add junk to their make.conf. Perhaps it's better just to get rid of the >> /mnt/gentoo/etc/make.conf and add the results manually.
# mirrorselect -s4 -o -D  >> /mnt/gentoo/etc/make.conf

First -s4 says the number of mirrors to use. Change the 4 to something else if you want to have a diffrent number of mirrors. The -o is just so we can get output redirected and not written directlly to /etc/make.conf (which we don't want). The -D is for deep mode this means that mirrorselect will download about 100k from each mirror to get a better idea of thier speed. So if you have slow connection definitlly remove this.

Removed -a, mirrorselect uses -a by default

Mounting /proc

Before chrooting you must mount procfs from the running livecd into the hard drive's newly extracted filesystem for stuff to operate properly while chrooted

# mount -t proc proc /mnt/gentoo/proc

Optional - Mounting /dev Into the extracted Stage

/dev on the livecd should be mounted into the chroot also as you may experience some difficulties setting up grub if your using a promise or other offboard ide card

# mount -o bind /dev /mnt/gentoo/dev

Installing the Gentoo Base System

Copying the dns server address file into the base stage

resolv.conf is the primary file resposible for advising a linux system which dns servers should be used for address resolving. This file is dynamically updated by dhcp when the livecd starts but doesnot exist by default in the base system stage. We must copy /etc/resolv.conf to provide for the dns resolver configuration.

# cp /etc/resolv.conf /mnt/gentoo/etc/resolv.conf


Chroot is defined in the manpage as " chroot - run command or interactive shell with special root directory"

"chroot" is short for "change root". After preparing the base system stage we need to change to the "new root" in the base stage.

# chroot /mnt/gentoo /bin/bash

>> note: to leave the Gentoo base system chroot at any time type 'exit' once.

Rehashing the $path environment

# env-update && source /etc/profile

Getting the Portage Tree

# emerge --sync

or download a portage snapshot and extract :: jud

When doing emerge --sync you may find you recieve the following.

!!! Invalid token (not "=") file
!!! ParseError: Invalid token (not '='): //etc/make.conf: line 397 in //etc/make.conf
!!! Incorrect multiline literals can cause this. Do not use them.

you may find an extra line in make.conf that you do not want there, this is what is breaking it.

nano /etc/make.conf

Scroll down to the bottom of the file and you will see

xpm xprint xrandr xscreensaver xsl xvid xvmc yahoo yaz yp yv12 zaptel \
zeo zvbi"
Binary file (standard input) matches

Comment out or delete the line

Binary file (standard input) matches

Save and retry

if you get:

>>> Updating Portage cache:
Traceback (most recent call last):
 File "/usr/bin/emerge", line 3004, in ?
   conf = portage.config(config_profile_path=portage.settings.profile_path[:], \
TypeError: unsubscriptable object

then run again

emerge --sync

Update Portage

After emerge --sync, you will likely see that there is an update for portage. It is recommended that you update portage before doing anything else.

emerge portage

NOTE: if you receive "Can't locate ExtUtils/MakeMaker/" while emerging portage dependency "dev-perl/Locale-gettext-1.05" you'll need to "emerge --nodeps gdbm libperl perl" now.

Selecting a Locale

# nano -w /etc/locale.gen

en_US ISO-8859-1
en_US.UTF-8 UTF-8

Important quote from the official Gentoo Installation Handbook about setting up locales: This will not work for the bootstrapping, but when you recompile glibc afterwards it will.

Check and Change the Profile

Make sure make.profile points to the right directory, before you emerge linux-headers and bootstrap your system. The profile determines what system the bootstrap is going to make. This link isn't always correct, especially if you're using an old stage 1.

Note: If you just updated portage from an old version, you may have to do another emerge --sync to download the latest profiles.
ls -FFg /etc/make.profile
lrwxrwxrwx 1 root 46 2007-03-20 17:34 /etc/make.profile -> /usr/portage/profiles/default-linux/x86/no-nptl/

If you see no-nptl as the link, fix it.

unlink /etc/make.profile
ln -s /usr/portage/profiles/default-linux/x86/2007.0 /etc/make.profile

Bootstrapping the System, Emerging System, Setting Runlevels

env-update && source /etc/profile && emerge --oneshot --nodeps gcc-config && USE="-* build bootstrap" emerge linux-headers && emerge --nodeps gdbm libperl perl && \

Finish with the Bootstrap Process

emerge -O libperl && emerge -O python && emerge shadow && emerge --deep system && \
emerge syslog-ng grub hotplug vixie-cron reiserfsprogs reiser4progs sysfsutils udev dhcpcd && \
USE="openntpd" emerge --nodeps acpid ntp && rc-update add syslog-ng default && rc-update add net.eth0 default && rc-update add vixie-cron default && \
rc-update add xinetd default && rc-update add sshd default && rc-update add hotplug default && \
rc-update add acpid default

Make sure to replace reiserfsprogs with jfsutils or xfsprogs if you plan to use those filesystem types User:Rukie

Make sure to emerge eselect and eselect-compiler after emerging of gcc-config (so emerge python will not break) NonWikiUser:Memoreyx

Gentoo 2006.1 doesn't need the eselect-compiler (masked) but eselect was necessary. User:Heywood

If you get "error while loading shared libraries: cannot open shared object file: No such file or directory" during kbd emerge, try: User:ventura10

emerge expat
ln -s /usr/lib/ /usr/lib/

expat is now updated, you should probably create the symlink against version 1.5.2 User:Meliorator

ln -fs /usr/lib/ /usr/lib/

I think the correct thing to do is to simply relink anything that depended on old expat against the new expat, in my case it was only the /usb/bin/xgettext executable and the following command fixed it (don't forget to clean /var/tmp/portage work directories if you have "noauto noclean" in FEATURES):

emerge gettext

libperl is a metaname for perl during the base system installation. I added it redundantly to the base installation to satisfy emerge halting after the first emerge libperl which also would halt the base system install with various perl dependency issues -ali3nx

When I was doing the bootstrapping on an amd64 I discovered that libperl would not emerge properly even by entering it twice. To solve this I did this, and it appears to be working fine.

 emerge --nodeps libperl 

libperl is a part of the system build and doesn't appear to need to be emerged on its own. I have removed emerge libperl; emerge libperl && from in front of the emerge -e system. Let us know if this presents any problems. - User:GoldenEternity

*** note that if you've changed the CFLAGS at all, then the above command will fail during the "emerge --emptytree system", specifically when emerging "python-fchksum" (see this forum post). In order to fix this, ensure that you "emerge python" before the "emerge --emptytree system" - User:Nobbie

***Note: If emerge -O python fails with an error pertaining to the C Compiler, you must run emerge gcc-config; gcc-config -l; gcc-config X where X is equal to the most recent version of gcc (currently 4.1.1, my X was 6). Then continue with emerge python and so on. User:Rukie ***If this still fails, check if gcc-config is already emerged and follow the instructions above.

If the man pages of glibc can't be installed after its compilation, try the following: echo ">=sys-libs/glibc-" >> /etc/portage/package.mask

If you are not using 2005.0 or later Linux Kernel 2.6, then change linux-headers to linux26-headers if you are using the 2.6 kernel. This is because kernel 2.6 was not the standard kernel.

There seems to be issues with the lastest problems of portage and --emptytree, changed to --deep to fix problem --qnetjoe

The latest 2006.1 (and maybe earlier) have a broken stage1. This can be fixed by (before doing the command list above) executing the following command: emerge --nodeps gdbm libperl perl Emerge should then just run as normal --Sariel Amraphel

Added "emerge shadow" to above. It's a required dependency of net-nds/openldap-2.3.27-r2 which is a dependency in "emerge --deep system". - Dirk R. Gently

Eliminating Clock Skew

There's just not enough time in a day... and it's a little known fact that a computer has two clocks. One is a hardware clock and the second is a software clock that runs in the os. They however do not stay in sync which creates a condition known as clock skew that can cause havok with source build operating systems such as gentoo linux. Clock skew can cause source compiles to fail. We allieviate this problem by adding a network time protocol client into the installation.

# rc-update add ntp-client default
# ntpdate -u -b

Setting the System's Timezone Symlink

List the timezone files in the system and find the timezone that closest matches your location on our big blue ball in the dark universe. Keep in mind they will not be added until after bootstrap or until after glibc compiles.

Code: Output of ls /usr/share/zoneinfo/
Africa      Atlantic   Canada  EST5EDT  Factory  GMT-0      Iceland  Japan      MST7MDT  Navajo   Portugal   Turkey     W-SU         posixrules
America     Australia  Chile   Egypt    GB       GMT0       Indian   Kwajalein  Mexico   PRC      ROC        UCT        WET          right
Antarctica  Brazil     Cuba    Eire     GB-Eire  Greenwich  Iran     Libya      Mideast  PST8PDT  ROK        US         Zulu
Arctic      CET        EET     Etc      GMT      HST        Israel   MET        NZ       Pacific  Singapore  UTC
Asia        CST6CDT    EST     Europe   GMT+0    Hongkong   Jamaica  MST        NZ-CHAT  Poland   SystemV    Universal  posix

Now you must remove the default timezone symlink and create a new one which is linked to the timezone info file that matches your timezone. I'm currently in Pacific Standard Time (Vancouver, Canada) so i chose /usr/share/zoneinfo/America/Vancouver as my timezone file. Note that locating the closest city in your timezone will help your system automatically adjust for daylight savings time changes appropriately. Replace /usr/share/zoneinfo/{path/to/your/timezonefile} in the code example below with the correct and appropriate timezone file for your location.

# rm /etc/localtime
# ln -s /usr/share/zoneinfo/{path/to/your/timezonefile} /etc/localtime

Configuring the Kernel

Configuring the Kernel - With udev and Fbsplash!!!

This section is unnessary if you are using an amd64 as udev is the default and devfs is not included.

Since devfs is being deprecated soon you should be prepared to switch to udev when you're required. Hotplug and sysfsprogs are a must for udev. udev runs so much better for desktop environments than devfsd so i've decided to take you all under the knife. It's very simple to setup. Add Hotplug firmware loading in your kernel config, remove devfs filesystem support, emerge udev sysfsutils and make two changes to /etc/conf.d/rc that restrict devfsd from starting on boot and another that makes the rc system not extract the /dev tarball that is initially nonexistant on boot. My kernel config has all the needed changes premade to utilize udev appropriately. Here's a cutout from /etc/conf.d/rc with the needed changes made. Edit them in nano on your system and save the config file.

File: /etc/conf.d/rc
# **********************************************************************
# Edited 1st Jan, 2005 - bsodmike
# **********************************************************************


# Use this variable to control the /dev management behavior.
#  auto   - let the scripts figure out what's best at boot
#  devfs  - use devfs (requires sys-fs/devfsd)
#  udev   - use udev (requires sys-fs/udev)
#  static - let the user manage static nodes


# Set to "yes" if you want to save /dev to a tarball on shutdown
# and restore it on startup.  This is useful if you have a lot of
# custom device nodes that udev does not handle/know about.
# (ONLY used by UDEV enabled systems!)


lspci && lsmod (copy the output to a txt file that you can use for reference then use my base kernel .config and modify to your requirements. Genkernel will get you up and going but your system will not run as efficiently as it could.

(Small note: lspci is part of pciutils, so use "emerge pciutils" if you don't have it.)

This is what I see when I run lspci

pcilib: Cannot open /sys/bus/pci/devices
0000:00:00.0 Host bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333]
0000:00:01.0 PCI bridge: VIA Technologies, Inc. VT8366/A/7 [Apollo KT266/A/333 AGP]
0000:00:06.0 Ethernet controller: Linksys NC100 Network Everywhere Fast Ethernet 10/100 (rev 11)
0000:00:10.0 USB Controller: VIA Technologies, Inc. VT82xxxxx UHCI USB 1.1 Controller (rev 80)
0000:00:10.3 USB Controller: VIA Technologies, Inc. USB 2.0 (rev 82)
0000:00:11.0 ISA bridge: VIA Technologies, Inc. VT8235 ISA Bridge
0000:00:11.1 IDE interface: VIA Technologies, Inc. VT82C586A/B/VT82C686/A/B/VT823x/A/C PIPC Bus Master IDE (rev 06)
0000:00:11.5 Multimedia audio controller: VIA Technologies, Inc. VT8233/A/8235/8237 AC97 Audio Controller (rev 50)
0000:01:00.0 VGA compatible controller: nVidia Corporation NV34 [GeForce FX 5200] (rev a1)

and lsmod

Module                  Size  Used by
ipv6                  182560  10
evdev                   6464  0
tulip                  36000  0
crc32                   3040  1 tulip
parport_pc             27072  0
parport                22728  1 parport_pc
sbp2                   16744  0
ohci1394               24836  0
ieee1394               62008  2 sbp2,ohci1394
ohci_hcd               15044  0
uhci_hcd               23152  0
usb_storage            46208  0
ehci_hcd               21028  0
Note: When I tried to do the above cd /usr/src/linux I find the directory does not exist. CDROM and HDD where both missing source code, I used the minimal install cd.

To overcome this

# emerge gentoo-sources

or whatever kernel you want then To get the kernel config skel file do the following

# cd /usr/src/linux && wget && \
  mv kernel-bsodmike.config .config && \
  make oldconfig && \
  make menuconfig

Welcome to the linux kernel configuration menu. Here you must change a few items for your configuration if
your using my kernel config. My config is sutable for most systems however it's built to run on my system.

Specifically you must change the following items to suit your configuration.
# Processor type and features - mainly be concerned with your cpu type here
# ATA/ATAPI/MFM/RLL support for storage controllers
# Networking support - NIC Device drivers are your main concern Use Modules =]
# Character devices - agpgart and agp chipset type, dri driver ( if required)
  Note that if your using an nvidia videocard it's best to leave the character devices as-is
# Sound support ~>> Advanced Linux Sound Architecture ~~> Pci devices
  Set the correct driver module for your soundcard here.
  Use a module as the alsa-utils package demands that at least one module be present for your system to use
  the startup script correctly
# USB support - Three primary items to be concerned with here...
  If you have usb2  add the EHCI module as <m>
  The output recieved from lspci is important here as you cannot have both ohci AND uhci included.
  You much choose one or the other and add it as a module
#* EHCI HCD (USB 2.0) support
#* OHCI HCD support
#* UHCI HCD (most Intel and VIA) support

After configuring your kernel for supported devices exit from menuconfig and type the following

# make && make modules modules_install install

The command above will compile the kernel image, compile the kernel modules, install the modules and install the kernel in /boot creating symlinks for easier kernel upgrade management.

Note: Also, the stable source does not come ready for Fbsplash so you must use dev kernel or patch it (have not tried). - tikka

Installing Separate Kernel Modules

I always build tons of modules wherever possible unless doing so is not advisable. A dynamically loading system will save valuable memory address space in your system kernel. lsmod is your eyes into a running modular linux system but it's only usable with modules. NIC modules are an excellent example. Adding them to insmod at boot is required as hotplug doesn't load nic drivers dynamically possibly leaving you with a booted system without network.

Here is a list of kernel-related ebuilds that you could emerge:

Beware though, some of these ebuilds might deal with big dependencies. To verify what packages will be installed by emerging an ebuild, use emerge --pretend. For instance, for the nvidia-kernel package:

# emerge --pretend nvidia-kernel

You should list the modules you want automatically loaded in /etc/modules.autoload.d/kernel-2.6. You can add extra options to the modules too if you want.

To view all available modules, run the following find command. Don't forget to substitute "<kernel version>" with the version of the kernel you just compiled:

# find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko'

Of the huge list this gave these are the modules I were interested in


The tulip driver is for my Linksys network card and supports many of the 100BaseTX cards out there.

Now lets edit /etc/modules.autoload.d/kernel-2.6 as shown below

# /etc/modules.autoload.d/kernel-2.6:  kernel modules to load when system boots.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/modules.autoload.d/kernel-2.6,v 1.1 2003/07/16 18:1$#
# Note that this file is for 2.6 kernels.
# Add the names of modules that you'd like to load when the system
# starts into this file, one per line.  Comments begin with # and
# are ignored.  Read man modules.autoload for additional details.

# For example:
# 3c59x

Now run update-modules to commit your changes to the /etc/modules.conf file:

Configuring Your System

Setting Up Hostnames and Domain Names

On older versions, it is sufficient to do:

echo gentoo1 > /etc/hostname
echo > /etc/dnsdomainname
rc-update add domainname default

However, newer versions require that you set variables in the hostname and domainname files. Edit the HOSTNAME, DNSDOMAIN and NISDOMAIN variables in these files. Then run rc-update add domainname default

File: /etc/conf.d/hostname
# /etc/conf.d/hostname

# Set to the hostname of this machine

File: /etc/conf.d/domainname
# /etc/conf.d/domainname

# When setting up resolv.conf, what should take precedence?
# If you wish to always override DHCP/whatever, set this to 1.

# To have a proper FQDN, you need to setup /etc/hosts and /etc/resolv.conf
# properly (domain entry in /etc/resolv.conf, and FQDN in /etc/hosts).

# This only set what /bin/hostname returns.  If you need to setup NIS, meaning
# what /bin/domainname returns, please see:

Next you must edit /etc/hosts to allow Linux to set your hostnames while no nameservers are reachable. IPv6 will be here in the next few years, so don't get too cozy: IPv4 will be deprecated and you will be assimilated. Here's an example of what /etc/hosts should contain:

# **********************************************************************
# /etc/hosts - Edited 1nd Jan, 2005 - bsodmike
# **********************************************************************

# /etc/hosts: This file describes a number of hostname-to-address
# mappings for the TCP/IP subsystem. It is mostly
# used at boot time, when no name servers are running.
# On small systems, this file can be used instead of a
# "named" name server. Just add the names, addresses
# and any aliases to this file...
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/hosts,v 1.7 2002/11/18 19:39:22 azarah Exp $
# gentoo1.kicksass-net gentoo1 localhost.localdomain localhost

# IPV6 versions of localhost and co
::1 ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts

Configuring a Second Network Card

Perform the following for your second card

cd /etc/init.d
ln -s net.lo net.eth1
rc-update add net.eth1 default

Setting up the network config file for first reboot

Configuring DHCP

Gentoo Linux no longer defaults to installing dhcpcd as a system package so I've added it to the oneliner as an extra package. Since most users have the simplicity of a dhcp network you merely need to uncomment two variables in /etc/conf.d/net, iface_eth0 and dhcpcd_eth0, in the dhcp section about half way through the file.

File: /etc/conf.d/net
# **********************************************************************
# /etc/conf.d/net - Edited 1st Jan, 2005 - bsodmike
# **********************************************************************

# /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=" broadcast netmask"
#iface_eth1=" broadcast netmask"

# For DHCP set iface_eth? to "dhcp"
# For passing options to dhcpcd use dhcpcd_eth?
dhcpcd_eth0="-t 10"

# For adding aliases to a interface

# 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.

# For setting the default gateway
# gateway="eth0/"

Static IP setup

For a static configuration notice the changes made below, namely the commented-out iface_eth0 and dhcpcd_eth0 and the un-commented gateway:

File: /etc/conf.d/net
# **********************************************************************
# /etc/conf.d/net - Edited 1st Jan, 2005 - bsodmike
# **********************************************************************

# /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=" broadcast netmask"
#iface_eth1=" broadcast netmask"

# For DHCP set iface_eth? to "dhcp"
# For passing options to dhcpcd use dhcpcd_eth?
#dhcpcd_eth0="-t 10"

# For adding aliases to a interface

# 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.

# For setting the default gateway

Configuring Grub & fstab - Now with Fbsplash and grub skins!!

There's nothing cooler than spock ;) well or spock the gentoo developer's tizzight Fbsplash on the system you've managed to build by following this tutorial Cool so like that bitchin splash image on the livecd? hehe so do i... and why horde it to myslef and cackle and laugh alone looking at my computer boot gentoo linux for fun and kix. So here it is folks. More creature features courtesy of ali3nx

Adding Fbsplash

emerge splashutils && emerge splash-themes-gentoo && \
splash_geninitramfs -v -g /boot/fbsplash-emergence-1024x768 -r 1024x768 emergence && \
rc-update add splash default

The magic is done... Now you have an initrd that you must load with grub in menu.lst

Note: splashutils will not compile correctly if freetype libs have not been installed. If, like me, you removed many of the USE flags during bootstrap (in order to fix emerge issues), you need to first emerge freetype and then emerge splashutils.

Installing the Bootsectors

Make sure you have an mtab file for grub won't install correctly:

grep -v rootfs /proc/mounts > /etc/mtab


grub> root (hd0,0)
grub> setup (hd0)
grub> quit

Editing /boot/grub/menu.lst

Perform the following:

# cd /boot/grub
# nano -w /boot/grub/menu.lst

Edit the menu.lst file (this is really a symlink) as follows

File: /boot/grub/grub.conf
# **********************************************************************
# /boot/grub/grub.conf - Edited 2nd Jan, 2005 - bsodmike
# **********************************************************************
# Grub boot menu configuration file
# Boot automatically after 30 secs.
timeout 30

# By default, boot the first entry.
default 0

# Fallback to the second entry.
fallback 1


# For booting GNU/Linux

title  Gentoo-2.6.9-gentoo-r13
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-32@85 splash=verbose,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1024x768
# note make certain the kernel line does not wrap to the next line!!!!

title Gentoo-2.6.9-gentoo-r13-backup
root (hd0,0)
kernel (hd0,0)/vmlinuz.old ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1024x768-32@85 splash=verbose,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1024x768
# note make certain the kernel line does not wrap to the next line!!!!

Changing The Resolution Later On

Now you have setup Gentoo but want this to be at 1280x1024...what do you do?

Enter the following

# splash_geninitramfs -v -g /boot/fbsplash-emergence-1280x1024 -r 1280x1024 emergence

And you should get the following output

o Creating directory structure..
o Copying /sbin/splash_helper..
o Copying themes..
  - emergence
o Creating initramfs image..

Now edit /boot/grub/menu.lst as follows and either add the following block as 'another' boot-up alternative or simply edit the current entry

File: /boot/grub/menu.lst
title  Gentoo-2.6.9-gentoo-r13
root (hd0,0)
kernel (hd0,0)/vmlinuz ro root=/dev/hda3 video=vesafb:ywrap,pmipal,1280x1024-32@75 splash=verbose,theme:emergence
initrd (hd0,0)/fbsplash-emergence-1280x1024
# note make certain the kernel line does not wrap to the next line!!!!
Note: As the resolution goes up the refresh rate should drop, 70 - 75 is a safe maximum for this resolution. Proceed with caution if you try any higher!

Installing a Custom Gentoo Labelled Grub Skin

I recently found a pimp grub splash themed just for gentoo linux that everyone and there momma's momma needs for gentoo boxen =] Thanks to schultz for making these fine examples of grub splash themes. Artistic credit due to the artisit here so we use the originating url.

# cd /boot/grub && wget

Setting Up fstab

Tis is a step you do not want to do before installing grub... for some reason grub has a spaz attack and calls die() when it finds an fstab in completed fashion.

# nano -w /etc/fstab

Here's mine:

File: /etc/fstab
# **********************************************************************
# /etc/fstab - Edited 1st Jan, 2005 - bsodmike
# **********************************************************************

# /etc/fstab: static file system information.
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/fstab,v 1.14 2003/10/13 20:03:38 azarah Exp $
# noatime turns off atimes for increased performance (atimes normally aren't
# needed; notail increases performance of ReiserFS (at the expense of storage
# efficiency).  It's safe to drop the noatime options if you want and to
# switch between notail and tail freely.

# <fs>                  <mountpoint>    <type>          <opts>                 <dump/pass>

# NOTE: If your BOOT partition is ReiserFS, add the notail option to opts.
/dev/hda1               /boot           ext3            noauto,noatime         1 1
/dev/hda2               none            swap            sw                     0 0
/dev/hda3               /               xfs             noatime                1 1
/dev/hda5               /opt            ext3            defaults               0 1
/dev/hda6               /home           ext3            defaults               0 1
/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro,user,exec    0 0
#/dev/fd0               /mnt/floppy     auto            noauto                 0 0

# NOTE: The next line is critical for boot!
none                    /proc           proc            defaults               0 0

# glibc 2.2 and above expects tmpfs to be mounted at /dev/shm for
# POSIX shared memory (shm_open, shm_unlink).
# (tmpfs is a dynamically expandable/shrinkable ramdisk, and will
#  use almost no memory if not populated with files)
# Adding the following line to /etc/fstab should take care of this:

none                    /dev/shm        tmpfs           defaults               0 0

Notice how I tell the system about hda5 and hda6 here. When you boot for the first time you will get an error saying that '/opt' does not exist. This is because you need to do the following:

# mkdir /opt

user,exec mount opts on cdrom devices allows users to mount cdroms without sudo or su privleges. Covered in the documentation for cedega by transgaming.

Tweaking Device Access Parameters

We've gone throught he procedures above for utilizing hdparm for obtaining the fastest i/o transfer modes for your hard drive however the changes made only affect the livecd's running kernel therefore we should setup hdparm for the installation that you have created so that performance is maintained after booting into your running system. Allot of very useful options for Gentoo Linux dwell in /etc/conf.d This time we are to be concerned with the contents of /etc/conf.d/hdparm Below you will see an example of hdparm's config file. Change to suit the layout of your disks for your system appropriately. Each device may need the modes set for your systems hardware configuration. Here's a typical configuration for a system with one cdrom and hard disk. You can safely skip this step if using sata or scsi.

# Copyright 1999-2004 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sys-apps/hdparm/files/hdparm-conf.d.3,v 1.2 2004/09/06 02:17:08 swegener Exp $

# You can either set hdparm arguments for each drive using hdX_args,
# discX_args, cdromX_args and genericX_args, e.g.


# disc1_args="-d1"


# or, you can set hdparm options for ALL drives using all_args, e.g.

After editing the contents of /etc/conf.d/hdparm type the following command to add hdparm to the boot runlevel

# rc-update add hdparm boot

System Information

Set Up Users & Set a Root Password

We must change the password of the root user in the installed system to ensure it's usable after booting the system and also add a user for yourself with the appropriate groups that would be required for an average desktop-server hybrid gentoo linux system. Substitute my nick with your own username or add me a shell and pm me the login should you feel generous ;)

passwd to change root's pass
useradd <yourname> -m -k /etc/skel -g users -G audio,cron,wheel,portage,games -d /home/<yourname> -s /bin/bash
passwd <yourname>

System Information

Gentoo uses /etc/rc.conf for general, system-wide configuration.

This file has quite a few options that should be looked at and will need to be edited if you want to be able to have gnome (or some windowmanager) load up at boot. Of course you'll need to emerge gnome before your next reboot.

Open up /etc/rc.conf and configure it as follows to load up gnome at next boot

File: /etc/rc.conf
# /etc/rc.conf: Global startup script configuration settings
# $Header: /home/cvsroot/gentoo-src/rc-scripts/etc/rc.conf,v 1.22 2003/10/21 06:09:42 vapier Exp $

# Use KEYMAP to specify the default console keymap.  There is a complete tree
# of keymaps in /usr/share/keymaps to choose from.  This setting is used by the
# /etc/init.d/keymaps script.


# Should we first load the 'windowkeys' console keymap?  Most x86 users will
# say "yes" here.  Note that non-x86 users should leave it as "no".


# The maps to load for extended keyboards.  Most users will leave this as is.

#EXTENDED_KEYMAPS="backspace keypad"

# CONSOLEFONT specifies the default font that you'd like Linux to use on the
# console.  You can find a good selection of fonts in /usr/share/consolefonts;
# you shouldn't specify the trailing ".psf.gz", just the font name below.
# To use the default console font, comment out the CONSOLEFONT setting below.
# This setting is used by the /etc/init.d/consolefont script (NOTE: if you do
# not want to use it, run "rc-update del consolefont" as root).


# CONSOLETRANSALTION is the charset map file to use.  Leave commented to use
# the default one.  Have a look in /usr/share/consoletrans for a selection of
# map files you can use.


# Set CLOCK to "UTC" if your system clock is set to UTC (also known as
# Greenwich Mean Time).  If your clock is set to the local time, then set CLOCK
# to "local".  This setting is used by the /etc/init.d/clock script.


# Set EDITOR to your preferred editor.


# Set PROTOCOLS to the protocols that you plan to use.  Gentoo Linux will only
# enable module auto-loading for these protocols, eliminating annoying module
# not found errors.
# NOTE: Do NOT uncomment the next lines, but add them to 'PROTOCOLS=...' line!!
# Num   Protocol
# 1:    Unix
# 2:    IPv4
# 3:    Amateur Radio AX.25
# 4:    IPX
# 5:    DDP / appletalk
# 6:    Amateur Radio NET/ROM
# 9:    X.25
# 10:   IPv6
# 11:   ROSE / Amateur Radio X.25 PLP
# 19:   Acorn Econet

# Most users want this:

#For IPv6 support:
#PROTOCOLS="1 2 10"

# What display manager do you use ?  [ xdm | gdm | kdm | entrance ]
# XSESSION is a new variable to control what window manager to start
# default with X if run with xdm, startx or xinit.  The default behavior
# is to look in /etc/X11/Sessions/ and run the script in matching the
# value that XSESSION is set to.  The support scripts is smart enouth to
# look in all bin directories if it cant find a match in /etc/X11/Sessions/,
# so setting it to "enligtenment" can also work.  This is basically used
# as a way for the system admin to configure a default system wide WM,
# allthough it will work if the user export XSESSION in his .bash_profile, etc.
# NOTE:  1) this behaviour is overridden when a ~/.xinitrc exists, and startx
#           is called.
#        2) even if a ~/.xsession exist, if XSESSION can be resolved, it will
#           be executed rather than ~/.xsession, else KDM breaks ...
# Defaults depending on what you install currently include:
# Gnome - will start gnome-session
# kde-<version> - will start startkde (ex: kde-3.0.2)
# Xsession - will start a terminal and a few other nice apps

As you can see, this file is well commented to help you set up the necessary configuration variables. Take special care with the KEYMAP setting: if you select the wrong KEYMAP you will get weird results when typing on your keyboard.

PPC uses x86 keymaps on most systems. Users who want to be able to use ADB keymaps on boot have to enable ADB keycode sendings in their kernel and have to set a mac/ppc keymap in rc.conf.

Exiting Chroot and Unmounting Partitions

Since we used screen during our installation we will need to exit or logout twice... once to quit screen, once to exit from chroot following with unmounting the partitions used for installation and disabling swap... A "clean" shutdown is allways a good idea...

exit && exit
cd ~/
umount /mnt/gentoo/proc
umount /mnt/gentoo/boot
umount /mnt/gentoo/dev
umount /mnt/gentoo
swapoff /dev/hda2

Rebooting to your newly installed Gentoo Linux

# shutdown -r now

Add any other applications after rebooting to the fastest linux animal you have ever built.

Troubleshooting At First Boot

If your install of Gentoo refused to boot (say a really messed up fstab for example) let's load up the livecd and proceed as follows:

First let's give the 'virtual' livecd root account a password

# passwd

and if it is easier for you to make alterations through sshd let's start it up

# /etc/init.d/sshd start

Perform the following to load back into the Gentoo jail

hdparm -d1c1u1m16 /dev/hda && swapon /dev/hda2 && mount /dev/hda3 /mnt/gentoo && mount /dev/hda1 /mnt/gentoo/boot && mount -t proc none /mnt/gentoo/proc && mount -o bind /dev /mnt/gentoo/dev && chroot /mnt/gentoo /bin/bash && env-update && source /etc/profile

You will now be in the Gentoo jail. Make any alterations as needed, and once done don't forget to unmount as follows:

# umount /mnt/gentoo/proc
# umount /mnt/gentoo/boot
# umount /mnt/gentoo/dev
# umount /mnt/gentoo
# swapoff /dev/hda2

and restart

# shutdown -r now

eth0 Down

First login as root and perform

# cd /usr/src/linux
# make menuconfig

Wait till the menu pops up and pick your relevant NIC module and install it as '<M>'

Now save and exit and do

# make && make modules modules_install

Let's hypothetically say that I just added the 'tulip' driver (The first time I installed Gentoo I really had this problem :)) do the following

# modprobe tulip

You should expect any output, which is a good sign!

If you now perform 'ifconfig' you'll see that your NIC has been detected and has got an ip via DHCP

Altering to a static IP from DHCP

Take a look at your current ip by running 'ifconfig'

eth0      Link encap:Ethernet  HWaddr 00:0C:41:20:41:42
          inet addr:  Bcast:  Mask:
          RX packets:969 errors:0 dropped:0 overruns:0 frame:0
          TX packets:608 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:97082 (94.8 Kb)  TX bytes:76676 (74.8 Kb)
          Interrupt:169 Base address:0xec00

Now edit /etc/conf.d/net according to the insructions here.

We need to restart the 'eth0' interface and we achieve this by performing

# /etc/init.d/net.interface {re}start

which in our case is

# /etc/init.d/net.eth0 restart

and we can take a look at the changes by running 'ifconfig' again

eth0      Link encap:Ethernet  HWaddr 00:0C:41:20:41:42
          inet addr:  Bcast:  Mask:
          inet6 addr: fe80::20c:41ff:fe20:4142/64 Scope:Link
          RX packets:1230 errors:0 dropped:0 overruns:0 frame:0
          TX packets:764 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:122609 (119.7 Kb)  TX bytes:96767 (94.4 Kb)
          Interrupt:169 Base address:0xec00

Error: fsck.xfs Not Found

Simply install xfsprogs by running

# emerge xfsprogs

Forcing Numlock 'On' At boot

Simply do

# rc-update add numlock default

Installing Necessary System Tools

File Indexing

If you want to index your system's files so you are able to quickly locate them using the locate tool, you need to install sys-apps/slocate.

# emerge slocate

When running emerge slocate, the following error now displays:

 * The 'slocate' group has been renamed to 'locate'.
 * You seem to already have a 'slocate' group.
 * Please rename it:
 * groupmod -n locate slocate

 !!! ERROR: sys-apps/slocate-2.7-r8 failed.
 !!! Function pkg_setup, Line 28, Exitcode 0
 !!! Change 'slocate' to 'locate'
 !!! If you need support, post the topmost build error, NOT this status message.

As stated, the solution is to instead run.

groupmod -n locate slocate

File System Tools

Depending on what file systems you are using, you need to install the necessary file system utilities (for checking the filesystem integrity, creating additional file systems etc.).

The following table lists the tools you need to install if you use a certain file system:


Been hunting high and low for /etc/sudoers? Easy fix

# emerge app-admin/sudo

This adds the following support

*  app-admin/sudo
      Latest version available: 1.6.7_p5-r2
      Latest version installed: [ Not Installed ]
      Size of downloaded files: 341 kB
      Description: Allows certain users/groups to run commands as root
      License:     Sudo

Logging Tools

We need to first emerge a few things

# emerge logwatch logrotate

Now perform the following

# nano /etc/cron/cron.daily/logwatch.cron

And to this empty file we add

#! /bin/sh


Localmail System

We need to grab postfix

# emerge postfix

Now edit /etc/postfix/

alias_database = hash:/etc/mail/aliases
alias_maps = hash:/etc/mail/aliases
command_directory = /usr/sbin
config_directory = /etc/postfix
daemon_directory = /usr/lib/postfix
debug_peer_level = 2
default_destination_concurrency_limit = 2
home_mailbox = .maildir/
html_directory = no
inet_interfaces = all
local_destination_concurrency_limit = 2
mail_owner = postfix
mail_spool_directory = /var/spool/mail
mailq_path = /usr/bin/mailq
manpage_directory = /usr/share/man
mydestination = $myhostname, localhost.$mydomain, $mydomain
mydomain =
myhostname =
mynetworks =,
mynetworks_style = subnet
myorigin = $myhostname
newaliases_path = /usr/bin/newaliases
queue_directory = /var/spool/postfix
readme_directory = /usr/share/doc/postfix-2.1.5-r1/readme
sample_directory = /etc/postfix
sendmail_path = /usr/sbin/sendmail
setgid_group = postdrop
unknown_local_recipient_reject_code = 450

Your file should be similar but what you need to take care in editing are the mydomain, myhostname and mynetworks parameters.

Let's edit the /etc/mail/aliases file

# Basic system aliases -- these MUST be present.
MAILER-DAEMON:      postmaster
postmaster:         root

# General redirections for pseudo accounts.
adm:                root
bin:                root
daemon:             root
exim:               root
lp:                 root
mail:               root
named:              root
nobody:             root
postfix:            root

# Well-known aliases -- these should be filled in!

# Standard RFC2142 aliases
abuse:              postmaster
ftp:                root
hostmaster:         root
news:               usenet
noc:                root
security:           root
usenet:             root
uucp:               root
webmaster:          root
www:                webmaster

# trap decode to catch security attacks
# decode:           /dev/null

You can either specify your 'user' account name or your email address to get all notifications sent to root to be forwarded to you.

Next step is to update the alias db

# newaliases

We now start and add postfix to autoload

# /etc/init.d/postfix start
* Starting postfix...                                                                [ ok ]
# rc-update add postfix default

With localmail setup, you will now get nicely formatted email from logwatch sent to you :)

Setting Up Crontab

This is a nice template to use when editing your crontab.

Create /etc/crontab.cron and copy the following into it

# /etc/crontab.cron

# All mail from cron is sent to root

#       minute (0-59),
#       |       hour (0-23),
#       |       |       day of the month (1-31),
#       |       |       |       month of the year (1-12),
#       |       |       |       |       day of the week (0-6 with 0=Sunday).
#       |       |       |       |       |       commands
# ------{ daily cron jobs }------------ #
        0       10      *       *       *       /usr/sbin/
        0       8       *       *       *       updatedb
        0       4       *       *       0       /usr/bin/emerge -uD world
        0       0       *       *       0       /usr/bin/emerge --sync
        0       18      *       *       *       /usr/sbin/logrotate --verbose /etc/logrotate.conf

Once you have adjusted it for your needs let's actually add it.

# crontab crontab.cron     (here I had to do '#crontab /etc/crontab.cron' for it to work)

Now let's check and see if it's right

# crontab -l

This should list it :)

Setup localmailing and you'll get notification from cron and relevant errors :)

Networking Tools

Optional: Installing a PPPoE Client

If you need rp-pppoe to connect to the net, you need to install it.

# USE="-X" emerge rp-pppoe

The USE="-X" will prohibit xorg-x11 to be installed as a dependency (rp-pppoe has graphical tools; if you want those enabled, you can recompile rp-pppoe later on or have xorg-x11 installed now -- which takes a long time to compile).

Configuring Xorg - Gnome, Xfce4, KDE and Fluxbox

Configuring Xorg

Perform the following once

# opengl-update {nvidia|ati}

Now to create the config file

# xorgconfig

This will ask you a multitude of questions. The hardest would be about your mouse and the path should be defined as /dev/input/mice.

Now let's configure the file by hand to make sure everything is fine by editing /etc/X11/xorg.conf

Custom nVidia Compatible Configuration

# **********************************************************************
# /etc/X11/xorg.conf - configured 2nd Jan, 2005 - bsodmike
# **********************************************************************

Section "ServerLayout"
    Identifier	" Configured"
    Screen 	"Screen0"
    InputDevice "Mouse0" "CorePointer"
    InputDevice "Keyboard0" "CoreKeyboard"

Section "Module"
    Load  	"extmod"
    Load  	"dbe"
    Load 	"record"
    Load 	"xtrap"
    Load 	"glx"
    Load 	"type1"
    Load 	"freetype"

Section "Files"
    RgbPath     "/usr/X11R6/lib/X11/rgb"
    FontPath    "/usr/share/fonts/misc/"
    FontPath    "/usr/share/fonts/TTF/"
    FontPath    "/usr/share/fonts/Type1/"
    FontPath    "/usr/share/fonts/CID/"
    FontPath    "/usr/share/fonts/75dpi/"
    FontPath    "/usr/share/fonts/100dpi/"
    FontPath    "/usr/share/fonts/local/"

Section "InputDevice"
    Identifier  "Keyboard0"
    Driver      "kbd"
    Option "AutoRepeat" "500 30"
    Option "XkbRules"   "xorg"
    Option "XkbModel"   "pc104"
    Option "XkbLayout"  "us"

Section "InputDevice"
    Identifier  "Mouse0"
    Driver      "mouse"
    Option "Protocol"    "IMPS/2"
    Option "Device"      "/dev/input/mice"
    Option "ZAxisMapping"       "4 5"

Section "Monitor"
    Identifier  "Monitor0"
    VendorName   "Samsung"
    ModelName    "SyncMaster 173T"
    HorizSync   31.5 - 79.0
    VertRefresh 50-100

Section "Device"
    Option "RenderAccel"   "yes"
    Option "AllowGLXWithComposite" "yes"
    Option "RENDER" " True"
    Option "NvAGP" "1"
    Option "NoLogo" "1"

    Identifier  "Card0"
    Driver      "nvidia"
    VendorName  "MSI"
    BoardName   "nVidia GeForce FX5200 "

Section "Screen"
    Identifier  "Screen0"
    Device      "Card0"
    Monitor     "Monitor0"
    DefaultDepth 24
    Subsection "Display"
        Depth       24
        Modes       "1280x1024"
        ViewPort    0 0

Section "Extensions"
    Option "Composite" "Enable"
    Option "RENDER"     "True"

Custom ATi Compatible Configuration

# Added by burnstone, Jan 21 2005  #
# ATI-Compatible Xorg-6.8.0-Config #
# Attention: This needs fglrx!     #

Section "dri"
   Mode 0666
Section "Module"
   Load        "dbe"   # Double buffer extension
   SubSection  "extmod"
     Option    "omit xfree86-dga"   # don't initialise the DGA extension
   Load        "type1"
   Load        "freetype"
   Load        "glx"   # libglx.a
   Load        "dri"   # libdri.a

Section "Files"
   RgbPath     "/usr/X11R6/lib/X11/rgb"
   FontPath   "/usr/share/fonts/local/"
   FontPath   "/usr/share/fonts/misc/"
   FontPath   "/usr/share/fonts/75dpi/:unscaled"
   FontPath   "/usr/share/fonts/100dpi/:unscaled"
   FontPath   "/usr/share/fonts/Type1/"
   FontPath   "/usr/share/fonts/Speedo/"
   FontPath   "/usr/share/fonts/75dpi/"
   FontPath   "/usr/share/fonts/100dpi/"

Section "InputDevice"
   Identifier  "Keyboard1"
   Driver      "kbd"
   Option "AutoRepeat" "500 30"
   Option "XkbRules"   "xfree86"
   Option "XkbModel"   "pc105"
   Option "XkbLayout"  "de_CH"

Section "InputDevice"
   Identifier  "Mouse1"
   Driver "mouse"
   Option "Protocol"   "ImPS/2"
   Option "ZAxisMapping"   "4 5"
   Option "Device"     "/dev/psaux"

Section "Monitor"
   Identifier  "Monitor0"
   HorizSync   31.5 - 80.5
   VertRefresh 50 - 70
   Option "DPMS"

Section "Device"
   Identifier                          "ATI Graphics Adapter"
   Driver                              "fglrx"
   #Option                              "NoDDC"
   Option "no_accel"                   "no"
   Option "no_dri"                     "no"
   Option "mtrr"                       "off" # disable DRI mtrr mapper, driver has its own code for mtrr
   Option "DesktopSetup"               "0x00000000"
   Option "MonitorLayout"              "AUTO, AUTO"
   Option "IgnoreEDID"                 "off"
   Option "HSync2"                     "unspecified"
   Option "VRefresh2"                  "unspecified"
   Option "ScreenOverlap"              "0"
   Option "NoTV"                       "yes"
   Option "TVStandard"                 "NTSC-M"
   Option "TVHSizeAdj"                 "0"
   Option "TVVSizeAdj"                 "0"
   Option "TVHPosAdj"                  "0"
   Option "TVVPosAdj"                  "0"
   Option "TVHStartAdj"                "0"
   Option "TVColorAdj"                 "0"
   Option "GammaCorrectionI"           "0x00000000"
   Option "GammaCorrectionII"          "0x00000000"
   Option "Capabilities"               "0x00000000"
   Option "VideoOverlay"               "on"
   Option "OpenGLOverlay"              "off"
   Option "CenterMode"                 "off"
   Option "PseudoColorVisuals"         "off"
   Option "Stereo"                     "off"
   Option "StereoSyncEnable"           "1"
   Option "FSAAEnable"                 "no"
   Option "FSAAScale"                  "1"
   Option "FSAADisableGamma"           "no"
   Option "FSAACustomizeMSPos"         "no"
   Option "FSAAMSPosX0"                "0.000000"
   Option "FSAAMSPosY0"                "0.000000"
   Option "FSAAMSPosX1"                "0.000000"
   Option "FSAAMSPosY1"                "0.000000"
   Option "FSAAMSPosX2"                "0.000000"
   Option "FSAAMSPosY2"                "0.000000"
   Option "FSAAMSPosX3"                "0.000000"
   Option "FSAAMSPosY3"                "0.000000"
   Option "FSAAMSPosX4"                "0.000000"
   Option "FSAAMSPosY4"                "0.000000"
   Option "FSAAMSPosX5"                "0.000000"
   Option "FSAAMSPosY5"                "0.000000"
   Option "UseFastTLS"                 "0"
   Option "BlockSignalsOnLock"         "on"
   Option "UseInternalAGPGART"         "yes"
   Option "ForceGenericCPU"            "no"
   Option "KernelModuleParm"           "agplock=0" # AGP locked user pages: dis abled
   BusID "PCI:1:0:0"    # vendor=1002, device=4e48
   Screen 0

Section "Screen"
   Identifier  "Screen0"
   Device      "ATI Graphics Adapter"
   Monitor     "Monitor0"
   DefaultDepth 24
   #Option "backingstore"
   Subsection "Display"
       Depth       24
       Modes       "1280x1024"
       ViewPort    0 0  # initial origin if mode is smaller than desktop

Section "ServerLayout"
   Identifier  "Server Layout"
   Screen "Screen0"
   InputDevice "Mouse1" "CorePointer"
   InputDevice "Keyboard1" "CoreKeyboard"

Installing & Configuring Services

Apache 2 with PHP and MySQL

Getting Started

Warning: Use /etc/portage/package.use instead!

Apache2 is now considered stable and will be installed with a simple emerge. All of the important files will be in or will be linked in /etc/apache2/. Note that some settings defined on the files under /etc/apache2/conf are subject to be enabled on the command line when starting the server. Gentoo provides /etc/conf.d/apache2 file as the way to make these choices when starting the daemon with /etc/init.d/apache2 and rc-scripts.

Code: Easiest way!
USE="-* mysql" emerge mysql apache php mod_php

Is the easiest way to installing Apache with PHP and MySQL support.


When installing apache modules a configuration file is preinstalled. To get the module working you must edit /etc/conf.d/apache2 to include something like APACHE2_OPTS="-D PHP4", in order to load the module(s).


Getting SSL to work with a "Self Signed Certificate": (Note: Apache needs to have been compiled with SSL in your USE Flags)

  1. To allow for SSL connections you must first tell apache to listen to port 443 so add Listen 443 to your /etc/apache2/conf/apache2.conf config or check if that line is already present in /etc/apache2/conf/modules.d/40_mod_ssl.conf.
  2. Now edit /etc/apache2/conf/modules.d/41_mod_ssl.default-vhost.conf and change the line <VirtualHost _default_:443> to <VirtualHost *:443>
  3. Add -D SSL to APACHE2_OPTS on /etc/conf.d/apache2 as shown above (it would now read APACHE2_OPTS="-D SSL -D PHP4").
  4. All we are missing now is a Certificate, you can easily generate one:
Code: Add certificate
#cd /usr/lib/ssl/apache2-mod_ssl/
#mkdir /etc/apache2/conf/ssl/
#cp server* /etc/apache2/conf/ssl/
#mkdir /var/cache/apache2
#mkdir /var/logs/apache2

You have now created a self signed SSL certificate that will be used for your ssl connections. Restart Apache2 (/etc/init.d/apache2 reload) and it will now be listening for SSL connections on port 443. You can check it by pointing your browser to https://localhost.

Starting Apache

To start Apache2 run "/etc/init.d/apache2 start", in order to have Apache2 start on boot run "rc-update add apache2 default". see rc-update.

Common Problems

See /var/log/apache2/logs/error_log for errors

  • Error: [alert] (EAI 2)Name or service not known: mod_unique_id: unable to find IPv4 address of ""
    • With the base installation "mod_unique_id" is turned on, this can cause problems, notably the server not starting. Simply comment out this module in /etc/apache2/conf/httpd.conf and the problem will be solved.
  • Unable to establish secure connection
    • no solution yet..
  • Getting 403 Forbidden while accessing
    • Try to add apache to the users group with "usermod -g apache -G users apache", make sure the chmoding is correct and refresh.
  • SSLCertificateFile: file /usr/lib/apache2/conf/ssl/server.crt does not exist or empty
    • Once you created and copied the certificate, make sure the path /var/cache/apache2 exists by typing (surprisingly) mkdir /var/cache/apache2. otherwise, apache cannot create the certificate cache and the ssl service cannot be started. (written by Gal Diskin)
  • Error while starting apache: (2)No such file or directory: apache2: could not open error log file /usr/lib/apache2/logs/error_log.
    • check ls -la /usr/lib/apache2/logs so see where it is pointing (should be /var/log/apache2"). If it doesn't exist, you may need to create it using mkdir /var/log/apache2.


We need to first install samba and this is done by

# emerge samba

Once setup it is time to configure a few things. Let's start with /etc/samba/smb.conf

# nano -w /etc/samba/smb.conf
File: /etc/samba/smb.conf
# **********************************************************************
# /etc/samba/smb.conf - configured 2nd Jan, 2005 - bsodmike
# **********************************************************************

   workgroup = HOME
   netbios name = GENTOO
   server string = Gentoo Samba server
   printcap name = cups
   load printers = yes
   printing = cups
   printer admin = @adm
   log file = /var/log/samba3/log.%m
   max log size = 50
   security = user
   encrypt passwords = yes
   smb passwd file = /etc/samba/private/smbpasswd
   socket options = TCP_NODELAY SO_RCVBUF=8192 SO_SNDBUF=8192
   dns proxy = no

#============================ Share Definitions ==============================
   comment = Home Directories
   browseable = yes
   writable = yes

   comment = All Printers
   path = /var/spool/samba
   browseable = no
   guest ok = no
   writable = no
   printable = yes
   create mode = 0700
   print command = lpr-cups -P %p -o raw %s -r   # using client side printer drivers.

   path = /var/lib/samba/printers
   browseable = yes
   read only = yes
   write list = @adm root
   guest ok = yes

   comment = John's Stuff
   path = /home/johndoe
   valid users = johndoe
   public = no
   writable = yes
   printable = no
   create mask = 0765

We now need to create a folder to store the encrypted passwords in

# cd /etc/samba/
# mkdir private

Interestingly enough, samba manages it's own lists of users and passwords so we define a 'samba' password for our user John

# smbpasswd -a johndoe
New SMB password:
Retype new SMB password:
startsmbfilepwent_internal: file /etc/samba/private/smbpasswd did not exist. File successfully created.
Added user johndoe.

Let's start the samba service now

# /etc/init.d/samba start
 * samba -> stop: smbd...                                                  [ ok ]
 * samba -> stop: nmbd...                                                  [ ok ]
 * samba -> start: smbd...                                                 [ ok ]
 * samba -> start: nmbd...                                                 [ ok ]

And after testing we add it to auto-load :)

# rc-update add samba default
 * samba added to runlevel default
 * Caching service dependencies...
 * rc-update complete.



The best place for gentoo support listed by server - #gentoo

To connect run the following from the live-cd

# irssi -c -n MyName

If you've already booted into Gentoo you will need to first

# emerge irssi


Email System For The Home Network - Version 2.1


Grub Error Collection

TIP Xorg X11 and Transparency

Gentoo Linux Kernel Upgrade Guide

Localmail Guide

Gentoo Linux Cron Guide

Other References

Official Gentoo Handbook @


Many of the directives here clash with what we have detailed here. Stick with one or the other. You have been warned :)

Last modified: Fri, 29 Aug 2008 08:20:00 +0000 Hits: 112,963