[ << ]
[ < ]
[ Home ]
[ > ]
[ >> ]
6. Installing the Gentoo Base System
Optional: Selecting Mirrors
In order to download source code quickly it is recommended to select a fast
mirror. Portage will look in your make.conf file for the
GENTOO_MIRRORS variable and use the mirrors listed therein. You can surf to
our mirror list and search
for a mirror (or mirrors) close to you (as those are most frequently the
fastest ones), but we provide a nice tool called mirrorselect which
provides you with a nice interface to select the mirrors you want. Just
navigate to the mirrors of choice and press spacebar to select one or more
Code Listing 1.1: Using mirrorselect for the GENTOO_MIRRORS variable
# mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf
A second important setting is the SYNC setting in make.conf. This
variable contains the rsync server you want to use when updating your Portage
tree (the collection of ebuilds, scripts containing all the information Portage
needs to download and install software). Although you can manually enter a SYNC
server for yourself, mirrorselect can ease that operation for you:
Code Listing 1.2: Selecting an rsync mirror using mirrorselect
# mirrorselect -i -r -o >> /mnt/gentoo/etc/portage/make.conf
After running mirrorselect it is adviseable to double-check the settings
in /mnt/gentoo/etc/portage/make.conf !
If you want to manually set a SYNC server in make.conf, you should
check out the community mirrors
list for the mirrors closest to you. We recommend choosing a
rotation, such as rsync.us.gentoo.org, rather than choosing a
single mirror. This helps spread out the load and provides a failsafe in case a
specific mirror is offline.
Copy DNS Info
One thing still remains to be done before we enter the new environment and that
is copying over the DNS information in /etc/resolv.conf. You need
to do this to ensure that networking still works even after entering the new
environment. /etc/resolv.conf contains the nameservers for your
Code Listing 1.3: Copy over DNS information
# cp -L /etc/resolv.conf /mnt/gentoo/etc/
Mounting the necessary Filesystems
In a few moments, we will change the Linux root towards the new location. To
make sure that the new environment works properly, we need to make certain file
systems available there as well.
Mount the /proc filesystem on /mnt/gentoo/proc to
allow the installation to use the kernel-provided information within the
chrooted environment, and then mount-bind the /dev and
Code Listing 1.4: Mounting /proc and /dev
# mount -t proc none /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --rbind /dev /mnt/gentoo/dev
Entering the new Environment
Now that all partitions are initialized and the base environment
installed, it is time to enter our new installation environment by
chrooting into it. This means that we change from the current
installation environment (Installation CD or other installation medium) to your
installation system (namely the initialized partitions).
This 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 reload some settings, as
provided by /etc/profile, in memory using source.
The last step is to redefine the primary prompt to help us remember that we are
inside a chroot environment.
Code Listing 1.5: Chrooting into the new environment
# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# export PS1="(chroot) $PS1"
Congratulations! You are now inside your own Gentoo Linux environment.
Of course it is far from finished, which is why the installation still
has some sections left :-)
If you at any time would need another terminal or console to access the chroot
environment, all you need to do is to execute the above steps again.
6.b. Configuring 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.
The contents of this snapshot will be extracted to /usr/portage.
We recommend the use of emerge-webrsync. This will fetch the latest
portage snapshot (which Gentoo releases on a daily basis) from one of our mirrors
and install it onto your system.
Code Listing 2.1: Running emerge-webrsync to install a Portage snapshot
# mkdir /usr/portage
Optional: Updating the Portage tree
You can now update your Portage tree to the latest version. emerge
--sync will use the rsync protocol to update the Portage tree (which
you fetched earlier on through emerge-webrsync) to the latest state.
Code Listing 2.2: Updating the Portage tree
# emerge --sync
# emerge --sync --quiet
If you are behind a firewall that blocks rsync traffic, you safely ignore this
step as you already have a quite up-to-date Portage tree.
If you are warned that a new Portage version is available and that you should
update Portage, you should do it now using emerge --oneshot portage. You
might also be notified that "news items need reading". More on that next.
Reading News Items
When a Portage tree is synchronized to your system, Portage might warn you with
Code Listing 2.3: Portage informing that news items are available
* IMPORTANT: 2 news items need reading for repository 'gentoo'.
* Use eselect news to read news items.
Portage news items were created to provide a communication medium to push
critical messages to users via the rsync tree. To manage them you will need to
use eselect news. With the read subcommand, you can read all news
items. With list you can get an overview of the available news items, and
with purge you can remove them once you have read them and have no
further need for the item(s) anymore.
Code Listing 2.4: Handling Portage news
# eselect news list
# eselect news read
More information about the newsreader is available through its manual page:
Choosing the Right Profile
First, a small definition is in place.
A profile is a building block for any Gentoo system. Not only does it specify
default values for USE, CFLAGS and other important variables, it also locks
the system to a certain range of package versions. This is all maintained by the
Previously, such a profile was untouched by the users. However, there may be
certain situations in which you may decide a profile change is necessary.
You can see what profile you are currently using with the following command:
Code Listing 2.5: Verifying system profile
# eselect profile list
Available profile symlink targets:
 default/linux/alpha/13.0 *
As you can see, there are also desktop and server subprofiles available for some
architectures. Running eselect profile list will show all available
After viewing the available profiles for your architecture, you can use a
different one if you wish:
Code Listing 2.6: Changing profiles
# eselect profile set 2
The developer subprofile is specifically for Gentoo Linux development
tasks. It is not meant to help set up general development environments.
Configuring the USE variable
USE is one of the most powerful variables Gentoo provides to its users.
Several programs can be compiled with or without optional support for certain
items. For instance, some programs can be compiled with gtk-support, or with
qt-support. Others can be compiled with or without SSL support. Some programs
can even be compiled with framebuffer support (svgalib) instead of X11 support
Most distributions compile their packages with support for as much as possible,
increasing the size of the programs and startup time, not to mention an enormous
amount of dependencies. With Gentoo you can define what options a package
should be compiled with. This is where USE comes into play.
In the USE variable you define keywords which are mapped onto
compile-options. For instance, ssl will compile ssl-support in the
programs that support it. -X will remove X-server support (note the
minus sign in front). gnome gtk -kde -qt4 will compile your
programs with gnome (and gtk) support, and not with kde (and qt) support,
making your system fully tweaked for GNOME.
The default USE settings are placed in the make.defaults
files of your profile. You will find make.defaults files in the
directory which /etc/portage/make.profile points to and all parent
directories as well. The default USE setting is the sum of all USE
settings in all make.defaults files. What you place in
/etc/portage/make.conf is calculated against these defaults
settings. If you add something to the USE setting, it is added to the
default list. If you remove something from the USE setting (by placing
a minus sign in front of it) it is removed from the default list (if it was
in the default list at all). Never alter anything inside the
/etc/portage/make.profile directory; it gets overwritten when
you update Portage!
A full description on USE can be found in the second part of the Gentoo
Handbook, USE flags. A full description on
the available USE flags can be found on your system in
Code Listing 2.7: Viewing available USE flags
# less /usr/portage/profiles/use.desc
As an example we show a USE setting for a KDE-based system with DVD, ALSA
and CD Recording support:
Code Listing 2.8: Opening /etc/portage/make.conf
# nano -w /etc/portage/make.conf
Code Listing 2.9: USE setting
USE="-gtk -gnome qt4 kde dvd alsa cdr"
Finally select your timezone so that your system knows where it is physically
located. Look for your timezone in /usr/share/zoneinfo, then copy
it to /etc/localtime. Please avoid the
/usr/share/zoneinfo/Etc/GMT* timezones as their names do not
indicate the expected zones. For instance, GMT-8 is in fact
Code Listing 3.1: Setting the timezone information
# ls /usr/share/zoneinfo
# cp /usr/share/zoneinfo/Europe/Brussels /etc/localtime
# echo "Europe/Brussels" > /etc/timezone
[ << ]
[ < ]
[ 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.