Contents

Overview

History

Differences

The Portage System

Installation

Pros and Cons

Resources

Overview

Gentoo is the name of a large PENGUIN.

Gentoo Linux is an install-from-source distribution that allows for continuous updates by means of an advanced package control system called Portage.”

“Gentoo Linux is suitable for secure servers, desktop and development workstations, gaming systems, embeddeded systems, etc.”

Gentoo Features

x86, PowerPC, UltraSparc, Alpha, HPPA, AMD64, IA64 processors

LiveCD installation for x86 and PowerPC

Latest stable KDE and Gnome

Various optimized Linux kernels

Very modern GNU development environment

File Systems: ext2, ext3, reiserfs, xfs, jfs, evms, lvm(2)

Hardware: Nvidia, ATI, Creative Labs Live!, and Audigy

Gentoo Features

Modular OpenGL and compiler substem (supports multiple co-existing versions)

Clean, dependancy- based system initialization scripts

“Hardened” Gentoo security initiative

6000+ packages of the latest and greatest software

Enhanced Portage capabilities

Gentoo History

Created by Daniel Robbins and a helper prior to 2000.

Based on his experiences with Stampede Linux and FreeBSD.

Portage system (python) based on the FreeBSD ports concept.

Now there are several hundred developers and several thousand users world wide.

Gentoo differences

Almost everything from the initial install onwards is based on the standard source tarballs maintained by the package developers.

No required system releases. The system is continuously upgraded with passage of time.

Gentoo releases are primarily asociated with the LiveCD that is used as an alternative installation method.

Gentoo Differences

The Portage package management system is used for installing/upgrading the system. RPM, etc. may be used at user discretion.

The boot scripts are a dependancy-based system unique to Gentoo.

Gentoo does not strive to be 100% LSB compliant.

Gentoo Differences

Gentoo by default uses devfs for device names rather than hardcoded /dev/xxx names.

You may optionally use udev or static /dev/xxx names.

Gentoo Directories Layout

Gentoo mostly follows the directory layoyut recommended by the LSB, but there are a few differences.

All software packages distributed in source are installed under the /usr structure.

Gentoo does not install anything in /usr/local

Packages distributed in binary form are installed under the /opt structure.

Gentoo Directories Layout

Gentoo creates non-LSB-compliant /usr/xxx directories to allow multiple versions of large packages such as kde and gnome.

Other distributions delegate such packages to
/opt to sneak around the LSB restriction, but Gentoo uses /opt only for binary packages..

/usr/portage (the portage Package Tree) is probably also a violation.

The Portage Tree

/usr/portage, the Portage Tree, contains con-trol information and package specifications (ebuilds) for available packages.

The Portage Tree is updated via rsync (or via a web procedure if rsync cannot be used) from a mirrored central repository

/usr/portage/distfiles contains tarballs (.bz2 format) that have been downloaded. These tarballs can be deleted to recover space.

The Portage Tree

/usr/portage/profiles contains defaults for package installation.

Packages are divided into categories, and a directory exists for each specific package.

For example, the ebuilds for each version of vim are stored as depicted by the following slide:

Sample Portage Tree - vim

/usr/portage/app-editors/vim/
ChangeLog	vim-6.2-r1.ebuild	vim-6.2-r5.ebuild
Manifest	vim-6.2-r2.ebuild	vim-6.2-r6.ebuild
files	vim-6.2-r3.ebuild	vim-6.2
metadata	vim-6.2-r4.ebuild

Portage: Installed Packages

/var contains the installed packages database and workareas for Portage.

/var/cache/edb contains control information about installed packages.

/var/log/portage (optional) contains log files.

/var/tmp is the package installation workarea.

/var/db/pkg contains a copy of the ebuild for each installed package.

Portage: Installed Packages

As with the Portage Tree, packages are organized by category, and a directory in
/var/db/pkg is created for each package.

Portage: Installed Packages

Example : /var/db/pkg/app-editors/vim-6.2-r5
CATEGORY	CONTENTS	LICENSE	USE
CBUILD	COUNTER	PDEPEND	environment.bz2
CC	CXX	PF	vim-6.2-r5.ebuild
CDEPEND	CXXFLAGS	PROVIDE
CFLAGS	DEPEND	RDEPEND
CHOST	RDEPEND	SLOT

The ebuild or package definition

The specifications for each package version are stored in a text file named as follows:
packagename-version[-increment].ebuild
vim-6.2-r5.ebuild

An ebuild is a structured script which lets the package installer how to install and maintain the package.

Sample ebuild

# Copyright 1999-2003 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General\
Public License v2
#$Header: /home/cvsroot/gentoo-x86/app-editors/beaver/beaver\
-0.2.6.ebuild,v 1.2 2003/06/29 18:24:08 aliz Exp $
S=${WORKDIR}/${P}L
LICENSE="GPL-2"
KEYWORDS="x86 ~ppc"
SLOT="0"
DESCRIPTION="An Early AdVanced EditoR"
SRC_URI="http://eturquin.free.fr/beaver/dloads/${P}.tar.gz"
HOMEPAGE="http://eturquin.free.fr/beaver/index.htm"

Sample ebuild

DEPEND="=x11-libs/gtk+-1.2*"
src_compile() {
cd ${S}/src
emake OPTI="${CFLAGS}" || die
}
src_install() {
cd src
make DESTDIR=${D}/usr \
MANDIR=/share/man \
install || die
}

The emerge Program

emerge is the principal tool for maintenance of the portage system.

emerge is written mostly in python.

A verson of emerge has been released for use on non-gentoo systems (esp. Slackware). The unfortunate name of this package is emerde.

/usr/portage/profiles contains the default options for emerge.

The emerge Program

/etc/make.conf contains the local options for emerge

/usr/portage/profiles/package.mask contains a list of packages that are masked, i.e. in error.

Many packages are configurable to make use of other installed packages. To allow for auto-mated configuration of such packages, portage makes use of USE variables (more later).

The emerge Program

Local versions of
/usr/portage/profiles/package.mask, etc., may be recorded in
/etc/portage/package.mask, etc.

The local versions may be used to enable automatic selection of a testing version or to unmask a package (I know what I'm doing).

The emerge Program

Emerge recognizes stable and testing status for packages. This is accomplished by means of the architecture name, i.e.
x86	- stable version for x86 architecture
~x86 – testing version for x86 architecture

Basic command format is
emerge <options> pkgename

emerge Examples

emerge [-pv] python
Install the most current stable and unmasked version of this package. “p” means pretend. “v” means list USE variables recognized by the pacakge and download size.
[ebuild R ] dev-lang/python-2.3.3 +berkdb -bootstrap -build -doc +gdbm -ipv6 +ncurses +readline +ssl +tcltk -ucs2 7,026 kB

emerge Samples

emerge [-pv] app-editors/vim-6.2-r5
Install a specific version of the package.

emerge [-pv] system
Install all the base “system” components.

emerge Samples

emerge [-p[uU]v] world
Update packages with new unmasked versions. “p' is pretend. “u” is update or downgrade. “U” is upgrade but no downgrades. “v” is verbose.
Sample output on the following slide.

emerge Samples

calculating world dependencies ...done!
[ebuild U ] sys-kernel/linux-headers-2.4.21 [2.4.19-r1] -build \
27,864 kB
[ebuild U ] sys-libs/glibc-2.3.2-r9 [2.3.2-r3] -build +nls -nptl \
-pic 14,946 kB
[ebuild U ] sys-devel/gcc-3.3.2-r5 [3.2.3-r3] +X -bootstrap \
-build +java -multilib +nls -static 23,451 kB
[ebuild UD] app-text/libwpd-0.5.0 [0.7.1] 212 kB
[ebuild N ] dev-perl/Crypt-SSLeay-0.49 114 kB \
3,122 kB

The emerge Program

Emerge sync
Synchronize and update the portage tree using rsync.

USE=”kde qt jpeg” emerge <pkgname>
Configure and emerge <pkgname> with the optional support for kde, qt, and jpeg.

The emerge Program

USE=”-qt” emerge <pkgname>
Configure and emerge <pkgname> without the optional support for qt.

ACCEPT_KEYWORDS=”~x86” emerge <pkgname>
Emerge the most current version (include testing) version of <pkgname>.

The emerge program

emerge -b <pkgname>

compile and generate binary package in /usr/portage/packages for installation later.

emerge -k <pkgname>

install a binary package that you previously created with the -b option. Also used to install pre-generated packages during initial installation.

Flow of emerge Processing

Recursively check to see if the package is masked (marked in error in
/usr/portage/profiles/package.mask)

Recursively check any pre /correquisites and expand the emerge to include these if not installed.

If tarball is not in /usr/portage/distfiles, download from a source mirror site.

The emerge Program

If logging enabled, the portage log file will be updated at each step of the emerge.

Check the md5sum for the package (fail if mismatch) and unpack it.

Perform configuration based on USE variables

Perform compiles and links to a work area

Store information for removing the package

The emerge Program

Install the package into real ( /usr /opt) libraries or store in /usr/portage/packages
(-b option). Quit here if -b.

If this is a new version and same slot, remove the prior version.

Copy the ebuild to /var/db/pkg and update the installed database as appropriate.

Other Portage utilities

Tools provided by package gentoolkit.

qpkg – query the available/installed packages and search for packages that provide a file (or file pattern).

etcat – similar to qpkg.

webrsync – perform the equivalent of emerge sync for users behind a restrictive firewall.

Other Portage Utilities

etc-update

When emerge updates a configuration file (/etc, certain KDE and gnome libraries, etc.), the updates are made to a temporary file, and the etc-update procedure must be run to perform (merge) the actual updates.

rc-update

Used to update the runscripts that are run automatically when the system is booted.

Other Gentoo Utilities

modules_update

Update the modules and autoload files to be used at boot time.

opengl_update

Used to set the appropriate symlinks for the opengl libraries to be used by X (xfree, xorg-x11, nvidia, ati)

Gentoo Installation

At present the process is well documented but totally manual.

Automated procedures are being developed.

Gentoo requires a driving linux system for installation.

You may use a Gentoo LiveCD, Knoppix, most any modern linux distro, net booting, or (perhaps) a floppy linux system (chroot req'd).

Gentoo Installation

Whatever driving system method you choose, you must download from the net or from CDs (you can order a set) one or more tarballs that contain the basic system structure.

You may download a Stage1, Stage2, or Stage3 tarball and (optionally) a snapshot of the /usr structure and/or a set of pre-compiled binaries (GRP).

Gentoo Installation

At present, the execution of the installation steps is a manual procedure, but several projects are underway to automate the process.

In any case, you only need to suffer through this once.

Preparing for Installation

You must prepare at least one empty partition >= 3G in size and format it for your desired filesystem type (your driving system must support this type.

You may also prepare separate partitions for
/boot, /home, /var, etc. if you prefer.

I prefer a single / partion about 8-10G and a /home partition. YMMV.

Preparing for Installation

Unless you have everything on CD you must setup communications and copy your
/etc/resolv.conf to the system you are building.

Next you must untar everything to the system you are building: the Stage 1-2-3 tarball, the snapshot of /usr (optional), the sources to be used (optional), and the pre-compiled packages (optional).

Preparing for Installation

Finally you must configure compiler and make options in /etc/make.conf.

Now you are ready for installation. The following steps may be interrupted after any Stage point and resumed later, if you prefer, starting with mount and chroot each time.

If running from a LiveCD, you may run the mirrorselect program to select a nearby set of mirrors to fetch source tarballs.

Installation Stage1

You must mount the new system (and any additional partitions) under /mnt/gentoo and chroot to that partition. In some situations you must mount bind /proc and /dev.

If you are using a Stage1 tarball, you must run the bootstrap script next to generate a basic compiler/glibc/utilities system for running the remaining stages. This step takes 1-2 hours on my 2.4Gz 256MB system.

Installation Stage 2

If you have a Stage2 tarball, you start here after mount and chroot.

If you do not have the snapshot of /usr, you must next run emerge sync to generate the Portage Tree.

Now you must run emerge system to create the basic system. This step will overlay the software installed by bootstrap. This step takes 2-3 hours on my 2.4Gz 256MB system.

Installation Stage 3

If you have a Stage3 tarball, you start here after mount and chroot.

Now you must setup the timezone, build a kernel, fix /etc/fstab, finalize communication parms, install a system logger, setup a boot loader (unless your system already has one), and add users and passwords. This step takes less than an hour on my 2.4Gz 256MB system

Your base system is ready to boot.

Post Installation

Congratulations, you now have a runnable Gentoo system, but it can't do much yet.

I prefer to continue running from the chroot environment until I have a minimal desktop system with X, a window manager, a browser, and an email facility.

On my 2.4Gz 256MB system, emerging these additional packages including kde or gnome takes an additional 20-30 hours.

Pros

System is easy to tailor for your specific machine.

Large number of available packages.

Multiple architecture support

Large, competent, friendly developer staff

Excellent documentation

Free as in beer

Pros

Portage

Dependancy-based bootscripts

Active and friendly support via forums and mailing lists (multi-language)

Easy to remain current after initial install

Stable or testing (bleeding edge) path

Almost no references to GNU/Linux

Cons

Lengthy, manual initial installation

Not very practical for 56K dialup

“It's different” - no SysV-style bootscripts, etc.

No commercial maintenance and support

Slightly more complex to maintain multiple servers/desktops

Still a “work in progress”

Cons

Not 100% LSB-complient (probably never)

Painfully long compiles for large packages (kde 10+hours, OpenOffice 12+hours, Mozilla several hours, etc.)

Future Direction

Gentoo is now a non-profit organization

Dan Robbins has resigned as chief technical officer. He needs to make a living.

Portage is being redesigned to resolve current known deficiencies (portage-ng)

Gentoo will make the full cutover to 2.6 and udev later this year.

Gentoo-BSD project opened

Future Direction

Automated installation

Many users are expeimenting with x86-64 systems

LiveCD for PPRC64

Resources

The main website with links to everything you need is www.gentoo.org

The philosophy for Gentoo – read what Daniel Robbins is trying to accomplish

Forums and mailing lists – a wealth of information in 13 different languages

Bugzilla – bug reports and proposed fixes

Resources

Documentation of all sorts in multiple languages.

IRC channels – quite active (multiple languages)

Weekly newletter – meet the developers among other things

Online store – gentoo merchandise

My System

gentoo linux (~x86) dual boot with WinXP

kernel 2.6.7-r2

glibc-2.3.3_pre20040420 (nptl)

gcc-3.3.3-r5

xorg-x11-6.7.0

xfce4-4.0.5

openOffice-1.1.1

“That's all Folks”

2004-01-31T17:03:27