Installing Gentoo Linux

Last Modified: Sat, 12/16/2006 - 19:33

Note:  This page is completely out of date.  I've left it here primarily for archival purposes, and also because it still contains some useful reference information for my own system.  Everyone else should refer to the Gentoo Linux Handbook instead for installation assistance. 

What is Gentoo?

In short, Gentoo is a source-based, community-driven, and heavily-optimized distribution.  There are no RPMs, no DEBs, and no .tgz binaries - just about everything you install on your computer will be built from source code.

What does that mean?  It means that Gentoo is a complex and difficult to install operating system, but the rewards for taking the time to learn and configure everything are nearly endless.  Whether you want performance, configurability, stability, security, or maintainability, Gentoo will work for you.  In addition, Gentoo's community involvement and support is the best I've ever seen, so you can rest assured that friendly assistance is but a forum post away.

For more information about Gentoo, visit the Gentoo home page at http://www.gentoo.org/.  For support, head to the forums at http://forums.gentoo.org/.  And finally, check out the "About Gentoo Linux" page at http://www.gentoo.org/main/en/about.xml if this is your first experience with Gentoo.

Purpose:

This document is NOT intended to be a comprehensive, step-by-step guide to installing Gentoo Linux.  The official Gentoo Linux x86 Installation Guide already does an extremely good job of that.  You can view the guide here: http://www.gentoo.org/doc/en/gentoo-x86-install.xml

Instead, this document is meant to provide supplemental information to the guide, such as example config files, additional reference material, etc.  In addition, it will list the installation steps on my specific hardware (see next section).  Any installation on similar hardware should be very similar to the process described here; as a result, this can provide a good reference to make sure everything's on track and no steps have been missed.

Please also note that this guide only covers the installation and initial configuration of Gentoo, just enough to get a functional system.  Additional help and configuration guides can be found on the Gentoo documentation site at http://www.gentoo.org/main/en/docs.xml.  I strongly suggest browsing through the available documentation to see what's there.

My Systems:

Included here are hardware specs for the systems on which I've documented my installation of Gentoo.  This is for your reference.  Find the system that most closely matches your hardware configuration, and use my setup commands for that system as a guide for your own installation.

Dual Athlon MP 2400+
Processor: (2) AMD Athlon MP 2400+
Memory:    512MB PC2100 DDR SDRAM
Video:     nVidia GeForce4 Ti 4600
Audio:     Creative Labs Soundblaster Audigy2 Platinum
Network:   3com 3cr990, Intel EtherExpress Pro 10/100
Modem:     Zoom v.92 Ext. FaxModem
Mouse:     4-button Logitech Cordless MouseMan Optical
Storage:   37GB 10000RPM Ultra160 SCSI
Dual Athlon MP 1800+
Processor: (2) AMD Athlon MP 1800+
Memory:    1024MB PC2100 DDR SDRAM
Video:     nVidia GeForce2 Pro
Audio:     Creative Labs Soundblaster Live! 5.1 Platinum
Network:   3com 3c905C
Modem:    
Mouse:     3-button Logitech First Wheel Mouse
Storage:   (1) 20GB 7200RPM UDMA-4 E-IDE, (1) 80GB 7200RPM UDMA-4 E-IDE
Gateway Performance P500
Processor: 500MHz Pentium III
Memory:    384MB PC100 SDRAM
Video:     3dfx Voodoo3
Audio:     Creative Labs Soundblaster Live! 5.1 Platinum
Network:   3com 3cr905c
Modem:    
Mouse:     3-button Logitech First Wheel Mouse
Storage:   (2) 20GB 7200RPM UDMA-4 E-IDE, (1) 30GB 5400 UDMA-4 E-IDE
Dell Latitude D600
Processor: 1.4GHz Pentium M
Memory:    512MB SDRAM
Video:     32MB ATI Mobility Radeon 9000
Audio:     Sigmatel 9750
Network:   Broadcom 570x Gigabit
           Dell TrueMobile 1400 Dual Band WLAN
Modem:     Conexant D480 MDC
Mouse:     2-button PS/2
Storage:   20GB 4200RPM UDMA-4 E-IDE
Dell Latitude C640
Processor: 1.8GHz Pentium 4M
Memory:    512MB PC133 SDRAM
Video:     32MB ATI Mobility Radeon 7500
Audio:     Crystal CS4205 (Intel i810)
Network:   3com 3c920 (3c905-TX)
Modem:     PCTel 2304WT MDC
Mouse:     2-button PS/2
Storage:   20GB 4200RPM UDMA-4 E-IDE
Dell Latitude C400
Processor: 866MHz Pentium III-M
Memory:    256MB PC133 SDRAM
Video:     16MB Intel i830M IGP
Audio:     Crystal CS4205 (Intel i810)
Network:   3com 3c905C-TX
Modem:     Conexant MD56ORD
Mouse:     2-button PS/2
Storage:   20GB 4200RPM UDMA-4 E-IDE

Prerequisites:

  • Time - this distribution will take a lot of time and effort to install, especially if this is your first time installing a source-based distribution.  Save this for a day when you're able to spend a decent amount of time tinkering with it and reading through documentation.
  • A Pentium II-based machine or better, with at least 64 MB RAM and 2 GB hard disk space.  It's possible to install on a lower-end machine, but not any fun at all.  More RAM and more hard drive space is also a good thing.
  • The Gentoo Linux x86 Installation Guide - read it now, and have a copy available while installing Gentoo.
  • Gentoo Linux installation CD - grab the latest release ISO from http://distro.ibiblio.org/pub/linux/distributions/gentoo/releases/.  If you plan on doing a Stage 1 install, you can get the x86/livecd/gentoo-basic-x86 ISO.  Otherwise, download the gentoo-3stages-x86 ISO.  Burn to CD.
  • **NOTICE**  These instructions were written for Gentoo 1.4_rc3.  Other releases will be similar, but will undoubtedly have some variation.  If anything here conflicts with the official installation guide, give precedence to the official guide.

Preparation:

You have two main decisions to make up front - how you want to setup your partitions, and which "stage" you want to install.  The installation guide covers both of these topics in detail.  Read through sections 1 (Introduction) and 5 (Partitioning) now to make sure you understand what's happening, and plan ahead for what you want to do.

For partitioning, I generally like to create a /boot primary partition at the very front of my hard disk, allow space for any other OS partitions after, then create a large / (root) logical partition and usually about a 256 MB logical swap partition.  I also like to use ext3 for all my filesystems.  It may not be as efficient as reiserfs in some situations, but it's generally regarded as safe and well-supported journaling filesystem, which, in the case of my data, is more important to me.

You may also want to consider adding a separate /home partition as well, in case you'd like to keep your personal data separate from the rest of the operating system.  In general, though, just use whatever partition layout you used with your previous distribution - that should work fine.

One more note about the stages - this document will cover a Stage 1 (most involved) installation.  If this is your first Gentoo install, though, I'd recommend going with a Stage 3 installation.  I'll mention below what parts you can skip if you're doing a Stage 3 install.

Installation:

Initial Steps

Remember, you need to have a copy of the installation guide available.  If you have a second computer, just keep it loaded in your web browser.  Otherwise, print it out.

To get started, boot from the installation CD.  At the boot: prompt, enter 'gentoo'.  Choose your language when prompted, then immediately enter 'passwd' to set the root password after it's finish booting.  Don't forget to set the root password here - if you don't and you have some kind of problem during the install, you will not be able to login on a different terminal to fix the problem.

Next, load whatever hardware drivers you need.  The installation guide explains this process well.  Gentoo recognized and auto-configured everything on my Latitude C400 without any problems.

At this point you need to configure your network interface.  If your NIC is recognized by Gentoo and you're on a DHCP network (as was the case with my Latitude C400), this may be done automatically for you.  If not, you can use 'net-setup eth0' to configure it.  Refer to the install guide for many additional details.

At this point, I've done the following on my systems:

Dual Athlon MP 2400+
smp doscsi vga=791  #start smp installer, probe for SCSI, enable SVGA
passwd              #set root password
ping www.cisco.com  #confirm network works
setterm -blank 0    #disable console blanking
Dual Athlon MP 1800+
smp vga=791  #start smp installer, enable SVGA
passwd              #set root password
ping www.cisco.com  #confirm network works
setterm -blank 0    #disable console blanking
Performance P500
nofb                #boot default kernel, disable framebuffer mode
passwd              #set root password

#setup and confirm networking
ifconfig eth0 192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0
route add -net default gw 192.168.0.1 netmask 0.0.0.0 metric 1 eth0
vi /etc/resolv.conf
ping www.cisco.com

hdparm -d1 -u1 -c1 -k1 -A1 -m16 -a64 -X66 /dev/hde  #enable drive optimizations
setterm -blank 0    #disable console blanking
Latitude D600
gentoo nodetect nodhcp      #start installer and copy CD to tmpfs
passwd              #set root password
hdparm -d1 -u1 -c1 -k1 -A1 -m16 -a64 /dev/hda  #enable drive optimizations
modprobe tg3  #enable internal NIC
dhcpcd eth0  #enable DHCP
ping www.cisco.com  #confirm network works
setterm -blank 0
Latitude C640
gentoo cdcache      #start installer and copy CD to tmpfs
passwd              #set root password
hdparm -d1 -u1 -c1 -k1 -A1 -m16 -a64 /dev/hda  #enable drive optimizations
ping www.cisco.com  #confirm network works
setterm -blank 0
Latitude C400
gentoo cdcache      #start installer and copy CD to tmpfs
passwd              #set root password
hdparm -d1 -u1 -c1 -k1 -A1 -m16 -a64 /dev/hda  #enable drive optimizations
ping www.cisco.com  #confirm network works

Partitioning

You already have your partitioning scheme planned out from earlier, right?  Re-read section 5 to make sure you didn't overlook anything, then use either cfdisk (easier) or fdisk (more powerful) to make any necessary changes.

Once your partitions are in place, it's time to initialize the filesystems.  Follow the instructions in the installation guide, and use there examples to create whichever filesystems you'd like.

Next, you need to mount your new partitions.  Again, follow the directions and examples in the install guide.  Also, be sure to activate your swap partition.  This is particularly important if you have less than 256 MB RAM - if you do not have extra swap space, the build process will probably fail.

This is how I setup my systems:

Dual Athlon MP 2400+
mke2fs -j /dev/sda1          #create /boot filesystem
mke2fs -j /dev/sda5          #create / filesystem
mke2fs -j /dev/sda6          #create /home filesystem
mount /dev/sda5 /mnt/gentoo  #mount / filesystem
mkdir /mnt/gentoo/boot       #create /boot mount point
mount /dev/sda1 /mnt/gentoo/boot  #mount /boot filesystem
Dual Athlon MP 1800+
mke2fs -j /dev/hda1          #create /boot filesystem
mke2fs -j /dev/hda2          #create / filesystem
mke2fs -j /dev/hdb2          #create /home filesystem
mkswap /dev/hdb1             #create swap filesystem
swapon /dev/hdb1             #activate swap filesystem
mount /dev/hda2 /mnt/gentoo  #mount / filesystem
mkdir /mnt/gentoo/boot       #create /boot mount point
mount /dev/hda1 /mnt/gentoo/boot  #mount /boot filesystem
Performance P500
mke2fs -j /dev/hde1          #create /boot filesystem
mke2fs -j /dev/hde3          #create / filesystem
mkswap /dev/hde2             #create swap filesystem
swapon /dev/hde2             #activate swap filesystem
mount /dev/hde3 /mnt/gentoo  #mount / filesystem
mkdir /mnt/gentoo/boot       #create /boot mount point
mount /dev/hde1 /mnt/gentoo/boot  #mount /boot filesystem
Latitude D600

mke2fs -j /dev/hda2          #create ext3 / filesystem
mount /dev/hda2 /mnt/gentoo  #mount / filesystem
Latitude C640
mkswap /dev/hda3             #create swap filesystem
mke2fs -j /dev/hda2          #create ext3 / filesystem
swapon /dev/hda3             #activate swap filesystem
mkdir /mnt/gentoo            #create installation mount point
mount /dev/hda2 /mnt/gentoo  #mount / filesystem
Latitude C400
mkswap /dev/hda3             #create swap filesystem
mke2fs -j /dev/hda2          #create ext3 / filesystem
swapon /dev/hda3             #activate swap filesystem
mkdir /mnt/gentoo            #create installation mount point
mount /dev/hda2 /mnt/gentoo  #mount / filesystem

Configuring Installation Environment

Decide which Stage you want to install.  Remember, Stage 1 requires compiling EVERYTHING on your system, and as such will take quite a while.  Stage 3 includes prebuilt system packages that will greatly speed up installation.  You should only need to install Stage 1 if you're obsessed with getting every last bit of performance out of your system, or perhaps if you simply want to feel more manly.  Otherwise, go with Stage 3.

Follow the directions on the web site to get (if necessary) and extract your desired Stage tarball, then enter the chroot environment and update the portage tree as described.  Note that at this point you must have networking enabled to continue.

Finally, make sure your make.conf file is configured properly.  This file defines portage's behavior, and contains the two most important settings on a Gentoo system - your USE flags, and your CFLAGS.  USE flags basically describe what components you want to be enabled/disabled in programs, which optional components are installed, etc.  CFLAGS set which options gcc will use when building packages.  Aggressive CFLAGS can lead to good performance gains, but it can also cause some instability.  I've included my USE and CFLAGS settings below for reference, but BE SURE TO READ section 10 in the install guide, and The USE Variable HOWTO, available at http://www.gentoo.org/doc/en/use-howto.xml.

You'll notice that my example USE flags below contain all options those preceded by a - are disabled, those not are enabled.  Please note that I only do this for my reference and that it is NOT necessary - USE flags are disabled by default, and as such will only be enabled if explicitly mentioned here.  Be sure to check your /etc/make.profile/make.defaults file, however - it contains some USE flags as well.  To disable any listed in there, add them to your make.conf list and prepend them with a -.

Here are my steps:

All Systems
cd /mnt/gentoo                #change to installation / directory
tar xvjpf /mnt/cdrom/gentoo/stage1-<version>.tar.bz2  #extract Stage 1 tarball
mount -t proc /proc /mnt/gentoo/proc                  #mount /proc settings
mirrorselect -a -s4 -o >>/mnt/gentoo/etc/make.conf    #select fast Gentoo mirror
cp /etc/resolv.conf /mnt/gentoo/etc/                  #copy nameserver information

chroot /mnt/gentoo /bin/bash  #enter install environment
env-update                    #configure environment
source /etc/profile           #configure environment

emerge sync                   #download portage tree

nano -w /etc/make.conf        #configure portage
                              #my Athlon make.conf
                              #my P500 make.conf
                              #my GX150 make.conf
                              #my D600 make.conf
                              #my C640 make.conf
                              #my C400 make.conf

Stage 1 Installation

If you're performing a Stage 3 installation, skip this section.

The first thing that must be done is bootstrap your system.  This will build and install your compiler, and other essential system programs.  Read section 11 of the installation guide for additional info.  This step will take awhile to complete.

After the bootstrap is complete, it's time to install the base system packages.  Again, read section 12 for more information, and be prepared to wait an even longer time for this to complete.

My steps:

All Systems
cd /usr/portage          #change to portage directory
scripts/bootstrap.sh     #begin bootstrap
emerge -p system | less  #confirm package selection
emerge system            #begin system installation
Stage 3 Installation

If you're performing a Stage 3 installation, your bootstrap process and base system installation is already complete.  I do, however, stronly advise that you follow the steps in 13 of the installation guide to ensure your packages are up-to-date.

Continuing Installation - Kernel and System Logger

At this point, the Stage 1 and Stage 3 installs are equal, so everyone should follow from here.  Before installing anything else, be sure to set your timezone and date information, as described in section 14 of the guide.

Gentoo allows you to choose which type of kernel you want to install.  Section 15 of the guide explains the most common choices, and you can see a list of even more options in /usr/portage/sys-kernel/.  The two most common choices are vanilla-sources and gentoo-sources.  vanilla-sources are the stock kernel source you would download from kernel.org, and as a result are the safest choice.  gentoo-sources have been optimized by the Gentoo developers for performance and extra functionality.  Either choice should be safe, but if you're not very confortable configuring a kernel, I'd suggest sticking with the vanilla sources.

Be absolutely certain that you read section 15 in the install guide.  It contains a lot of information about how to configure and build your kernel, as well as some of the options you need to be sure to enable.  Some of these options are different than other distributions, so be sure to check these.

Next you'll want to install a system logger.  You have several choices, but I'd recommend going with either syslog-ng (easy and powerful) or metalog (performance-oriented).

You'll also need to install a cron daemon.  Again, you have several choices available.  I've always used vixie-cron, and it works fine me.

Here's what I installed:

All Systems
#configure timezone and set date
ln -sf /usr/share/zoneinfo/US/Central /etc/localtime
date <MMDDhhmm>
hwclock --systohc

#configure and install kernel
emerge <kernel>-sources  #install chosen kernel
cd /usr/src/linux/
make menuconfig  #my Athlon gaming-sources-2.4.20-r3 .config file
                 #my P500 development-sources-2.6.0_beta6 .config file
                 #my GX150 development-sources-2.6.0_beta5 .config file
                 #my D600 ac-sources-2.4.22-r4 .config file
                 #my C640 selinux-sources-2.4.20-r2 .config file
                 #my C400 vanilla-sources-2.4.20 .config file
**2.4.x kernel** make dep && make bzImage modules modules_install
**2.6.x kernel** make && make modules_install
cp arch/i386/boot/bzImage /boot/bzImage-<version>
cd /boot/
ln -s bzImage-<version> bzImage

#install system logger and cron daemon
emerge syslog-ng vixie-cron

Installing Additional Necessary Packages

At this point you will want to install any additional packages you will need after restarting your machine.  In particular, you should install pcmcia-cs if you're using a laptop, and any necessary ppp software if you're using DSL or dial-up.

Here's what I installed:

Latitude C640
emerge pcmcia-cs  #PCMCIA drivers for my laptop
Latitude C400
emerge pcmcia-cs  #PCMCIA drivers for my laptop

Modifying Configuration Files

Next, you'll need to modify several system configuration files.  Be sure to read each relevant section in the installation guide, and I've included samples from my installation below.

Dual Athlon 2400+
#/etc/fstab
#/etc/hostname
#/etc/hosts
#/etc/rc.conf
#/etc/conf.d/local.start
Performance 500
#/etc/fstab
#/etc/hostname
#/etc/hosts
#/etc/rc.conf
#/etc/conf.d/local.start
Latitude D600
#/etc/fstab
#/etc/hostname
#/etc/hosts
#/etc/rc.conf
#/etc/conf.d/local.start
Latitude C640
#/etc/fstab
#/etc/hostname
#/etc/hosts
#/etc/rc.conf
#/etc/conf.d/local.start
Latitude C400
#/etc/fstab
#/etc/hostname
#/etc/hosts
#/etc/rc.conf
#/etc/conf.d/local.start

Configuring Your Bootloader

Make sure you properly configure your bootloader.  Otherwise, your system will not be able to boot.

The default bootloader for Gentoo is grub, but I much prefer lilo.  See the install guide for configuration instructions for both grub and lilo.  If you'd also prefer to install lilo, remember that you need to install it and uninstall grub before continuing.

Please note that /etc/lilo.conf will not exist after installing lilo.  If you're unsure of what goes in the configuration file, copy /etc/lilo.conf.sample to /etc/lilo.conf and modify the well-commented sample file.  I also included my lilo.conf file below.

Here's my configuration:

All Systems
emerge lilo          #install lilo
emerge unmerge grub  #uninstall grub
nano /etc/lilo.conf  #configure lilo
                     #my Athlon lilo.conf file
                     #my P500 lilo.conf file
                     #my GX150 lilo.conf file
                     #my D600 lilo.conf file
                     #my C640 lilo.conf file
                     #my C400 lilo.conf file
lilo                 #write lilo configuration to boot record

Enabling Services and Modules

By default, most services and deaemons are disabled at boot.  Available services on your system can be found in /etc/init.d/.  Look through this directory and decide what you want to enable automatically at boot, then use 'rc-update add <name> default' to enable each of them.  Please note that this is particularly important for your system logger and cron daemon.&nbap; My recommended choices are listed below.

You'll also need to tell Gentoo which modules you want to load at boot.  Most modules should be automatically loaded when needed, but it is necessary to place some of them in /etc/modules.autoload to ensure they're loaded at boot.  I also included my modules.autoload file below.

Here's what I enabled:

All Systems
rc-update add syslog-ng default  #enable system logger
rc-update add vixie-cron default      #enable cron daemon
rc-update add net.eth0 default   #enable networking on eth0 (see next section)
rc-update add sshd default       #enable SSH server
rc-update add numlock default    #enable numlock

nano /etc/modules.autoload       #add modules to be loaded at boot
                                 #my Athlon modules.autoload and modules.conf files
                                 #my P500 modules.autoload and modules.conf files
                                 #my GX150 modules.autoload and modules.conf files
                                 #my D600 modules.autoload and modules.conf files
                                 #my C640 modules.autoload and modules.conf files
                                 #my C400 modules.autoload and modules.conf files
modules-update                   #update system module configuration

Configuring Networking

You'll also want to make sure that your network interface is configured properly when you reboot.  First, make sure the proper module (if you didn't compile the driver directlry into the kernel) is in /etc/modules.autoload.  Next, edit /etc/conf.d/net to match your particular network environment.  Finally, make sure your network interface is enabled at boot.  See above section for details on that.

Here's my configuration:

Dual Athlon MP 2400+
   
/etc/conf.d/net:
iface_eth0="192.168.0.3 broadcast 192.168.0.255 netmask 255.255.255.0"
gateway="eth0/192.168.0.1"
Performance P500
   
/etc/conf.d/net:
iface_eth0="192.168.0.2 broadcast 192.168.0.255 netmask 255.255.255.0"
gateway="eth0/192.168.0.1"
Latitude D600
   
/etc/conf.d/net:
iface_eth0="dhcp"
iface_eth1="dhcp"
dhcpd_eth0="-t 20"
dhcpd_eth1="-t 20"
Latitude C640
   
/etc/conf.d/net:
iface_eth0="dhcp"
iface_eth1="dhcp"
dhcpd_eth0="-t 20"
dhcpd_eth1="-t 20"
Latitude C400
   
/etc/conf.d/net:
iface_eth0="dhcp"
iface_eth1="dhcp"
dhcpd_eth0="-t 20"
dhcpd_eth1="-t 20"

Finishing Installation

Before proceeding any further, set your root password.  Please note that this is not what you already did at the beginning of the installation.  That command set the password for the installation; now you must set the password for your installed system.

Next, I recommend that you create a bootdisk.  See section 24 of the install guide for instructions on doing that.

Finally, exit the chroot environment, unmount all filesystems, and reboot.  Hopefully everything will work correctly, and you'll be brought to the Login: prompt for your shiny new Gentoo installation.  If you do have any problems, remember that you can use the installation CD as a resuce disk by booting it, chrooting yourself into your installation environment, then fixing any errors.  See the install guide for more information.

One last note.  I have, on a couple different occasions, had problems booting because no /proc directory was created during the installation.  After unmount /mnt/gentoo/proc/, but before unmounting /mnt/gentoo/, be sure to check that /mnt/gentoo/proc/ exists.  If not, create it.

Here are my final installation steps:

All Systems
passwd      #set root password
etc-update  #update necessary configuration files
exit        #exit chroot environment
cd /        #change from installation directory
umount /mnt/gentoo/boot  #unmount boot filesystem
umount /mnt/gentoo/proc  #unmount proc filesystem
reboot      #reboot

System Configuration

Now that you're system is installed and running (you did reboot, right?), it's time to start configuring it.

Enabling PCMCIA support

If you're installing Gentoo on a laptop and you need PCMCIA support, you MUST rebuild pcmcia-cs at this point.  Even if you already built and installed it during the installation phase, it must be rebuilt to support your current kernel.

Here's how I rebuilt mine:

Latitude C640
emerge pcmcia-cs  #rebuild pcmcia-cs for current kernel
Latitude C400
emerge pcmcia-cs  #rebuild pcmcia-cs for current kernel

Adding Users

The process of adding and configuring users under Gentoo isn't quite the same as what I'm used to from other distributions (which can be good or bad, I guess).  I've added some more information to this section than is probably necessary, but it should hopefully ensure that nothing was overlooked.

First, make sure your skel files are correct.  These files, found in /etc/skel/ (they're hidden, so use ls -l to see them), are copied to a user's home directory when a new account is created, and basically set that the default environment.  You can customize the ones that are currently in /etc/skel/ to incorporate any default settings you might like (for example, I like to set my history size to 1000, rather than the default 500), or you can add any additional files to this directory, so that all users will be preconfigured (for example, you can add an .xinitrc file to set the user's default desktop environment).  My config files are included at the end for your reference.

Next up is to create the user account.  You can do this with the useradd command; however, there is a catch.  By default, this version of useradd will not create the user's home directory, and it also assumes you want all users to belong to the 'users' group.  I prefer to have a unique group for each user, and I certainly want to create the directory.  So, you can use the groupadd command to create the new group first, and then useradd -m to create the home directory.  I also explicitly specify all information to ensure the accounts get created properly.  Finally, don't forget to set the user's password.

Here's my user configuration:

Dual Athlon MP 2400+
   
/etc/skel/.bash_profile:
[ -f ~/.bashrc ] && . ~/.bashrc
export HISTSIZE=1500
/etc/skel/.bashrc:
eval `dircolors -b /etc/DIR_COLORS`
alias ls="ls --color=auto"
alias rd=rmdir
alias md=mkdir
alias c=clear
alias x=startx
case $TERM in
   xterm*|rxvt|eterm)
      PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
      ;;
   screen)
      PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
   ;;
esac
Latitude C640
   
/etc/skel/.bash_profile:
[ -f ~/.bashrc ] && . ~/.bashrc
export HISTSIZE=1000
/etc/skel/.bashrc:
eval `dircolors -b /etc/DIR_COLORS`
alias ls="ls --color=auto"
alias rd=rmdir
alias md=mkdir
alias c=clear
alias x=startx
case $TERM in
   xterm*|rxvt|eterm)
      PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
      ;;
   screen)
      PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
   ;;
esac
/etc/skel/.xinitrc:
exec startkde  #set KDE as default desktop
Latitude C400
   
/etc/skel/.bash_profile:
[ -f ~/.bashrc ] && . ~/.bashrc
export HISTSIZE=1000
/etc/skel/.bashrc:
eval `dircolors -b /etc/DIR_COLORS`
alias ls="ls --color=auto"
alias rd=rmdir
alias md=mkdir
alias c=clear
alias x=startx
case $TERM in
   xterm*|rxvt|eterm)
      PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\007"'
      ;;
   screen)
      PROMPT_COMMAND='echo -ne "\033_${USER}@${HOSTNAME%%.*}:${PWD/$HOME/~}\033\\"'
   ;;
esac
/etc/skel/.xinitrc:
exec startkde  #set KDE as default desktop

And here's how I created my users:

Dual Athlon MP 2400+
groupadd -g 1000 jbreland
useradd -u 1000 -g jbreland -G users,portage,wheel,floppy,cdrom,audio \
        -d /home/jbreland -s /bin/bash -c "Jared Breland" -m jbreland
passwd jbreland
Latitude C640
groupadd -g 1000 jbreland
useradd -u 1000 -g jbreland -G users,portage,wheel -d /home/jbreland \
        -s /bin/bash -c "Jared Breland" -m jbreland
passwd jbreland
Latitude C400
groupadd -g 1000 jbreland
useradd -u 1000 -g jbreland -G users,wheel -d /home/jbreland -s /bin/bash \
        -c "Jared Breland" -m jbreland
passwd jbreland

Configuring Your Editor

The only editor included by default on your new system is nano, a basic GNU pico-like editor.  If you like pico, this should work fine for you - skip this section.  If, however, you demand more power from your editor, you'll want to install either vim or emacs.  I prefer vim, so I'll use vim in my examples here, but configuring emacs should work in much the same way.

The first thing you'll need to do is install vim.  Use 'emerge -s vim' to see which packages are available for vim.  The command-line version will always be installed no matter what you choose, you but may also install a graphical version of vim based on either QT (kvim) or GTK (gvim).

After installing vim, you'll need to uninstall nano and set vim as your default editor.  To do this, edit /etc/csh.env, /etc/env.d/00basic, and /etc/profile.env and each occurance of /bin/nano to /usr/bin/vim.  If you're used to typing vi instead of vim, I'd also recommend creating a symbolic link for /usr/bin/vi that points to /usr/bin/vim.

Finally, you'll want to configure your editing environment.  Edit /etc/vim/vimrc and make any changes you'd like.  I've included my file below as a reference.

Here's how I configured vim:

Dual Athlon MP 2400+
emerge vim             #install vim
emerge unmerge nano    #uninstall nano
vi /etc/csh.env        #update to vim
vi /etc/env.d/00basic  #update to vim
vi /etc/profile.env    #update to vim
vi /etc/vim/vimrc      #setup default vim environemt
                       #my vimrc file
Latitude C640
emerge vim             #install vim
emerge unmerge nano    #uninstall nano
vi /etc/csh.env        #update to vim
vi /etc/env.d/00basic  #update to vim
vi /etc/profile.env    #update to vim
vi /etc/vim/vimrc      #setup default vim environemt
                       #my vimrc file
Latitude C400
emerge vim kvim        #install vim and kvim
emerge unmerge nano    #uninstall nano
ln -sf /usr/bin/vim /usr/bin/vi  #create symlink for vi
vi /etc/csh.env        #update to vim
vi /etc/env.d/00basic  #update to vim
vi /etc/profile.env    #update to vim
vi /etc/vim/vimrc      #setup default vim environemt
                       #my vimrc file

Configuring Your Mouse

If you spend any amount of time using the console, you'll definitely want to configure your mouse for it (to configure it under X, see below).  The process is similar for both PS/2 and USB mice - install gpm, configure /etc/conf.d/gpm, and start the gpm service.  The only difference between a USB and PS/2 installation is the config file.

Here's my configuration:

Dual Athlon MP 2400+
emerge gpm                 #install gpm
vi /etc/conf.d/gpm         #configure gpm
                           #my conf.d/gpm file
/etc/init.d/gpm start      #start gpm
rc-update add gpm default  #enable gpm at boot
Latitude C640
emerge gpm                 #install gpm
vi /etc/conf.d/gpm         #configure gpm
                           #my conf.d/gpm file
/etc/init.d/gpm start      #start gpm
rc-update add gpm default  #enable gpm at boot
Latitude C400
emerge gpm                 #install gpm
vi /etc/conf.d/gpm         #configure gpm
                           #my conf.d/gpm file
/etc/init.d/gpm start      #start gpm
rc-update add gpm default  #enable gpm at boot

Configuring Audio

Your kernel must be configured for support for your sound card.  If you already enabled this during installation, you're good to go.  Otherwise, reconfigure your kernel settings, compile again, and install the new kernel and modules.  If you compiled the driver directly into your kernel, just reset and you should be good to go.  If you compiled it as a module, add the module to your /etc/modules.autoload file and run 'update-modules'.

Now that your audio is working, I'd highly recommend installing aumix.  This is a console mixer that will allow you to set various volume levels for your sound card, as well as remember your default settings when rebooting.

Here's how I setup my systems:

Latitude C640
emerge aumix                 #install aumix
/etc/init.d/aumix start      #start aumix service
aumix                        #set default mixer settings
/etc/init.d/aumix restart    #restart aumix to load default settings
rc-update add aumix default  #enable aumix at boot
Latitude C400
emerge aumix                 #install aumix
/etc/init.d/aumix start      #start aumix service
aumix                        #set default mixer settings
/etc/init.d/aumix restart    #restart aumix to load default settings
rc-update add aumix default  #enable aumix at boot

Desktop Configuration

Configuring XFree86

Unless you only want to use the console, it's time to configure X.  Be warned, though - X configuration under Gentoo is difficult, due to the lack of any "wizards" used by some other distributions.  Before proceeding any further, make sure you have your kernel configured properly.  If you missed anything there, X will simply not run.  Also, X was probably already compiled and installed during installation (it's in the default USE flags, so you'd have to explicitely disable it to make it not install).  If, however, this is not the case, 'emerge xfree' will install it.

Now, you basically have three choices for configuring X - by hand (hopefully using a backed-up copy of a working configuration on your hardware), using xf86cfg, or using xf86config.  If you already have a working copy of your XF86Config file, I'd strongly suggest the first option.  Just modify it as necessary.  Otherwise, use either xf86cfg or xf86config to do the job.  xf86cfg will start a framebuffered X and allow you to configure it using a GUI, but I've always had more luck with the command-line based xf86config.  Either way, your milage may vary.

I've included my XF86Config file below.  You should be able to use most of it in your own, but you will need to know your video card and monitor information, and you also may need to change the mouse configuration (this is for a 2-button PS/2 mouse).

Once you think you have it right, test it with 'startx'.  If anything fails, read the screen output from X and look for any lines starting with (EE) or (WW).  Also, check the log file in /var/log/XFree86.0.log.  Edit your XF86Config and try again.

**NOTE**  If you have 'exec startkde' in your ~/.xinitrc, or 'XSESSION=kde-3.1' in your /etc/rc.conf (as I have in my examples), X WILL NOT WORK.  Even if it's configured properly, it will try to load KDE and fail because it's not installed.  To fix this for temporary testing, edit (or create) ~/.xinitrc and add two lines: 'exec xterm' followed by 'exec twm'.  This will give you a rudimentary desktop environment in which to make sure X works.  When you're happy with it, delete ~/.xinitc (or change it back to 'exec startkde').

I've included my commands below for configuring X.  Please note that I also included a few extra commands for compiling a special driver not included in the kernel.  This is for my reference, and you hopefully should not have to do anything similar.

Dual Athlon MP 2400+
xf86cfg  #configure X
         #my XF86Config file
Latitude C640
xf86cfg  #configure X
         #my XF86Config file
Latitude C400
xf86cfg  #configure X
         #my XF86Config file

# Specific to i830 integrated graphics chips
ebuild /usr/portage/x11-base/xfree/xfree-4.3.0.ebuild compile
cd /var/tmp/portage/xfree-4.3.0/
cd work/xc/programs/Xserver/hw/xfree86/os-support/linux/drm/kernel
make -f Makefile.linux i830.o
mkdir /lib/modules/2.4.20/kernel/drivers/char/drm/
cp i830.o /lib/modules/2.4.20/kernel/drivers/char/drm/
echo -e "/lib/modules/2.4.20/kernel/drivers/char/drm/i830.o:\n" \
        >>/lib/modules/2.4.20/modules.dep
echo "i830" >>/etc/modules.autoload
update-modules

Configuring KDE

Way back at the beginning of this article I mentioned how great Gentoo is, how great Portage is, etc.  By now, you're probably asking yourself if I'm insane.  Well, here is where we finally get to let Portage shine.  Note, this section is obviosly about installing KDE.  If you would prefer to install GNOME, the process is very similar (basically, replace 'emerge kde' with 'emerge gnome').

To get started, type 'emerge -p kde'.  Portage will automatically resolve all dependencies needed to install KDE, then show you a list of what it will install.  This list shows everything KDE needs, as well as whatever optional programs and components are enabled through your USE flags.  My list had about 80 packages in it, so needless to say, installing this will take a long time.  Start the installation with 'emerge kde' and then go to sleep, wake up and go to work, go out to dinner later that night, and then it might be done.  Hopefully, everything will compile without any problems, and you'll be left with the very beautiful KDE 3.1 installed, all done with one simple command.  Now, how great is that?

Here's how I installed it on my systems:

Dual Athlon MP 2400+
# specify which KDE components I want
ls /usr/portage/kde-base/
emerge arts kdeaddons kdeadmin kdeartwork kdebase kdebindings kdegames \
       kdegraphics kdelibs kdemultimedia kdeutils
Latitude C640
# see what's going to be installed, then specify which KDE components I want
emerge -p kde
emerge arts kdelibs kdebase kdeartwork kdenetwork kdepim kdemultimedia \
       kdeutils kdegames kdegraphics kdeaddons kdeadmin
Latitude C400
# see what's going to be installed, then specify which KDE components I want
emerge -p kde
emerge arts kdelibs kdebase kdeartwork kdenetwork kdepim kdemultimedia \
       kdeutils kdegames kdegraphics kdeaddons kdeadmin

Miscellany

Now that both your base system and your desktop is configured, you're ready to start using your shiny new Gentoo system productively.  There are a few more things you may want to consider doing, though.

Updating Your Portage Tree

Before proceeding, I suggest you update your portage tree.  This ensures that anything you install will be the most current version available.  Additionally, this would be a good time to update any existing packages that are already installed, just in case any updates have been released.

Here's how I updated my systems:

All Systems
emerge rsync      #update portage tree
emerge -pu world  #check for any updates
emerge -u world   #install any updates

Installing Additional Packages

As I mentioned before, Gentoo's approach is to install only what you tell it, either explicitely or through USE flags.  As a result, some applications that you would usually assume are installed (because they're installed by default with other distributions) are not.  You may want to jot down a list of apps that you regularly use in Linux, and then use portage to isntall them before proceeding.  You can see everything that's available by browsing the /usr/portage/ tree.

Some suggestions of app packages you may want:

  • Database - mysql
  • Development - kdevelop, blackdown-jdk, quanta
  • Encryption - gnupg
  • File/Print Server - samba, nfs-utils, autofs
  • FTP Client - gftp, ncftp
  • FTP Server - pure-ftpd
  • Instant Messenging - gaim
  • Mail Client - mozilla
  • Mail Server - sendmail
  • Multimedia - xmms, xine-lib, xine-ui, xine-dvdnav
  • Office Suite - openoffice-bin
  • System - gentoolkit, gkrellm, eject, tcpdump
  • Web Browser - mozilla, lynx, links
  • Web Server - apache, mod_php, mod_ssl

Remember, due to your USE flags, some of these apps may already be installed.  To check, use either 'emerge -p app' or 'emerge -s app'.