Zurück

Installing Gentoo Linux (Live CD 2005.1)


Overview

Gentoo Linux ia a special flavor of Linux that can be automatically optimized and customized for just about any application or need. Extreme performance, configurability and a top-notch user and developer community are all hallmarks of the Gentoo experience.

Thanks to a technology called Portage, Gentoo Linux can become an ideal secure server, development workstation, professional desktop, gaming system, embedded solution or something else -- whatever you need it to be.

This is a short installation log for Gentoo (2005.1).

Gentoo Reference Platform GRP

The Gentoo Reference Platform, from now on abbreviated to GRP, is a snapshot of prebuilt packages users (that means you!) can install during the installation of Gentoo to speed up the installation process. The GRP consists of all packages required to have a fully functional Gentoo installation. They are not just the ones you need to have a base installation up to speed in no time, but all lengthier builds (such as KDE, xorg-x11, GNOME, OpenOffice, Mozilla, ...) are available as GRP packages too.

However, these prebuilt packages aren't maintained during the lifetime of the Gentoo distribution. They are snapshots released at every Gentoo release and make it possible to have a functional environment in a short amount of time. You can then upgrade your system in the background while working in your Gentoo environment.

How Portage Handles GRP Packages

Your Portage tree - the collection of ebuilds (files that contain all information about a package, such as its description, homepage, sourcecode URLs, compilation instructions, dependencies, etc.) - must be synchronised with the GRP set: the versions of the available ebuilds and their accompanying GRP packages must match.

For this reason you will have to install a Portage snapshot instead of synchronising Portage with the latest available tree if you want to use the GRP installation method.

Installation Log

Burn the downloaded Image to CD-ROM

If you use Nero CD-Burner:

  1. Copy ISO Files to your local PC

  2. Click Menu: File

  3. Click Menu: Burn Image

  4. Select the ISO Image and start buring

Initial Setup from CD

Download the Universal Installation CD called install-x86-universal-2005.1.iso and burn it on CD, then boot from the CD, and start the SSH-Daemon:

/etc/init.d/sshd start
passwd root

Load Swiss-German Keyboard Mapping:
cd /usr/share/keymaps/i386/qwertz
loadkeys sg-latin1
Loading ./sg-latin1.map.gz

Show loaded Modules:
lsmod

Module                  Size  Used by
ipv6                  185472  12
floppy                 44912  0
rtc                     8488  0
evdev                   6368  0
aic79xx               204988  0
e1000                  63652  0
parport_pc             27876  0
parport                22088  1 parport_pc
ahci                    7604  0
sata_qstor              6100  0
sata_uli                4368  0
sata_sis                4240  0
sata_sx4                9716  0
sata_nv                 5620  0
sata_via                5364  0
sata_svw                4596  0
sata_sil                5620  0
sata_promise            6900  0
libata                 27700  10 ahci,sata_qstor,sata_uli,sata_sis,sata_sx4,
                                 sata_nv,sata_via,sata_svw,sata_sil,sata_promise
dm_mirror              15320  0
dm_mod                 38080  1 dm_mirror
sbp2                   16920  0
ohci1394               25812  0
ieee1394               59704  2 sbp2,ohci1394
sl811_hcd               9392  0
ohci_hcd               15384  0
uhci_hcd               23936  0
usb_storage            47680  0
usbhid                 25696  0
ehci_hcd               22872  0
usbcore                75064  7 sl811_hcd,ohci_hcd,uhci_hcd,usb_storage,usbhid,ehci_hcd

Manual Network Configuration

When the Installation CD boots, it tries to detect all your hardware devices and loads the appropriate kernel modules (drivers) to support your hardware. In the vast majority of cases, it does a very good job. However, in some cases, it may not auto-load the kernel modules you need.

If net-setup eth0 failed, then it is possible that your network card wasn't found immediately. This means you may have to load the appropriate kernel modules manually.

To find out what kernel modules we provide for networking, use ls:

ls /lib/modules/`uname -r`/kernel/drivers/net

If you find a driver for your network card, use modprobe to load the kernel module:

(As an example, we load the pcnet32 module)

modprobe pcnet32

To check if your network card is now detected, use ifconfig. A detected network card would result in something like this:

ifconfig eth0

Disk Configuration

fdisk /dev/sda
fdisk /dev/sdb

We need to make this partition bootable. Type 'a' to toggle the bootable flag on this partition. If you press p again, you will notice that an * is placed in the "Boot" column. To save the partition layout and exit fdisk, type 'w'.

Command (m for help): p

Disk /dev/sda: 36.7 GB, 36703934464 bytes
255 heads, 63 sectors/track, 4462 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/sda1   *         1       200   1606468+  83  Linux
/dev/sda2           201      1024   6618780   82  Linux swap
/dev/sda3          1025      4462  27615735   83  Linux

Create EXT3 Filesystems

mke2fs -j /dev/sda1
mke2fs -j /dev/sda3
mke2fs -j /dev/sdb1

Activate the Swap Partition

mkswap /dev/sda2
swapon /dev/sda2

Mount the Partitions

mount /dev/sda3 /mnt/gentoo
mkdir /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot
mkdir /mnt/gentoo/proc
mount -t proc none /mnt/gentoo/proc

mkdir /mnt/gentoo/u01
mount /dev/sdb1 /mnt/gentoo/u01

Using Stage 3 from the LiveCD

cd /mnt/gentoo
ls /mnt/cdrom/stages
tar -xvjpf /mnt/cdrom/stages/stage3-<subarch>-2005.1.tar.bz2

Installing a Portage Snapshot and Source Code from LiveCD

ls /mnt/cdrom/snapshot
cd /mnt/gentoo
tar -xvjf /mnt/cdrom/snapshot/portage-<date>.tar.bz2 -C /mnt/gentoo/usr

Copy Source Code Archives

mkdir -p /mnt/gentoo/usr/portage/distfiles
cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/

Configuring the Compile Options

To optimize Gentoo, you can set a couple of variables which impact Portage behaviour. All those variables can be set as environment variables (using export) but that isn't permanent. To keep your settings, Portage provides you with /etc/make.conf, a configuration file for Portage. It is this file we will edit now.

nano -w /mnt/gentoo/etc/make.conf

USE="apache2 berkdb -canna -cdr -cjk -bonobo -dvd -dvdr readline imap
     java qt kde ldap maildir ssl mbox mysql pam perl sasl zlib
     X -arts -nas -esd -arts -gtk -gnome -alsa"

CHOST="i686-pc-linux-gnu"

Chrooting

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

Chrooting is done in three steps. First we will change the root from / (on the installation medium) to /mnt/gentoo (on your partitions) using chroot. Then we will create a new environment using env-update, which essentially creates environment variables. Finally, we load those variables into memory using source.

chroot /mnt/gentoo /bin/bash
env-update
source /etc/profile

Create an Optimized Kernel

Manually configuring a kernel is often seen as the most difficult procedure a Linux user ever has to perform. Nothing is less true -- after configuring a couple of kernels you don't even remember that it was difficult ;)

cd /etc
ln -sf /usr/share/zoneinfo/Europe/Zurich /etc/localtime

However, one thing is true: you must know your system when you start configuring a kernel manually. Most information can be gathered by viewing the contents of /proc/pci (or by using lspci if available). You can also run lsmod to see what kernel modules the Installation CD uses (it might provide you with a nice hint on what to enable).

cd /usr/src
emerge gentoo-sources
ls -l /usr/src/linux

cd /usr/src/linux
make menuconfig
make
make modules_install
cp System.map /boot/System.map-2.6.12-Akadia
cp arch/i386/boot/bzImage /boot/kernel-2.6.12-Akadia
cp .config /boot/
kernel-2.6.12-Akadia.cfg

cd /boot
ls -l

lrwxrwxrwx  1 root root       1 Sep  2 18:07 boot -> ./
drwxr-xr-x  2 root root    1024 Sep  2 23:14 grub/
-rw-r--r--  1 root root 1582003 Sep  3 11:31 kernel-2.6.12-Akadia
-rw-r--r--  1 root root   31989 Sep  3 11:52 kernel-2.6.12-Akadia.cfg
-rw-r--r--  1 root root   37800 Sep  2 18:29 kernel-2.6.12-CDROM.cfg
drwx------  2 root root   12288 Sep  1 20:11 lost+found/
lrwxrwxrwx  1 root root      24 Sep  2 23:16 System.map -> System.map-2.6.12-Akadia
-rw-r--r--  1 root root  765778 Sep  3 11:31 System.map-2.6.12-Akadia

Installing Extra Modules

Linux Base Driver for the Intel(R) PRO/1000 Family of Adapters (e1000)

Download the latest source from:

http://smokeping.planetmirror.com/pub/intel/drivers/linux/e1000/

1. Move the base driver tar file to the directory of your choice.
   /usr/local/src/e1000.

2. Untar/unzip archive:

   tar zxf e1000-5.7.6.tar.gz

3. Change to the driver src directory:

   cd e1000-5.7.6/src/

4. Compile the driver module:

   make
  
make install


   The binary will be installed as:

   /lib/modules/<KERNEL VERSION>/kernel/drivers/net/e1000/e1000.[k]o

You should list the modules you want automatically loaded in /etc/modules.autoload.d/kernel-2.6.

find /lib/modules/2.6.11-gentoo-r3 -type f -iname '*.o' -or -iname '*.ko'
cd /etc/modules.autoload.d
nano -w kernel-2.6
e1000

Filesystem Information

cd /etc
cp fstab fstab.orig
nano -w /etc/fstab

/dev/sda3               /               ext3            defaults        1 1
/dev/sda1               /boot           ext3            defaults        1 2
/dev/sda2               swap            swap            defaults        0 0
/dev/sdb1               /u01            ext3            defaults        1 3
/dev/cdroms/cdrom0      /mnt/cdrom      iso9660         noauto,ro       0 0
/dev/fd0                /mnt/floppy     auto            noauto          0 0
none                    /var/tempfs     tmpfs           defaults        0 0
shm                     /dev/shm        tmpfs   nodev,nosuid,noexec     0 0

Hostname, Domainname

Setup Hostname in /etc/conf.d/hostname

HOSTNAME="quasar"

Setup the DNS Domainname in /etc/conf.d/domainname

DNSDOMAIN="hsz.akadia.com"

Networking

nano -w /etc/conf.d/net

config_eth0=( "192.168.138.111 netmask 255.255.255.0 broadcast 192.168.138.255" )
config_eth1=( "192.168.138.112 netmask 255.255.255.0 broadcast 192.168.138.255" )
routes_eth0=( "default via 192.168.138.1" )

rc-update add net.eth0 default

If you have several network interfaces, you need to create the appropriate net.eth1, net.eth2 etc. initscripts for those. You can use ln to do this:

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

Swiss German Keyboard

Setup Keyboard in /etc/conf.d/keymaps

KEYMAP="sg-latin1"

Setup Symblic Link for i386 Libs

cd /usr/lib/gcc-lib
ln -s i686-pc-linux-gnu i386-pc-linux-gnu

lrwxrwxrwx 1 root root 17 Sep 19 10:38 i386-pc-linux-gnu -> i686-pc-linux-gnu/
drwxr-xr-x 3 root root 4096 Jul 30 13:53 i686-pc-linux-gnu/

System Tools

emerge sysklogd 1>/u01/emerge-sysklogd.log 2>&1
rc-update add sysklogd default


emerge vixie-cron 1>/u01/emerge-vixie-cron.log 2>&1
rc-update add vixie-cron default

Bootloader

emerge --usepkg grub
grub
Probing devices to guess BIOS drives. This may take a long time.

grub> root (hd0,0)
Filesystem type is ext2fs, partition type 0x83

grub> setup (hd0)
Checking if "/boot/grub/stage1" exists... yes
Checking if "/boot/grub/stage2" exists... yes
Checking if "/boot/grub/e2fs_stage1_5" exists... yes
Running "embed /boot/grub/e2fs_stage1_5 (hd0)"... 22 sectors are embedded.
succeeded
Running "install /boot/grub/stage1 (hd0) (hd0)1+22 p (hd0,0)/boot/grub/stage2 /boot/grub/menu.lst"... succeeded
Done.

grub> quit

cd /boot/grub
cat grub.con

default 0
timeout 30
splashimage=(hd0,0)/grub/splash.xpm.gz

title=Gentoo Linux 2.6.12
root (hd0,0)
kernel /kernel-2.6.12-Akadia root=/dev/sda3

Password for Root

passwd root

Reboot !

Install precompiled packages from CD-ROM 2 (packages-x86-2005.1.iso)

The second CD only contains precompiled packages and can be used to install software after a succesfull Gentoo Installation. To install Gentoo, you only need CD-1, but if you want OpenOffice.org, Mozilla, KDE, GNOME etc. without having to compile every single one of them, you need CD-2 too.

mkdir -p /usr/portage/packages/All
mount /mnt/cdrom
cd /mnt/cdrom/All
cp * /usr/portage/packages/All

Copy the file my_installed_packages to /root

Install the Packages

cd /usr/portage/packages/All
for i in `cat /root/my_installed_packages.txt`
do
  emerge --usepkg $i 1>/u01/emerge-$i.log 2>&1
done


env-update && source /etc/profile

Additional Tools (not on CD-ROM 1 or 2)

emerge ntp 1>/u01/emerge-ntpd.log 2>&1
Edit /etc/ntp.conf, /etc/conf.d/ntpd
rc-update add ntpd default

emerge telnet-bsd 1>emerge-telnet 2>&1
emerge bind 1>emerge-bind.log 2>&1
emerge bind-tools 1>emerge-bind-tools.log 2>&1
emerge mailx 1>emerge-mailx.log 2>&1
emerge samba 1>emerge-samba.log 2>&1
emerge vacation 1>emerge-vacation.log 2>&1

Installing X

The configuration file of Xorg is called xorg.conf and it resides in /etc/X11. The Xorg-X11 package provides an example configuration as /etc/X11/xorg.conf.example which you can use to create your own configuration.

Generating an xorg.conf file

Xorg -configure

Be sure to read the last lines printed on your screen when Xorg has finished probing your hardware. If it tells you it failed at some point, you're forced to manually write an xorg.conf file. Assuming that it didn't fail, it will have told you that it has written /root/xorg.conf.new ready for you to test.

Testing the xorg.conf.new file

X -config /root/xorg.conf.new

Installing KDE or Gnome

Edit /etc/rc.conf
# KDE
DISPLAYMANAGER="kdm"
XSESSION="kde-3.1.3"
# Gnome
DISPLAYMANAGER="gdm"
XSESSION="gnome"

Installing KDE login manager

rc-update add xdm default

Courier IMAP 

emerge courier-imap 1>emerge-courier-imap.log 2>&1
rc-update add courier-imapd default

cd /etc/courier-imap
vi imapd

==> ADDRESS=0
==> MAXDAEMONS=200
==> MAXPERIP=10
==> MAILDIR=Maildir


cd /etc/courier/authlib
vi autsdaemonrc
==>
authmodulelist="authpam authshadow"
==> daemons=1
==> DEBUG_LOGIN=0

To avoid repeated messages in syslog: "Failed to create cache file: maildirwatch (user) Error: Input/output error" you msut start the File Access Monitor daemon (famd). Courier was compiled with File Alteration Monitor (FAM), but FAM is not running, or is not configured. If you have FAM installed you can add it to a runlevel and start it. Some FAM configuration use portmapper, so you will need to have portmap running also.

rc-update add famd default

Squirrelmail

See INSTALL file in install directory!

  • Install webserver and PHP4 (at least 4.0.6).
  • Install IMAP server (see docs of that server).
  • Unpack the SquirrelMail package in a web-accessible location.
  • Select a data-dir and attachment dir, outside the webtree (e.g. in /var).
    The data-dir (for user prefs) should be owned by the user the webserver
    runs as (eg www-data). The attachment dir (for uploading files as
    attachments) should be file mode 0730 and in the same group as the
    webserver.
  • Run config/conf.pl from the command line. Use the D option to load
    predefined options for specific IMAP servers, and edit at least the
    Server Settings and General Options (datadir).

Download squirrelmail from http://www.squirrelmail.org/

cd /u01
tar xzvf squirrelmail-1.4.3a.tar.gz
ln -s squirrelmail-1.4.3a.tar webmail
cd webmail/config
perl ./conf.pl

Change your Organization, Server, and Folder settings for squirrelmail.
Now you should be able to login to squirrelmail, again - with your full email address,
and use your new webmail setup.

<?php

/**
 * SquirrelMail Configuration File
 * Created using the configure script, conf.pl
 */

global $version;
$config_version = '1.4.3';
$config_use_color = 2;

$org_name      = "";
$org_logo      = SM_PATH . 'images/sm_logo.png';
$org_logo_width  = '308';
$org_logo_height = '111';
$org_title     = "Akadia Webmail (SquirrelMail) $version";

$signout_page  = '';
$frame_top     = '_top';

$provider_uri     = 'https://www.akadia.com';
$provider_name     = 'Akadia';


$motd = "";

$squirrelmail_default_language = 'en_US';

$domain                 = 'akadia.com';
$imapServerAddress      = '192.168.136.200';
$imapPort               = 143;
$useSendmail            = false;
$smtpServerAddress      = '192.168.136.200';
$smtpPort               = 25;
$sendmail_path          = '/usr/sbin/sendmail';
$pop_before_smtp        = false;
$imap_server_type       = 'courier';
$invert_time            = false;
$optional_delimiter     = '.';

$default_folder_prefix          = '';
$trash_folder                   = 'INBOX.Trash';
$sent_folder                    = 'INBOX.Sent';
$draft_folder                   = 'INBOX.Drafts';
$default_move_to_trash          = true;
$default_move_to_sent           = true;
$default_save_as_draft          = true;
$show_prefix_option             = false;
$list_special_folders_first     = true;
$use_special_folder_color       = true;
$auto_expunge                   = true;
$default_sub_of_inbox           = true;
$show_contain_subfolders_option = false;
$default_unseen_notify          = 2;
$default_unseen_type            = 1;
$auto_create_special            = true;
$delete_folder                  = false;
$noselect_fix_enable            = false;

$default_charset          = 'iso-8859-1';
$data_dir                 = SM_PATH . 'data/';
$attachment_dir           = $data_dir;

$dir_hash_level           = 0;
$default_left_size        = '150';
$force_username_lowercase = false;
$default_use_priority     = true;
$hide_sm_attributions     = true;
$default_use_mdn          = true;
$edit_identity            = true;
$edit_name                = true;
$allow_thread_sort        = false;
$allow_server_sort        = false;
$allow_charset_search     = true;
$uid_support              = true;

$theme_css = 'https://www.akadia.com/docroot/css/website.css';
$theme_default = 0;
$theme[0]['PATH'] = SM_PATH . 'themes/default_theme.php';
$theme[0]['NAME'] = 'Default';
$theme[1]['PATH'] = SM_PATH . 'themes/plain_blue_theme.php';
$theme[1]['NAME'] = 'Plain Blue';
$theme[2]['PATH'] = SM_PATH . 'themes/sandstorm_theme.php';
$theme[2]['NAME'] = 'Sand Storm';
$theme[3]['PATH'] = SM_PATH . 'themes/deepocean_theme.php';
$theme[3]['NAME'] = 'Deep Ocean';
$theme[4]['PATH'] = SM_PATH . 'themes/slashdot_theme.php';
$theme[4]['NAME'] = 'Slashdot';
$theme[5]['PATH'] = SM_PATH . 'themes/purple_theme.php';
$theme[5]['NAME'] = 'Purple';
$theme[6]['PATH'] = SM_PATH . 'themes/forest_theme.php';
$theme[6]['NAME'] = 'Forest';
$theme[7]['PATH'] = SM_PATH . 'themes/ice_theme.php';
$theme[7]['NAME'] = 'Ice';
$theme[8]['PATH'] = SM_PATH . 'themes/seaspray_theme.php';
$theme[8]['NAME'] = 'Sea Spray';
$theme[9]['PATH'] = SM_PATH . 'themes/bluesteel_theme.php';
$theme[9]['NAME'] = 'Blue Steel';
$theme[10]['PATH'] = SM_PATH . 'themes/dark_grey_theme.php';
$theme[10]['NAME'] = 'Dark Grey';
$theme[11]['PATH'] = SM_PATH . 'themes/high_contrast_theme.php';
$theme[11]['NAME'] = 'High Contrast';
$theme[12]['PATH'] = SM_PATH . 'themes/black_bean_burrito_theme.php';
$theme[12]['NAME'] = 'Black Bean Burrito';
$theme[13]['PATH'] = SM_PATH . 'themes/servery_theme.php';
$theme[13]['NAME'] = 'Servery';
$theme[14]['PATH'] = SM_PATH . 'themes/maize_theme.php';
$theme[14]['NAME'] = 'Maize';
$theme[15]['PATH'] = SM_PATH . 'themes/bluesnews_theme.php';
$theme[15]['NAME'] = 'BluesNews';
$theme[16]['PATH'] = SM_PATH . 'themes/deepocean2_theme.php';
$theme[16]['NAME'] = 'Deep Ocean 2';
$theme[17]['PATH'] = SM_PATH . 'themes/blue_grey_theme.php';
$theme[17]['NAME'] = 'Blue Grey';
$theme[18]['PATH'] = SM_PATH . 'themes/dompie_theme.php';
$theme[18]['NAME'] = 'Dompie';
$theme[19]['PATH'] = SM_PATH . 'themes/methodical_theme.php';
$theme[19]['NAME'] = 'Methodical';
$theme[20]['PATH'] = SM_PATH . 'themes/greenhouse_effect.php';
$theme[20]['NAME'] = 'Greenhouse Effect (Changes)';
$theme[21]['PATH'] = SM_PATH . 'themes/in_the_pink.php';
$theme[21]['NAME'] = 'In The Pink (Changes)';
$theme[22]['PATH'] = SM_PATH . 'themes/kind_of_blue.php';
$theme[22]['NAME'] = 'Kind of Blue (Changes)';
$theme[23]['PATH'] = SM_PATH . 'themes/monostochastic.php';
$theme[23]['NAME'] = 'Monostochastic (Changes)';
$theme[24]['PATH'] = SM_PATH . 'themes/shades_of_grey.php';
$theme[24]['NAME'] = 'Shades of Grey (Changes)';
$theme[25]['PATH'] = SM_PATH . 'themes/spice_of_life.php';
$theme[25]['NAME'] = 'Spice of Life (Changes)';
$theme[26]['PATH'] = SM_PATH . 'themes/spice_of_life_lite.php';
$theme[26]['NAME'] = 'Spice of Life - Lite (Changes)';
$theme[27]['PATH'] = SM_PATH . 'themes/spice_of_life_dark.php';
$theme[27]['NAME'] = 'Spice of Life - Dark (Changes)';
$theme[28]['PATH'] = SM_PATH . 'themes/christmas.php';
$theme[28]['NAME'] = 'Holiday - Christmas';
$theme[29]['PATH'] = SM_PATH . 'themes/darkness.php';
$theme[29]['NAME'] = 'Darkness (Changes)';
$theme[30]['PATH'] = SM_PATH . 'themes/random.php';
$theme[30]['NAME'] = 'Random (Changes every login)';
$theme[31]['PATH'] = SM_PATH . 'themes/midnight.php';
$theme[31]['NAME'] = 'Midnight';
$theme[32]['PATH'] = SM_PATH . 'themes/alien_glow.php';
$theme[32]['NAME'] = 'Alien Glow';
$theme[33]['PATH'] = SM_PATH . 'themes/dark_green.php';
$theme[33]['NAME'] = 'Dark Green';
$theme[34]['PATH'] = SM_PATH . 'themes/penguin.php';
$theme[34]['NAME'] = 'Penguin';
$theme[35]['PATH'] = SM_PATH . 'themes/minimal_bw.php';
$theme[35]['NAME'] = 'Minimal BW';

$default_use_javascript_addr_book = false;
$addrbook_dsn = '';
$addrbook_table = 'address';

$prefs_dsn = '';
$prefs_table = 'userprefs';
$prefs_user_field = 'user';
$prefs_key_field = 'prefkey';
$prefs_val_field = 'prefval';
$no_list_for_subscribe = false;
$smtp_auth_mech = 'none';
$imap_auth_mech = 'login';
$use_imap_tls = false;
$use_smtp_tls = false;
$session_name = 'SQMSESSID';

@include SM_PATH . 'config/config_local.php';

/**
 * Make sure there are no characters after the PHP closing
 * tag below (including newline characters and whitespace).
 * Otherwise, that character will cause the headers to be
 * sent and regular output to begin, which will majorly screw
 * things up when we try to send more headers later.
 */
?>

cd /u01/webmail
chown -R apache:apache data

cd /u01/webmail/images
==> Create your own sm_logo.png

cd /u01/webmail/src
==> Edit: login.php for your needs

cd /etc/apache2/conf/
==> Edit commonapache2.conf

### Common server configuration.
###

User apache
Group apache


###
### ServerAdmin: Your address, where problems with the server should be
### e-mailed. This address appears on some server-generated pages, such
### as error documents.
###

ServerAdmin martin dot zahn at akadia dot ch

###
### DocumentRoot: The directory out of which you will serve your
### documents. By default, all requests are taken from this directory, but
### symbolic links and aliases may be used to point to other locations.
### DO NOT MODIFY THIS ONE, USE apache2.conf.
###
#DocumentRoot /u01/httpd/htdocs

DocumentRoot /u01/webmail

Test-it: http://192.168.136.200

Enable SU (Switching to Superuser)

Add User to Group wheel in /etc/group
wheel::10:root,zahn,gaechter,kse,dubuis,egli,zenger

Networking

Searching for provided Network Modules
ls /lib/modules/`uname -r`/kernel/drivers/net

Loading the desired Module
modprobe e1000

Add Static Routes in /etc/conf.d/local.start
route add -net 193.247.121.192/28 gw 192.168.138.1 eth0
route add -net 217.193.130.248/29 gw 192.168.138.5 eth0

Setup eth0 interface with IP and Gateway
ifconfig eth0 192.168.138.35 broadcast 192.168.138.255 netmask 255.255.255.0 up
route add default gw 192.168.138.1

Setup Host using DPCP in /etc/conf.d/net
iface_eth0="dhcp"

Disklables

Once you have created and formated a partition, you should assign it a label using the e2label command. This allows you to add the partition to /etc/fstab using a label instead of using a device path. If there are partitions whose label you are unsure of, type the following command:

/sbin/tune2fs -l /dev/sda1 | grep volume
Filesystem volume name: /boot

Label the Partition
/sbin/e2label /dev/sda1 /boot

Once you have assigned each partition a label, add the partitions to /etc/fstab.
LABEL=/boot /boot ext3 defaults 1 2

Filesystem Creation

ext2: mke2fs /dev/sda3
ext3: mke2fs -j /dev/sda3
reiserfs: mkreiserfs /dev/sda3

Activating the Swap Partition

mkswap /dev/sda2
swapon /dev/sda2

USE flags

Allows the user complete control over what kinds of features and support are built in to the installed applications.Do not having install things which you do not really need. And how, exactly, does Gentoo achieve this? By defining USE settings. Essentially, these are keywords that define options used on a system-wide basis to configure applications during their compilation procedures.

A list of available global USE-flags can be found in /usr/portage/profiles/use.desc

Declare permanent USE-flags

Defaults in: /etc/make.profile/make.defaults
Setting your own USE flags in: /etc/make.conf

Check current USE Flags:

emerge info
USE="x86 oss apm avi crypt cups encode foomaticdb gif jpeg libg++ mad
mikmod mmx mpeg ncurses nls pdflib png quicktime ...

Viewing the used USE-flags for a certain Package

emerge --pretend --verbose apache
Calculating dependencies ...done!
[ebuild R ] net-www/apache-2.0.47 +berkdb +gdbm +ldap

Gentoo query package tool  (qpkg)

The qpkg utlity is part of the Gentoo's Gentoolkit administration scripts. qpkg allows you to manage the packages installed on your box.

Installation of qpkg

emerge gentoolkit

Examples

Show me all installed packages and its versions:
qpkg -I -v

Show me all uninstalled packages and its versions:
qpkg -U -v

Show me installed packages belonging to category net-misc:
qpkg -I -v -g net-misc

Give me some descriptive information related to the package snort:
qpkg -i snort

Show me all packages belonging to category net-misc, note that packages marked with an "*" denote installed packages:
qpkg -g net-misc

List the content of a given package:
qpkg -l snort

Let me know what package netstat belongs to, note that for this to work you must provide the full path to the file you are interested on, hence which netstat.:
qpkg -f `which netstat`

Show me duplicate packages on my box and some extra info:
qpkg -d -vv

Let me know what packages depend on, say, mysql:
qpkg -q mysql

Verify mysql and do not hesitate to show verbose info:
qpkg -c -v mysql

Environment Variables

The /etc/env.d Directory

To centralise the definitions of environment variables, Gentoo introduced the /etc/env.d directory. Inside this directory you will find a number of files, such as 00basic, 05gcc, etc. which contain the variables needed by the application mentioned in their name.

The env-update Script

Several files in /etc/env.d define the PATH variable. This is not wrong: when you run env-update, it will append the several definitions before it updates the environment variables, thereby making it easy for packages (or users) to add their own environment variable settings without interfering with the already existing values. The env-update script will append the values in the alphabetical order of the /etc/env.d files. This is why many of the files in /etc/env.d begin with a number When you run env-update, the script will create all environment variables and place them in /etc/profile.env (which is used by /etc/profile). It will also extract the information from the LDPATH variable and use that to create /etc/ld.so.conf. After this, it will run ldconfig to recreate the /etc/ld.so.cache file used by the dynamical linker. If you want to notice the effect of env-update immediately after you run it, execute the following command to update your environment.

Updating the environment

env-update && source /etc/profile

Resolving package conflicts  

Imagine this situation when you try to emerge a package:

     emerge xfree

     Calculating dependencies ...done!

     !!! Error: the x11-libs/xft package conflicts with another package.
     !!!        both can't be installed on the same system together.
     !!!        Please use 'emerge --pretend' to determine blockers.

Okay, here is the problem: we can't emerge xfree because there is a conflict with the xft (installed) package. Let's try to resolve the conflict.

     emerge -p xfree

     These are the packages that I would merge, in order:

     Calculating dependencies ...done!
     [blocks B     ] x11-libs/xft (from pkg x11-base/xfree-4.3.0-r3)
     [ebuild  N    ] x11-base/xfree-4.3.0-r3
     [ebuild     U ] x11-libs/xft-2.0.1-r2 [2.0.1]

As you can see xft is blocking xfree as [blocks B ] points.

From emerge man pages:

     Blockers are defined when two packages will clobber each others files, or  otherwise
     cause some form of breakage in your system.  However, blockers usually do not need
     to be simultaneously emerged because they usually provide the same functionality.

So to resolve the conflict proceed as follows:

     emerge unmerge xft

And there should be no blocking package now...

     emerge -p xfree

These are the packages that I would merge, in order:

     Calculating dependencies ...done!
     [ebuild  N    ] x11-base/xfree-4.3.0-r3

Now proceed as usual...

     emerge xfr