[ << ]
[ < ]
[ Home ]
[ > ]
[ >> ]
5. Installing the Gentoo Installation Files
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
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. The command uname -m can be used to help you decide which
stage file to download as it provides information on the architecture of your
5.b. 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: type links http://www.gentoo.org/main/en/mirrors.xml
and press enter.
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
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.
Select a mirror closeby. Usually HTTP mirrors suffice, but other protocols are
available as well. Move to the releases/alpha/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.
Code Listing 2.3: Surfing to the mirror listing with links
# links http://www.gentoo.org/main/en/mirrors.xml
# 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 (and in most cases, you will not
find stage1 or stage2 tarballs on our regular download mirrors anyway).
If you want to check the integrity of the downloaded stage tarball, use
openssl and compare the output with the checksums provided on the
mirror. The digests files provide several checksums, each taken with a different
algorithm. The recommended ones are SHA512 and Whirlpool.
Code Listing 2.4: Calculating the integrity checksum of a stage tarball
# openssl dgst -r -sha512 stage3-alpha-<release>.tar.bz2
# sha512sum stage3-alpha-<release>.tar.bz2
# openssl dgst -r -whirlpool stage3-alpha-<release>.tar.bz2
Then compare the output of these commands with the value registered in the
.DIGESTS(.asc) files that can be found on the mirrors as well. The values need to
match, otherwise the downloaded file might be corrupt (or the digests file is).
Just like with the ISO file, you can also verify the cryptographic signature of
the .DIGESTS.asc file using gpg to make sure the checksums
have not been tampered with:
Code Listing 2.5: Validating the checksums using gpg
# gpg --verify stage3-alpha-<release>.tar.bz2.DIGESTS.asc
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.6: 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 Configuring the Compile Options.
5.c. 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/portage/make.conf, a configuration file for Portage.
It is this file we will edit now.
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
Fire up your favorite editor (in this guide we use nano) so we can alter
the optimization variables we will discuss hereafter.
Code Listing 3.1: Opening /etc/portage/make.conf
# nano -w /mnt/gentoo/etc/portage/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
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
A first setting is the -march= or -mcpu= flag, which specifies
the name of the target architecture. Possible options are described in the
make.conf.example file (as comments). A commonly used value is
native as that tells the compiler to select the target architecture of
the current system (the one you are installing on).
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
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 one is just an example:
Code Listing 3.2: Defining the CFLAGS and CXXFLAGS variable
CFLAGS="-mieee -pipe -O2 -mcpu=ev6"
You may also want to view the Compilation Optimization Guide for
more information on how the various compilation options can affect your system.
With MAKEOPTS you define how many parallel compilations should occur when
you install a package. A good choice is the number of CPUs (or CPU cores) in
your system plus one, but this guideline isn't always perfect.
Code Listing 3.3: MAKEOPTS for a regular, 1-CPU system
Ready, Set, Go!
Update your /mnt/gentoo/etc/portage/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 ]
[ > ]
[ >> ]
The contents of this document, unless otherwise expressly stated, are licensed under the CC-BY-SA-2.5 license. The Gentoo Name and Logo Usage Guidelines apply.