Skip to content

Linux Foundations / Find your way around Linux ยท Step 8 of 63

Lesson: GentooSwitch
โ† Linux Foundations

System administration

Gentoo

Understand Gentoo, the source-based distribution where Portage and USE flags let you shape your system.

Gentoo is a distribution that gives you unusual control over how software is built. It is named after the gentoo penguin. It rewards patience and teaches you a lot about how a Linux system fits together, so it is rarely the first choice for a beginner.

Source-based, with Portage

On many distributions you download ready-made binaries. On Gentoo, the package manager Portage traditionally downloads source code and compiles it on your machine. Package recipes are files called ebuilds. Gentoo also provides official binary packages, so you do not have to compile everything.

The main command is emerge:

$ sudo emerge --sync
$ sudo emerge --ask app-editors/vim

The first updates your copy of the package repository. Packages are named category/name. --ask shows the plan and waits for you to confirm. sudo is not necessarily installed; many people run these as root.

USE flags

USE flags switch optional features on or off when packages are built. For instance, you can build without support for a graphical desktop on a server. Global settings live in /etc/portage/make.conf:

USE="-X -gtk"

A leading minus disables a flag. Per-package settings go in /etc/portage/package.use. To preview what a build would involve:

$ emerge --pretend --verbose app-editors/vim

The listing shows versions and USE flags, and nothing gets installed.

Keeping it updated

Gentoo is a rolling release: there is no big version upgrade. A common routine is:

$ sudo emerge --sync
$ sudo emerge --ask --verbose --update --deep --newuse @world

@world stands for your installed system and the packages you asked for. --newuse rebuilds packages whose USE settings changed. Compiling large programs can take hours on slow hardware.

Installing

Installation is manual. You partition disks, unpack a base archive called a stage3, configure the system and set up a kernel and bootloader. Follow the official Gentoo Handbook for your architecture.

OpenRC is the traditional init system, and systemd is also supported.

Try it

Read the Handbook's first chapters before touching a disk. Then install Gentoo in a virtual machine with a snapshot you can return to. Once installed, run emerge --info to see your build settings, and preview a package with --pretend. If you want to get comfortable with processes first, since long builds are a good thing to watch, try the processes and cron lab.

Check your understanding

Gentoo

All 4 sections ยท no timer

Unlimited retries

Questions from every section are combined into one assessment. Answer them all correctly to complete the article.

Your completion saves in this browser. Sign in to sync it to your account.