Gentoo Guide
Gentoo is a source-based distribution that compiles software from source code, allowing maximum customization and optimization for your hardware.
Dai Aoki
CEO at init, Inc. / CTO at US & JP startups / Creator of WebTerm
Overview
Gentoo was founded in 2000 by Daniel Robbins. Named after the fast-swimming Gentoo penguin, it emphasizes flexibility and performance through source compilation.
Quick Facts
| Based On | Independent (source-based) |
| Package Manager | Portage (emerge) |
| Default Desktop | None (user choice) |
| Release Cycle | Rolling release |
| Support Period | Continuous (rolling) |
| Init System | OpenRC or systemd |
Who Should Use Gentoo?
- Advanced users - Deep understanding of Linux internals
- Performance enthusiasts - Hardware-specific optimizations
- Control freaks - Every package feature is configurable
- Learners - Understanding compilation and dependencies
- Embedded developers - Precise control over software stack
Installation
Gentoo installation is manual and educational. Here's a simplified overview:
# 1. Boot from minimal CD and setup networking
net-setup eth0
# 2. Partition and mount disks
fdisk /dev/sda
mkfs.ext4 /dev/sda3
mount /dev/sda3 /mnt/gentoo
# 3. Download and extract stage3 tarball
cd /mnt/gentoo
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64/stage3-amd64-*.tar.xz
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
# 4. Configure make.conf
nano /mnt/gentoo/etc/portage/make.conf
# Set CFLAGS, MAKEOPTS, USE flags
# 5. Chroot and install system
arch-chroot /mnt/gentoo
emerge-webrsync
emerge --sync
# 6. Select profile and configure system
eselect profile list
eselect profile set X
# 7. Build kernel and install bootloader
emerge sys-kernel/gentoo-sources
cd /usr/src/linux && make menuconfig && make && make installPackage Management (Portage)
Portage is Gentoo's package management system using emerge:
# Sync portage tree
emerge --sync
# Update @world (all installed packages)
emerge --ask --update --deep --newuse @world
# Install a package
emerge --ask package-name
# Remove a package
emerge --ask --depclean package-name
# Search for packages
emerge --search keyword
# Show package info
emerge --info package-name
# Pretend (show what would be done)
emerge --pretend package-name
# Use binary packages (if available)
emerge --getbinpkg package-nameKey Features
Source-Based Installation
Every package is compiled from source, optimized for your specific hardware and configured with exactly the features you need.
Portage System
Powerful package management inspired by FreeBSD's ports. Handles dependencies, compilation flags, and version slotting.
Profiles
System profiles provide base configurations for different use cases (desktop, server, hardened, systemd, etc.).
USE Flags
USE flags control which features are enabled when compiling packages:
# Global USE flags in make.conf
USE="X gtk -kde -systemd alsa pulseaudio bluetooth"
# Package-specific USE flags
# /etc/portage/package.use/custom
app-editors/vim python lua -minimal
www-client/firefox -dbus wayland
# List USE flags for a package
equery uses package-name
# Check what USE flags change
emerge --pretend --verbose package-nameCommon USE Flags
| X | Enable X11 support |
| gtk/qt | GUI toolkit support |
| systemd | Enable systemd support |
| pulseaudio | Audio server support |
| -flag | Disable a feature (prefix with -) |
FAQ
Is Gentoo faster than binary distributions?
It can be, especially for CPU-intensive tasks. The real benefit is optimization for your specific hardware and removing unnecessary features.
How long does installation take?
A basic installation takes several hours. A full desktop environment can take a day or more depending on your hardware.
Can I use binary packages?
Yes! Gentoo offers binhost repositories for common packages. Use--getbinpkg with emerge.
Summary
Gentoo offers unparalleled control and optimization for those willing to invest the time. Key takeaways:
- Source-based with compilation optimizations
- USE flags for fine-grained feature control
- Rolling release, always up-to-date
- Steep learning curve but educational
- Excellent documentation (Gentoo Handbook)
Official Documentation
For authoritative information, refer to the official documentation: