Gentoo Logo

Disclaimer : This handbook has been replaced by a newer version and is not maintained anymore.


[ << ] [ < ] [ Home ] [ > ] [ >> ]


5. Installing the Gentoo Installation Files

Content:

5.a. Installing a Stage Tarball

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:

Code Listing 1.1: Verifying the date/time

# date
Fri Mar 29 16:21:18 UTC 2005

If the date/time displayed is wrong, update it using the date MMDDhhmmYYYY syntax (Month, Day, hour, minute and Year). At this stage, you should use UTC time. You will be able to define your timezone later on. For instance, to set the date to March 29th, 16:21 in the year 2005:

Code Listing 1.2: Setting the UTC date/time

# date 032916212005

Locating the Stage3 File

If you have configured networking because you need to download a stage3 file for your architecture, continue with Alternative: Using a Stage3 from the Internet. Otherwise read Default: Using a Stage3 from the Installation CD.

5.b. Default: Using a Stage from the Installation CD

Extracting the Stage Tarball

The stages on the CD reside in the /mnt/cdrom/stages directory. To see a listing of available stages, use ls:

Code Listing 2.1: List all available stages

# ls /mnt/cdrom/stages

If the system replies with an error, you may need to mount the CD-ROM first:

Code Listing 2.2: Mounting the CD-ROM

# ls /mnt/cdrom/stages
ls: /mnt/cdrom/stages: No such file or directory
# mount /dev/cdroms/cdrom0 /mnt/cdrom
# ls /mnt/cdrom/stages

Now go into your Gentoo mountpoint (usually /mnt/gentoo):

Code Listing 2.3: Changing directory to /mnt/gentoo

# cd /mnt/gentoo

We will now extract the stage tarball of your choice. We will do this with the tar tool. Make sure you use the same options (xvjpf)! The x stands for Extract, the v for Verbose to see what happens during the extraction process (this one is optional), the j for Decompress with bzip2, the p for Preserve permissions and the f to denote that we want to extract a file, not standard input. In the next example, we extract the stage tarball stage3-<subarch>-2006.1.tar.bz2. Be sure to substitute the tarball filename with your stage.

Code Listing 2.4: Extracting the stage tarball

# tar xvjpf /mnt/cdrom/stages/stage3-<subarch>-2006.1.tar.bz2

Now that the stage is installed, continue with Installing Portage.

5.c. Alternative: Using a Stage from the Internet

Downloading the Stage Tarball

Go to the Gentoo mountpoint at which you mounted your filesystems (most likely /mnt/gentoo):

Code Listing 3.1: Going to the Gentoo mountpoint

# cd /mnt/gentoo

Depending on your installation medium, you have a couple of tools available to download a stage. If you have links available, then you can immediately surf to the Gentoo mirrorlist and choose a mirror close to you.

If you don't have links available you should have lynx at your disposal. If you need to go through a proxy, export the http_proxy and ftp_proxy variables:

Code Listing 3.2: Setting proxy information for lynx

# export http_proxy="http://proxy.server.com:port"
# export ftp_proxy="http://proxy.server.com:port"

We will now assume that you have links at your disposal.

Pick the releases/ directory, followed by your architecture (for instance x86/) and the Gentoo version (2006.1/) to finish up with the stages/ directory. There you should see all available stage files for your architecture (they might be stored within subdirectories named to the individual subarchitectures). Select one and press D to download. When you're finished, press Q to quit the browser.

Code Listing 3.3: Surfing to the mirror listing with links

# links http://www.gentoo.org/main/en/mirrors.xml

(If you need proxy support with links:)
# links -http-proxy proxy.server.com:8080 http://www.gentoo.org/main/en/mirrors.xml

Make sure you download a stage3 tarball - installations using a stage1 or stage2 tarball are not supported anymore.

If you want to check the integrity of the downloaded stage tarball, use md5sum and compare the output with the MD5 checksum provided on the mirror. For instance, to check the validity of the x86 stage tarball:

Code Listing 3.4: Example checking integrity of a stage tarball

# md5sum -c stage3-x86-2006.1.tar.bz2.DIGESTS
stage3-x86-2006.1.tar.bz2: OK

Unpacking the Stage Tarball

Now unpack your downloaded stage onto your system. We use tar to proceed as it is the easiest method:

Code Listing 3.5: Unpacking the stage

# tar xvjpf stage3-*.tar.bz2

Make sure that you use the same options (xvjpf). The x stands for Extract, the v for Verbose to see what happens during the extraction process (this one is optional), the j for Decompress with bzip2, the p for Preserve permissions and the f to denote that we want to extract a file, not standard input.

Now that the stage is installed, continue with Installing Portage.

5.d. Installing Portage

Unpacking a Portage Snapshot

You now have to install a Portage snapshot, a collection of files that inform Portage what software titles you can install, which profiles are available, etc.

Unpack the Snapshot from the Installation CD

To install the snapshot, take a look inside /mnt/cdrom/snapshots/ to see what snapshot is available:

Code Listing 4.1: Checking the /mnt/cdrom/snapshots content

# ls /mnt/cdrom/snapshots

Now extract the snapshot using the following construct. Again, make sure you use the correct options with tar. Also, the -C is with a capital C, not c. In the next example we use portage-<date>.tar.bz2 as the snapshot filename. Be sure to substitute with the name of the snapshot that is on your Installation CD.

Code Listing 4.2: Extracting a Portage snapshot

# tar xvjf /mnt/cdrom/snapshots/portage-<date>.tar.bz2 -C /mnt/gentoo/usr

Copy Source Code Archives

You also need to copy over all source code from the Universal Installation CD.

Code Listing 4.3: Copy over source code

# mkdir /mnt/gentoo/usr/portage/distfiles
# cp /mnt/cdrom/distfiles/* /mnt/gentoo/usr/portage/distfiles/

5.e. Configuring the Compile Options

Introduction

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.

Note: A commented listing of all possible variables can be found in /mnt/gentoo/etc/make.conf.example. For a successful Gentoo installation you'll only need to set the variables which are mentioned beneath.

Fire up your favorite editor (in this guide we use nano) so we can alter the optimization variables we will discuss hereafter.

Code Listing 5.1: Opening /etc/make.conf

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

As you probably noticed, the make.conf.example file is structured in a generic way: commented lines start with "#", other lines define variables using the VARIABLE="content" syntax. The make.conf file uses the same syntax. Several of those variables are discussed next.

Warning: Do not make any modifications to the USE variable if you are performing a stage3 with GRP installation. You can alter the USE variable after having installed the packages you want. Gremlins are known to attack your system if you ignore this warning!

CHOST

The CHOST variable declares the target build host for your system. This variable should already be set to the correct value. Do not edit it as that might break your system. If the CHOST variable does not look correct to you, you might be using the wrong stage3 tarball.

CFLAGS and CXXFLAGS

The CFLAGS and CXXFLAGS variables define the optimization flags for the gcc C and C++ compiler respectively. Although we define those generally here, you will only have maximum performance if you optimize these flags for each program separately. The reason for this is because every program is different.

In make.conf you should define the optimization flags you think will make your system the most responsive generally. Don't place experimental settings in this variable; too much optimization can make programs behave bad (crash, or even worse, malfunction).

We cannot explain all possible optimization options here, but if you want to investigate them all, read the GNU Online Manual(s) or the gcc info page (info gcc -- only works on a working Linux system). For common optimizations and architecture specific settings, please read /etc/make.conf.example. This file also contains lots of examples and information; don't forget to read it too.

As an example, on the x86 architecture, you will want to set the -march= flag as shown below (for an Athlon XP machine):

Code Listing 5.2: The GCC march setting

-march=athlon-xp

A second one is the -O flag (that is a capital O, not a zero), which specifies the gcc optimization class flag. Possible classes are s (for size-optimized), 0 (zero - for no optimizations), 1, 2 or 3 for more speed-optimization flags (every class has the same flags as the one before, plus some extras). For instance, for a class-2 optimization:

Code Listing 5.3: The GCC O setting

-O2

Another popular optimization flag is -pipe (use pipes rather than temporary files for communication between the various stages of compilation).

Using -fomit-frame-pointer (which doesn't keep the frame pointer in a register for functions that don't need one) might have serious repercussions on the debugging of applications.

When you define the CFLAGS and CXXFLAGS, you should combine several optimization flags, like in the following example:

Code Listing 5.4: Defining the CFLAGS and CXXFLAGS variable

CFLAGS="-march=athlon-xp -pipe -O2"   
CXXFLAGS="${CFLAGS}"                  # Use the same settings for both variables

MAKEOPTS

With MAKEOPTS you define how many parallel compilations should occur when you install a package. A good choice is the number of CPUs in your system plus one, but this guideline isn't always perfect.

Code Listing 5.5: MAKEOPTS for a regular, 1-CPU system

MAKEOPTS="-j2"

Ready, Set, Go!

Update your /mnt/gentoo/etc/make.conf to your own preference and save (nano users would hit Ctrl-X). You are now ready to continue with Chrooting into the Gentoo Base System.


[ << ] [ < ] [ Home ] [ > ] [ >> ]


Print

View all

Page updated October 31, 2006

Summary: In this chapter we describe how you extract a stage3 file and how to configure Portage.

Sven Vermeulen
Author

Grant Goodyear
Author

Roy Marples
Author

Daniel Robbins
Author

Chris Houser
Author

Jerry Alexandratos
Author

Seemant Kulleen
Gentoo x86 Developer

Tavis Ormandy
Gentoo Alpha Developer

Jason Huebel
Gentoo AMD64 Developer

Guy Martin
Gentoo HPPA developer

Pieter Van den Abeele
Gentoo PPC developer

Joe Kallar
Gentoo SPARC developer

John P. Davis
Editor

Pierre-Henri Jondot
Editor

Eric Stockbridge
Editor

Rajiv Manglani
Editor

Jungmin Seo
Editor

Stoyan Zhekov
Editor

Jared Hudson
Editor

Colin Morey
Editor

Jorge Paulo
Editor

Carl Anderson
Editor

Jon Portnoy
Editor

Zack Gilburd
Editor

Jack Morgan
Editor

Benny Chuang
Editor

Erwin
Editor

Joshua Kinard
Editor

Xavier Neys
Editor

Gerald J. Normandin Jr.
Reviewer

Donnie Berkholz
Reviewer

Ken Nowack
Reviewer

Lars Weiler
Contributor

Tobias Scherbaum
Editor

Donate to support our development efforts.

Copyright 2001-2014 Gentoo Foundation, Inc. Questions, Comments? Contact us.