a Pointer to J
Wiki · Operating systems

Gentoo Linux

A Gentoo installation cheat sheet for people who've done it before: every step from the live USB to a KDE Plasma desktop, plus binary packages.

Started Nov 5, 2017Updated Oct 23, 2026Revision 37 sections · 6 minPage history

Preface

added Nov 5, 2017 · edited Oct 23, 2026

This Gentoo Linux installation guide has completely changed direction.
It's now meant for people already familiar with the installation, for when consulting the Handbook is a hassle.
If you're new to Gentoo Linux or not yet comfortable with Linux, please refer to the Handbook.

As of December 2023, Gentoo officially supports binary packages.
How to use them is in Binary packages below.

Prerequisite

added Nov 5, 2017
When you need to download a file from your own Git repository,

> Github
$ wget https://github.com/YOUR_USER_ID/YOUR_REPOSITORY_NAME/raw/main/FILE_DIRECTORY/SOME_FILE

> Gitlab
$ wget https://gitlab.com/YOUR_USER_ID/YOUR_REPOSITORY_NAME/-/raw/master/FILE_DIRECTORY/SOME_FILE

Live USB

added Nov 5, 2017

Gentoo mirrors

# wipefs --all /dev/sdb
# dd if=./Downloads/install-amd64-minimal-20211231T235901Z.iso of=/dev/sdb status=progress && sync

Base

added Nov 5, 2017 · edited Oct 23, 2026

Ping

# ping

Partition

Check for UEFI boot

# ls /sys/firmware/efi
# wipefs --all /dev/sda
# cfdisk /dev/sda      // or parted, whichever you prefer

Format

/boot partition

# mkfs.vfat -F 32 /dev/sdaN

swap partition

# mkswap /dev/sdaN
# swapon /dev/sdaN

/ partition

# mkfs.ext4 /dev/sdaN

Or format it as xfs or btrfs:

# mkfs.xfs /dev/sdaN
# mkfs.btrfs /dev/sdaN

Mount

If you're installing from another distribution, the /mnt/gentoo directory doesn't exist, so

# mkdir -pv /mnt/gentoo
# mount -v -t ext4 /dev/sda3 /mnt/gentoo

# mkdir -pv /mnt/gentoo/boot
# mount -v -t vfat /dev/sda1 /mnt/gentoo/boot

TIME

# chronyd -q
# hwclock --systohc --utc

Stage 3 Tarball

# cd /mnt/gentoo
# links https://www.gentoo.org/downloads/mirrors/
# tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo

Edit make.conf

# nano -w /mnt/gentoo/etc/portage/make.conf

Mirror

# mirrorselect -i -o >> /mnt/gentoo/etc/portage/make.conf

Copy repos.conf

# mkdir --parents /mnt/gentoo/etc/portage/repos.conf
# cp /mnt/gentoo/usr/share/portage/config/repos.conf /mnt/gentoo/etc/portage/repos.conf/gentoo.conf

Copy resolv.conf

# cp --dereference /etc/resolv.conf /mnt/gentoo/etc/

Mount /proc, /sys, /dev

The --make-rslave and --make-slave lines are needed for systemd support later; they do no harm otherwise.

# mount --types proc /proc /mnt/gentoo/proc
# mount --rbind /sys /mnt/gentoo/sys
# mount --make-rslave /mnt/gentoo/sys # <--
# mount --rbind /dev /mnt/gentoo/dev
# mount --make-rslave /mnt/gentoo/dev # <--
# mount --bind /run /mnt/gentoo/run
# mount --make-slave /mnt/gentoo/run

Chroot

(On Gentoo's own install media, # arch-chroot /mnt/gentoo does the mounts above and the chroot in one step.)

# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# export PS1="(chroot) $PS1"

Portage

# emerge-webrsync

# emerge -avuDN @world
# emerge -av gentoolkit eix genlop

News

# eselect news list
# eselect news read N

Profile

# eselect profile list
# eselect profile set N

Timezone

# ls /usr/share/zoneinfo
# ln -sf ../usr/share/zoneinfo/Asia/Seoul /etc/localtime   // your own Region/City

Locale

# nano -w /etc/locale.gen
Uncomment 'en_US.UTF-8 UTF-8'
# locale-gen
# eselect locale list
# eselect locale set N

Update env

# env-update && source /etc/profile && export PS1="(chroot) $PS1"

Kernel

// The genuine article
# emerge --ask sys-kernel/gentoo-sources pciutils sys-kernel/linux-firmware

// The real deal
# git clone https://github.com/torvalds/linux.git
# wget https://cdn.kernel.org/pub/linux/kernel/v6.x/linux-6.X.Y.tar.xz   // the version you want

// Look-alike 1 - binary (since 2020)
# emerge -a sys-kernel/gentoo-kernel-bin

// Look-alike 2 - compiled
# emerge -a sys-kernel/gentoo-kernel
# emerge -a sys-kernel/vanilla-sources
# emerge -a sys-kernel/git-sources
# cd /usr/src/linux

# make mrproper
# make defconfig
# make menuconfig

# make -jN
# make modules_install
# make install

When updating the kernel

# cp /usr/src/linux-OLD_VERSION/.config /usr/src/linux/.config
# make olddefconfig

If you need initramfs: the Handbook's way now is installkernel with the dracut USE flag, which builds it whenever a kernel is installed.

# echo "sys-kernel/installkernel dracut grub" >> /etc/portage/package.use/installkernel
# emerge -av sys-kernel/installkernel

The old way still works:

# genkernel --install --kernel-config=/usr/src/linux/.config initramfs
Microcode (TIP: Enable 'initramfs' USE Flag)
ex) add 'sys-firmware/intel-microcode initramfs'
    inside '/etc/portage/package.use/package.use' file
# emerge -av sys-firmware/intel-microcode

Edit fstab

# blkid >> /etc/fstab
# nano -w /etc/fstab
# Inside file '/etc/fstab'
/dev/sda1    /boot    vfat    defaults,noatime    0 2
/dev/sda2    none     swap    sw                  0 0
/dev/sda3    /        ext4    noatime             0 1
/dev/sda4    /home    ext4    noatime    0 1

# UUID -> remove quotation(")
# PARTUUID -> remove quotation(")

Hostname

# echo YOURHOSTNAME > /etc/hostname
# nano -w /etc/hosts

Netifrc

# emerge --ask --noreplace net-misc/netifrc
# nano -w /etc/conf.d/net
config_enp3s0="dhcp"
# cd /etc/init.d
# ln -s net.lo net.enp3s0

Below, use the name of your own network interface.

# rc-update add net.enp3s0 default
TIP
emerge -av ifplugd

Passwd

# passwd

Edit rc.conf

# nano -w /etc/rc.conf
rc_logger="YES"
rc_log_path="/var/log/rc.log"
# nano -w /etc/conf.d/keymaps
# nano -w /etc/conf.d/hwclock

Install sysklogd, cronie, mlocate

# emerge --ask app-admin/sysklogd cronie mlocate
# rc-update add sysklogd default
# rc-update add cronie default

# emerge --ask net-misc/dhcpcd

or

# emerge -av net-misc/networkmanager
# rc-update add NetworkManager default

GRUB

# echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf
# emerge --ask --verbose sys-boot/grub
# grub-install --target=x86_64-efi --efi-directory=/boot
# grub-mkconfig -o /boot/grub/grub.cfg

Reboot

# exit
# cd
# umount -lR /mnt/gentoo
# reboot

Useradd

# useradd -m -g users -G wheel,audio,video,portage -s /bin/bash USER_NAME
# passwd USER_NAME

Remove stage3*.tar.xz

# rm /stage3*.tar.xz

XORG

added Nov 5, 2017
# eselect profile list
# eselect profile set N
# emerge -avuDN @world

# env-update && source /etc/profile

# emerge --ask x11-base/xorg-server
# env-update && source /etc/profile

PLASMA

added Nov 5, 2017 · edited Oct 23, 2026

Settings for Plasma

# eselect profile list
# eselect profile set N
# emerge -avuDN --with-bdeps=y @world

System Dependencies

# emerge --noreplace -av elogind udev dbus polkit udisks
# rc-update add dbus default
# rc-update add elogind boot

Install Packages

# emerge -av plasma-meta kde-apps-meta

SDDM

# emerge --noreplace -av sddm
# usermod -a -G video sddm
# emerge --noreplace -av gui-libs/display-manager-init

Enable SDDM

# vim /etc/conf.d/display-manager
CHECKVT=7
DISPLAYMANAGER="sddm"
# rc-update add display-manager default

Binary packages

added Jan 11, 2024 · edited Oct 23, 2026

Preface

As stated in the Handbook,
as of December 2023, Gentoo officially supports installing binary packages.

Following this update, I installed a new Gentoo machine on a VPS; this section summarizes how to use binary packages along the way.

binrepos.conf

In addition to /etc/portage/repos.conf/gentoo.conf, we now write /etc/portage/binrepos.conf/gentoo.conf for binary packages. (Recent stage3 tarballs already include it.)

[binhost]
priority = 9999
sync-uri = https://distfiles.gentoo.org/releases/amd64/binpackages/23.0/x86-64/

The 23.0 in the address is the profile version (profiles moved from 17.1 to 23.0 in 2024). A mirror close to you works too: same path, its own address.

Make binary default

If you want binary packages to be installed by default, add the following setting to /etc/portage/make.conf.

FEATURES="${FEATURES} getbinpkg"

Emerge

The portage package manager now provides options related to binary packages.

  • --getbinpkg, -g: Downloads binary packages from the remote binary package host. If one can't be found, it downloads the regular (source-based) package.
  • --getbinpkgonly, -G: Similar to --getbinpkg, -g, but fails if a binary package can't be found.

Error: OpenPGP signing and verification fail

During the first package installation after the switch, an integrity verification error may occur.

Fix it by running getuto, a tool that updates the trusted GnuPG/OpenPGP keys in your local environment.

# getuto

For more details, see the wiki page.