Gentoo Logo

[ << ] [ < ] [ 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

Making your Choice

The next step you need to perform is to install the stage3 tarball onto your system. You have the option of downloading the required tarball from the Internet or, if you booted one of the Gentoo Universal CDs or LiveDVDs, copy it over from the disc itself. If you have a Universal CD or LiveDVD and the stage you want to use is on the disc, downloading it from the Internet is just a waste of bandwidth as the stage files are the same. In most cases, the command uname -m can be used to help you decide which stage file to download.

Minimal CDs and LiveCDs do not contain any stage3 archive, though the LiveDVDs do.

5.b. Default: 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 2.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 2.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.

Move to the releases/x86/autobuilds/ directory. There you should see all available stage files for your architecture (they might be stored within subdirectories named after the individual subarchitectures). Select one and press D to download. When you're finished, press Q to quit the browser.

Most PC users should use the stage3-i686-<release>.tar.bz2 stage3 archive. All modern PCs are considered i686. If you use an old machine, you can check the list of i686-compatible processors on Wikipedia. Old processors such as the Pentium, K5, K6, or Via C3 and similar require the more generic x86 stage3. Processors older than i486 are not supported.

Code Listing 2.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.

Code Listing 2.4: Checking integrity of a stage tarball

# md5sum -c stage3-i686-<release>.tar.bz2.DIGESTS
stage3-i686-<release>.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 2.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 (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.c. 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.

Download and Install a Portage Snapshot

Go to the mountpoint where you mounted your filesystem (most likely /mnt/gentoo):

Code Listing 3.1: Going to the Gentoo mountpoint

# cd /mnt/gentoo

Fire up links (or lynx) and go to our Gentoo mirror list. Pick a mirror close to you and open the snapshots/ directory. There, download the latest Portage snapshot (portage-latest.tar.bz2) by selecting it and pressing D.

Code Listing 3.2: Browsing the Gentoo mirrorlist

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

Now exit your browser by pressing Q. You will now have a Portage snapshot stored in /mnt/gentoo.

If you want to check the integrity of the downloaded snapshot, use md5sum and compare the output with the MD5 checksum provided on the mirror.

Code Listing 3.3: Checking integrity of a Portage snapshot

# md5sum -c portage-latest.tar.bz2.md5sum
portage-latest.tar.bz2: OK

In the next step, we extract the Portage snapshot onto your filesystem. Make sure that you use the exact command; the last option is a capital C, not c.

Code Listing 3.4: Extracting the Portage snapshot

# tar xvjf /mnt/gentoo/portage-latest.tar.bz2 -C /mnt/gentoo/usr

5.d. 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/usr/share/portage/config/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 4.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.

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 will not explain all possible optimization options. If you want to know them all, read the GNU Online Manual(s) or the gcc info page (info gcc -- only works on a working Linux system). The make.conf.example file itself also contains lots of examples and information; don't forget to read it too.

A first setting is the -march= or -mtune= flag, which specifies the name of the target architecture. Possible options are described in the make.conf.example file (as comments).

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 even 3 for more speed-optimization flags (every class has the same flags as the one before, plus some extras). -O2 is the recommended default. -O3 is known to cause problems when used system-wide, so we recommend that you stick to -O2.

Another popular optimization flag is -pipe (use pipes rather than temporary files for communication between the various stages of compilation). It has no impact on the generated code, but uses more memory. On systems with low memory, gcc might get killed. In that case, do not use this flag.

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. The default values contained in the stage3 archive you unpacked should be good enough. The following example is just an example:

Code Listing 4.2: Defining the CFLAGS and CXXFLAGS variable

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

Note: You may also want to view the Compilation Optimization Guide for more information on how the various compilation options can affect your system.

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 4.3: 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 Installing the Gentoo Base System.


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


Print

View all

Updated October 19, 2009

Summary: Gentoo installs work through a stage3 archive. In this chapter we describe how you extract the stage3 archive and 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

Tobias Scherbaum
Editor

Xavier Neys
Editor

Joshua Saddler
Editor

Gerald J. Normandin Jr.
Reviewer

Donnie Berkholz
Reviewer

Ken Nowack
Reviewer

Lars Weiler
Contributor

Donate to support our development efforts.

Support OSL
Gentoo Centric Hosting: vr.org
Tek Alchemy
SevenL.net
Global Netoptex Inc.
Bytemark
Online Kredit Index
Copyright 2001-2009 Gentoo Foundation, Inc. Questions, Comments? Contact us.