Gentoo Linux
The source-based Linux distribution where you compile everything — optimized exactly for your hardware and needs.
Source-Based
Portage
USE Flags
Rolling Release
What is Gentoo?
Gentoo is a Linux distribution named after the gentoo penguin — the fastest swimming penguin, chosen to reflect performance as a core value. Founded by Daniel Robbins in 1999, Gentoo takes a radically different approach: instead of installing pre-compiled binaries, you compile software from source code directly on your machine.
This means every package is built with optimizations tuned for your exact CPU, with only the features you actually want enabled via USE flags. The result is a system that is simultaneously highly customized, deeply understood by its owner, and often faster than equivalent binary distributions.
Why Was Gentoo So Popular?
Performance by Compilation
Compiling with -march=native lets GCC/Clang generate CPU-specific instructions — SSE4, AVX2, whatever your chip supports. Binaries built for your exact hardware, not a generic x86-64 baseline.
Minimal & Lean Systems
USE flags let you strip unwanted features at compile time. No GTK support compiled into a CLI tool. No Bluetooth stack on a server. Every package is exactly what you need, nothing more.
Deep Learning Tool
Gentoo users understand their systems deeply. Installing Gentoo forces you to configure the kernel, understand init systems, manage libraries, and learn how Linux actually works. It's a Linux PhD in a box.
Rolling Release
There are no "releases" of Gentoo — it's a continuous rolling distribution. Packages update when upstream releases new versions. Your system is always current without a full reinstall.
Total Flexibility
Choose your init system (OpenRC or systemd), your libc (glibc or musl), your compiler (GCC or Clang), your kernel (vanilla, hardened, zen), your bootloader. Gentoo has no opinions — you do.
Portage is Powerful
The Portage package manager is written in Python and is remarkably capable: dependency resolution, slot-based parallel version support, live ebuilds from git HEAD, binary package creation, and full reproducibility.
Community & Documentation
The Gentoo Wiki is arguably the most thorough Linux documentation on the internet. The Gentoo Handbook walks through a full installation step-by-step. Community knowledge is deep and freely shared.
Security-Hardened Profile
Gentoo Hardened provides PaX patches, PIE binaries, SSP stack protection, and RELRO. Used extensively in security-sensitive environments where custom-compiled hardened binaries are required.
Who Uses Gentoo?
Gentoo has historically attracted three groups: power users who want maximum control, sysadmins who need custom lean server builds, and developers who want to understand the stack they build on. It has a smaller but intensely loyal user base compared to Ubuntu or Fedora.
Famous Gentoo users have included Linus Torvalds himself (who used Gentoo on one of his machines), various kernel developers, and Google engineers who used Gentoo-based tooling internally. ChromeOS is built on a Gentoo-derived base called Portage, and Google still uses Portage heavily in Chromium OS development.
Gentoo Today
~20K
packages in main tree
2000
year of first release
∞
possible configurations
Gentoo remains actively developed with frequent package updates, new profiles for ARM and RISC-V architectures, binary package support via emerge --getbinpkg, and an active community on IRC and forums. It is no longer the dominant hobbyist distro it was in 2003–2008, but it retains a dedicated base of expert users.
Portage & emerge
Portage is Gentoo's package management system — a collection of ~20,000 "ebuilds" (shell scripts) that describe how to fetch, configure, compile, and install software. The emerge command is your interface to Portage.
How emerge Works
root@gentoo # emerge --ask sys-apps/htop
These are the packages that would be merged, in order:
Calculating dependencies... done!
[ebuild N ] sys-apps/htop-3.3.0::gentoo USE="lm-sensors unicode -debug -hwloc" 420 KiB
Total: 1 package (1 new), Size of downloads: 420 KiB
Would you like to merge these packages? [Yes/No] Yes
>>> Emerging (1 of 1) sys-apps/htop-3.3.0::gentoo
>>> Unpacking source...
>>> Source unpacked in /var/tmp/portage/sys-apps/htop-3.3.0/work
>>> Configuring source in /var/tmp/portage/sys-apps/htop-3.3.0/work/htop-3.3.0
>>> Compiling source in /var/tmp/portage/sys-apps/htop-3.3.0/work/htop-3.3.0
>>> Installation successful.
emerge Command Reference
emerge --sync
Sync the Portage tree with the latest ebuilds from the Gentoo mirrors.
emerge --ask <pkg>
Show what will be installed/changed and prompt before proceeding.
emerge --ask www-client/firefox
emerge --update --deep --newuse @world
Update all packages in your world set, respecting new USE flags.
emerge --pretend <pkg>
Show what would be installed without actually doing it. (-p shorthand)
emerge --depclean
Remove packages no longer needed as dependencies. Run after a world update.
emerge --oneshot <pkg>
Install without adding to the world set (won't be updated automatically).
emerge --search <term>
Search the Portage tree for packages matching the term.
emerge --search vim
emerge --info
Show system-wide Portage configuration: CFLAGS, USE flags, features.
emerge --unmerge <pkg>
Remove a package. Does not check reverse dependencies — use with care.
emerge --fetchonly <pkg>
Only download source tarballs; don't compile. Useful before going offline.
emerge --verbose <pkg>
Show verbose output including package size and USE flag details.
emerge --resume
Resume a failed emerge run from where it stopped.
The Portage Tree Structure
The Portage tree lives at /var/db/repos/gentoo/ and contains ebuilds organized by category:
/var/db/repos/gentoo/
├── app-editors/
│ ├── vim/
│ │ ├── vim-9.1.ebuild
│ │ ├── metadata.xml
│ │ └── Manifest
│ └── emacs/
├── sys-apps/
├── dev-lang/
├── www-client/
└── ...~20,000 packages total
Ebuilds
An ebuild is a bash script that tells Portage everything about a package: where to fetch the source, what to configure, how to compile, and where to install. Here's a simplified example:
# dev-libs/hello/hello-2.12.1.ebuild
DESCRIPTION="GNU Hello — classic hello world program"
HOMEPAGE="https://www.gnu.org/software/hello/"
SRC_URI="mirror://gnu/hello/${P}.tar.gz"
LICENSE="GPL-3+"
SLOT="0"
KEYWORDS="~amd64 ~arm64 ~x86"
IUSE="nls"
DEPEND="nls? ( sys-devel/gettext )"
src_configure() {
econf $(use_enable nls)
}
src_compile() {
emake
}
src_install() {
emake DESTDIR="${D}" install
}
Slots
Gentoo's slot system allows multiple versions of the same package to coexist. For example, dev-lang/python:3.11 and dev-lang/python:3.12 can both be installed simultaneously. This is critical for systems that need multiple Python or Ruby versions without conflicts.
Binary Packages (Binpkgs)
Since Gentoo 23.0, official binary packages are available for common configurations. You can mix binary and source packages: install Firefox as a binary but compile your kernel by hand. Use emerge --getbinpkg or set FEATURES="getbinpkg" in make.conf to enable this.
USE Flags
USE flags are Gentoo's most powerful feature. They are keywords that tell Portage which optional features to compile into packages. Setting USE flags is how you build a system that does exactly what you want — no more, no less.
How USE Flags Work
Every package declares what USE flags it supports in its ebuild via the IUSE variable. When you enable a USE flag, the package is compiled with that feature. Disable it, and the dependency and feature are omitted entirely from the binary.
# /etc/portage/make.conf
USE="X alsa bluetooth -gnome -kde pulseaudio python vim-syntax"
# Prefix + to explicitly enable, - to explicitly disable
# Flags without a sign default to the profile's setting
Global vs. Package-Specific Flags
Global USE flags in /etc/portage/make.conf apply to all packages. Package-specific flags in /etc/portage/package.use override them per-package:
# /etc/portage/package.use
www-client/firefox pgo lto -telemetry
media-video/mpv dvd bluray cdda lua
dev-lang/python:3.12 sqlite tk
sys-libs/zlib minizip
Viewing Available USE Flags
root@gentoo # equery uses www-client/firefox
[ Legend : U - final flag setting for installation]
[ : I - package is installed with flag ]
[ Colors : set, unset ]
* Found these USE flags for www-client/firefox-121.0:
U I
+ + alsa : Enable ALSA (Advanced Linux Sound Architecture) support
+ - dbus : Enable dbus support
- - debug : Enable extra debug codepaths
+ + ffmpeg : Enable ffmpeg/libav-based codec support
- - gnome : Add GNOME support
+ + lto : Enable link-time optimisation
- - pgo : Enable profile-guided optimisation
Common USE Flags
X
Enable X Window System (Xorg) support. Disable on headless servers.
alsa
ALSA (Advanced Linux Sound Architecture) audio support.
ssl
Enable SSL/TLS support via OpenSSL or LibreSSL.
python
Build Python bindings or support for the package.
lto
Link-time optimization — produces faster but slower-to-compile binaries.
unicode
Enable Unicode/UTF-8 support. Strongly recommended.
-gnome
Disable GNOME dependencies on a KDE or minimal system.
-kde
Disable KDE/Qt dependencies on a GNOME or minimal system.
-doc
Skip building documentation to save compile time and disk space.
-debug
Disable debug symbols and assertions for leaner production builds.
bluetooth
Enable Bluetooth support in relevant packages.
vaapi
VA-API hardware video acceleration (Intel/AMD GPUs).
cuda
Enable NVIDIA CUDA GPU computing support.
pulseaudio
Use PulseAudio as the audio server.
ipv6
Enable IPv6 networking support.
-nls
Disable Native Language Support (translations) on English-only systems.
vim-syntax
Install Vim syntax highlighting files for this package.
threads
Enable POSIX threading support for parallel processing.
systemd
Build systemd integration/units. Disable if using OpenRC.
ffmpeg
Enable FFmpeg codec support for audio/video applications.
CFLAGS — Compile Flags
Beyond USE flags, CFLAGS and CXXFLAGS in make.conf control GCC optimization settings:
# /etc/portage/make.conf — aggressive optimization example
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
MAKEOPTS="-j$(nproc)" # parallel compile jobs = CPU core count
# USE flags
USE="X alsa bluetooth lto -doc -debug -gnome -kde"
# CPU features (Portage auto-detects from CPU)
CPU_FLAGS_X86="aes avx avx2 f16c fma3 mmx mmxext pclmul popcnt rdrand sse sse2 sse3 sse4_1 sse4_2 ssse3"
Installing Gentoo
Gentoo's installation is famously involved. There is no graphical installer — you do everything by hand in a terminal. This is intentional: the process teaches you exactly how a Linux system is built.
Why Gentoo Install is Legendary
The Gentoo installation process is a rite of passage in the Linux community. A typical install takes anywhere from 3 hours (on modern hardware with binary packages) to several days (compiling everything on a slow machine, including the kernel). The Gentoo Handbook covers every step in meticulous detail.
Installation Steps
- Boot a live environment (minimal install CD, or any Linux live USB)
Verify the ISO signature:
gpg --verify install-amd64-minimal.iso.asc
- Prepare the disks with
fdisk or parted
Typical layout: EFI partition (512MB), swap (optional), root ext4/btrfs/xfs
- Format and mount the partitions
mkfs.fat -F32 /dev/sda1 && mkfs.ext4 /dev/sda3 && mount /dev/sda3 /mnt/gentoo
- Download the Stage 3 tarball
Choose your profile: openrc, systemd, hardened, musl, desktop, or server
- Verify and extract Stage 3
tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo
- Configure
/mnt/gentoo/etc/portage/make.conf
Set CFLAGS, USE flags, MAKEOPTS, mirrors, CPU_FLAGS_X86
- Mount and chroot into the new system
mount --bind /proc /mnt/gentoo/proc && chroot /mnt/gentoo /bin/bash
- Sync the Portage tree
emerge-webrsync (bootstrap) then emerge --sync for latest
- Choose a profile
eselect profile list — pick desktop/gnome, server, hardened, etc.
- Update the @world set
emerge --ask --verbose --update --deep --newuse @world — rebuilds everything against new USE flags
- Configure timezone and locale
echo "America/New_York" > /etc/timezone && emerge --config sys-libs/timezone-data
- Configure the Linux kernel
emerge sys-kernel/gentoo-sources, then make menuconfig — the most complex step
- Compile and install the kernel
make -j$(nproc) && make modules_install && make install
- Generate the initramfs (if needed)
emerge sys-kernel/dracut && dracut --kver $(uname -r)
- Configure
/etc/fstab
Map partitions by UUID to mountpoints: root, boot, swap
- Configure networking
hostname, /etc/hosts, netifrc or NetworkManager depending on profile
- Install a bootloader
emerge sys-boot/grub && grub-install /dev/sda && grub-mkconfig -o /boot/grub/grub.cfg
- Set the root password and create a user
passwd && useradd -m -G wheel,audio,video yourusername
- Reboot into your new Gentoo system
Remove the live USB, cross fingers, and enjoy your custom-compiled OS
Stage 3 Tarball
The Stage 3 is a minimal pre-compiled Gentoo base system — the starting point for every installation. It contains the C library, compiler, shell, and basic tools needed to bootstrap Portage. From Stage 3, you build everything else. Historically Gentoo also had Stage 1 and Stage 2 (compiling the C library and compiler from scratch), but these were dropped in favor of Stage 3 for all normal installations.
genkernel
For those who don't want to configure the kernel manually, genkernel automates the process — building a generic kernel with most drivers enabled, similar to what binary distros ship. Hardcore Gentoo users consider this "cheating," but it works perfectly well for most systems.
Portage Profiles
A profile is a collection of pre-set USE flags, CFLAGS, and package masks designed for a particular use case. Switching profiles is how you tell Portage what kind of system you're building:
| Profile | Use Case |
| default/linux/amd64/23.0 | Base profile — minimal, server-suitable |
| default/linux/amd64/23.0/desktop | Desktop system with Xorg and sound |
| default/linux/amd64/23.0/desktop/gnome | GNOME desktop environment |
| default/linux/amd64/23.0/desktop/kde | KDE Plasma desktop environment |
| default/linux/amd64/23.0/hardened | Security-hardened with PIE/SSP/RELRO |
| default/linux/amd64/23.0/musl | musl libc instead of glibc |
| default/linux/amd64/23.0/llvm | Clang/LLVM as default compiler |
Gentoo vs. Other Distros
Every Linux distribution makes trade-offs. Gentoo trades installation time and complexity for control, customization, and understanding. Here's how it compares.
Feature Comparison
| Feature |
Gentoo |
Arch |
Ubuntu |
NixOS |
| Package format |
Source (+ optional binpkg) |
Binary (AUR: source) |
Binary .deb |
Nix derivations |
| Rolling release |
Yes |
Yes |
No (LTS) |
Yes (unstable) |
| Init system |
OpenRC or systemd |
systemd |
systemd |
systemd |
| Install difficulty |
Very high |
Medium-high |
Low |
Medium-high |
| Customization |
Extreme |
High |
Medium |
Extreme |
| Performance |
Highest (native) |
Good |
Generic |
Good |
| Package count |
~20,000 |
~14,000 + AUR |
~70,000 |
~80,000 |
| Learning curve |
Steep |
Moderate |
Gentle |
Steep |
| Security hardening |
Excellent (Hardened) |
Manual |
Moderate |
Good |
| Reproducibility |
Partial |
Poor |
Partial |
Excellent |
| ARM/embedded |
Excellent |
Limited |
Good |
Growing |
| Time to install |
Hours–days |
30–60 min |
15–30 min |
30–90 min |
Package Manager Comparison
| Manager |
Distro |
Language |
Key Feature |
| Portage / emerge | Gentoo | Python | USE flags, source builds, slots |
| pacman | Arch | C | Speed, simplicity, AUR |
| apt / dpkg | Debian/Ubuntu | C++ | Stability, massive repo, .deb |
| nix | NixOS | Nix lang | Reproducibility, rollbacks, flakes |
| rpm / dnf | Fedora/RHEL | Python/C | Enterprise stability, modularity |
| Homebrew | macOS/Linux | Ruby | Formulae, user-space install |
Portage vs. Nix
Gentoo and NixOS represent two opposite philosophies of ultimate Linux customization. Portage optimizes through compilation and USE flags — you build what you need for your hardware. Nix optimizes through functional package management and reproducibility — every build is deterministic and rollback is trivial. Both are used by Linux power users who want total control; they just take different routes to get there.
Gentoo History
From a personal project called Enoch Linux to one of the most influential Linux distributions ever made, Gentoo's history is a story of radical ideas, community growth, and lasting impact.
1999
Enoch Linux
Daniel Robbins, a developer frustrated with existing distributions, starts Enoch Linux — a source-based distro focused on optimization and cleanliness. The name comes from the biblical figure Enoch. Robbins was heavily influenced by CRUX and BSD.
2000
Renamed to Gentoo Linux
After encountering a naming conflict, Robbins renames the project Gentoo Linux, after the gentoo penguin — the fastest swimmer of all penguin species. The name captures the performance philosophy. Portage (based on BSD ports) is developed as the package system.
2002
Version 1.4 — mainstream attention
Gentoo 1.4 is released and begins attracting serious Linux enthusiasts worldwide. The combination of source-based builds, USE flags, and the Gentoo Handbook's quality documentation creates a passionate community. Forums and IRC channels grow rapidly.
2003–2004
Peak popularity era
Gentoo becomes the most talked-about "power user" distro. Distrowatch rankings place it consistently in the top 5. The phrase "Gentoo user" becomes synonymous with deep Linux knowledge. Compiling Firefox from source for hours becomes a community badge of honor.
2004
Robbins leaves, joins Microsoft
In a shocking move, Daniel Robbins joins Microsoft — stunning the open source community. He publicly says it was a financial decision and that he still supports open source. Gentoo transitions to community governance via the Gentoo Foundation.
2004–2008
Governance troubles
Gentoo struggles with organizational issues — leadership conflicts, slow decision-making, and infrastructure problems. Several core developers leave. The Gentoo Foundation faces legal and financial complications. Meanwhile, Ubuntu rises and captures the "easy Linux" market.
2008
Robbins attempts to return
Daniel Robbins proposes to take back the reins at Gentoo, citing the project's governance problems. The community debates whether to accept. Ultimately the community declines structured handback, and Robbins moves on to other projects.
2006
ChromeOS connection
Google begins developing ChromeOS using a Gentoo-derived base with Portage as the package manager. Gentoo's technology proves its value at enterprise scale. Many Google engineers are (or were) Gentoo users. The Portage influence on ChromeOS endures to this day.
2010s
Stable community niche
Gentoo settles into a smaller but dedicated community. It remains the go-to distro for kernel developers, embedded Linux work, security researchers, and anyone who wants to understand Linux deeply. Musl libc support, Hardened profiles, and ARM support expand.
2017
GitHub Infrastructure Hack
Gentoo's GitHub organization is compromised. The attacker modifies ebuilds to include malicious code. Gentoo detects and reverts the compromise within hours. No users are affected due to Portage's Manifest verification system — all ebuilds have cryptographic checksums.
2023
Binary packages for all
Gentoo officially launches a binary package host. Users can now install Gentoo packages as pre-compiled binaries for common configurations, dramatically reducing install times. Gentoo is no longer exclusively a source-based distro — it's both.
2024–present
Gentoo today
Gentoo remains actively developed with ~200 active developers and thousands of contributors. The tree has ~20,000 packages. RISC-V, ARM64, and exotic architectures are well-supported. The Gentoo philosophy — choice, control, and understanding — is as relevant as ever.
Daniel Robbins
Daniel Robbins is the creator of Gentoo Linux. After leaving Gentoo and briefly joining Microsoft (2004), he went on to co-found Funtoo Linux in 2008 — a Gentoo fork with opinionated defaults and git-based ebuilds. Funtoo later pivoted to "Macaroni OS" as a binary-focused Funtoo spin. Robbins has remained active in open source throughout, writing tutorials and documenting Linux systems.
Legacy
Gentoo's lasting contributions to Linux:
USE Flags → Flexibility
The concept of compile-time feature flags influenced how other package managers think about optional dependencies and minimal builds.
ChromeOS / Portage
Google's ChromeOS uses Portage as its package manager, running on hundreds of millions of Chromebooks worldwide.
The Gentoo Handbook
One of the finest pieces of Linux documentation ever written — detailed, accurate, and complete. A model for how OS documentation should be written.
Slot System
Portage's slot system for co-installing multiple package versions influenced similar features in other package managers.