Gentoo Wiki


This article is part of the HOWTO series.
Installation Kernel & Hardware Networks Portage Software System X Server Gaming Non-x86 Emulators Misc

What is this? This is a very concise guide for bootstrapping Gentoo which avoids information redundant and superfluous to power users.

Method - Starting from a stage3 environment, we first recompile the toolchain (twice) and, if there were any major upgrades in it, also everything else (once). For an easy control of the different steps involved, an emerge wrapper script is used.

Advantages - Succinctness?

Check out the links at the bottom for details and credits.



Download, burn and boot the “Gentoo Minimal CD” matching your architecture.

+ Reiser4 LiveCD

Net setup

Configure network access if it has not yet been done for you.

# net-setup eth0
  or simply
# dhcpcd

Remote Console Access

# passwd
# /etc/init.d/sshd start
Use putty or ssh...

+ Networking

Hard disk configuration

hdparm (not for sata drives)

# hdparm /dev/{hdisk}
# hdparm -i /dev/{hdisk}
# hdparm -a64A1c1d1m16u1 /dev/{hdisk}
# hdparm -d1c1u1 /dev/{cd-drive}

partitioning (fdisk)

A nice partitioning scheme could look like this: 32MB for /boot, more than your RAM for swap (useful for hibernation), a good 10GB for / and whatever you want for /home.


# fdisk -l
# mkfs.ext2 /dev/BOOT
# mkswap /dev/SWAP
# mkfs.reiserfs /dev/ROOT
# mkfs.reiserfs /dev/HOME


Mount partitions

# mount /dev/ROOT /mnt/gentoo
# cd /mnt/gentoo
# mkdir boot && mount /dev/BOOT boot
# mkdir home && mount /dev/HOME home
# swapon /dev/SWAP

Setting up the stage3 environment

date and time

# date MMDDhhmmYYYY

stage3 and portage files

# links2

stage3 tarball

# md5sum -c stage3-{ARCH}-{RELEASE}.tar.bz2.DIGESTS
# tar xvjpf stage3-{ARCH}-{RELEASE}.tar.bz2

portage snapshot

# md5sum -c portage-{DATE}-.tar.bz2.md5sum
# tar xvjf portage-{DATE}-.tar.bz2 -C /mnt/gentoo/usr

choose fastest mirrors

# mirrorselect -s4 -D -o >> /mnt/gentoo/etc/make.conf
# mirrorselect -r -i -o >> /mnt/gentoo/etc/make.conf

dns, proc, dev, chroot, date, timezone

# cp -L /etc/resolv.conf /mnt/gentoo/etc/resolv.conf
# mount -t proc none /mnt/gentoo/proc
# mount -o bind /dev /mnt/gentoo/dev
# chroot /mnt/gentoo /bin/bash 
# env-update 
# source /etc/profile
# rm /etc/localtime && ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
# date MMDDhhmmYYYY

sync, check profile and update portage

# emerge --sync
# ls -FGg /etc/make.profile
# ln -snf /usr/portage/profiles/default/linux/ARCH/PROFILE /etc/make.profile
# emerge portage

Initial configuration


CFLAGS="-march=native -O2 -pipe" # a good and sound choice for cflags
# CFLAGS="${CFLAGS} -fomit-frame-pointer -fno-ident"  # a little "cleanup"
# CFLAGS="${CFLAGS} -fweb -frename-registers" # some amd64 tweaking; may or may not be safe.
# CXXFLAGS="${CFLAGS} -fvisibility-inlines-hidden" # a little tweak for C++ code
USE="nptl nptlonly acpi -apm unicode crypt -qt -kde -gnome alsa -oss -esd -arts"
FEATURES="parallel-fetch ccache"
EMERGE_DEFAULT_OPTS="--with-bdeps y" # considers also build-time deps at dependency calculations

Note: “march” should match your cpu (see “man gcc” for options). Makeopts should match the number of cpu-cores in your system plus one. “Accept keywords” should match your architecture. The "mtune" cflag is unecessary because implied by "march".

+ Cflags + Safe Cflags

/etc/portage/package.keywords (substitute “~amd64” with your keyword of choice)

sys-devel/binutils ~amd64
sys-devel/binutils-config ~amd64
sys-devel/gcc ~amd64
sys-devel/gcc-config ~amd64
sys-libs/glibc ~amd64


sys-devel/libperl ithreads
dev-lang/perl ithreads


# nano /etc/locale.gen
    en_GB ISO-8859-1
    en_GB.UTF-8 UTF-8
    de_DE ISO-8859-1
    de_DE.UTF-8 UTF-8
# locale-gen

+ Localization

Power on!

Now let's recompile our system by using hielvc's emerge wrapper. You can get the script here (or here). Check out the later posts on this thread for information about using to keep your system up-to-date.

for extra caution: update system packages before rebuilding the toolchain

# ./ -uDNs

upgrade toolchain and remove the old gcc (unless you need it as a fallback option)

# ./ -est
# emerge gcc --prune --ask

recompile system + world - toolchain if any of the latter's components experienced a major update

# ./ -esw

if not, this command should be enough

# ./ -uDNw

Update your configuration files

# etc-update

Basic world setup

linux kernel (download, configure, install)

# emerge gentoo-sources

+ Kernel Sources +Kernel/genkernel

note on genkernel and sata drives

Try using the --disklabel option for genkernel kernel config and use this as the UUID with the loader: real_root=UUID=xxxxxx-xxxxx-xx-xxx

# blkid

additional system packages (important)

# emerge grub dhcp acpid

additional system packages (optional)

# emerge syslog-ng reiserfsprogs alsa-utils ccache gentoolkit

Basic configuration

# echo “ mypc.mydomain mypc localhost” >> /etc/hosts
# nano /etc/fstab
# nano /etc/rc.conf
# nano /etc/conf.d/ALMOSTEVERYTHING

splash screen (also the eye needs some candy)

# emerge splashutils splash-themes-livecd
# splash_geninitramfs -v -r 1400x1050 -g /boot/fbsplash_gentoo gentoo

+ Fbsplash


add needed and remove unnecessary rc-scripts

setup grub (personalize kernel filename and disk drives)


title Gentoo
root (hd0,1)
kernel /my_kernel root=/dev/ROOT video=vesafb-tng:1400x1050-32@60,mtrr,ywrap splash=silent,theme:gentoo quiet CONSOLE=/dev/tty1
initrd (hd0,1)/fbsplash_gentoo
# grep -v rootfs /proc/mounts > /etc/mtab
# grub --no-floppy
  grub > root (BOOT)        (mind the different naming
  grub > setup (YOURHDD)     scheme used in Grub)
  grub > quit


# passwd root
# useradd -m -g users -G wheel,audio,tty,games,cdrom,usb,video -s /bin/bash don4lfonso
# passwd don4lfonso


# exit && cd / && umount -a && swapoff /dev/SWAP && init 6

Credits & Links

Many thanks for ideas and contributions go to the whole Gentoo community (you're great!), specifically to hielvc for his nice emerge wrapper and to rac for his ideas about installing Gentoo. And many thanks go, of course, also to those people which inspired them.

Retrieved from ""

Last modified: Mon, 08 Sep 2008 17:13:00 +0000 Hits: 17,183