The Quick Guide to Installing Gentoo

Thanks to my friend Scott Robbins for his inspiration, first with his A Quick Guide to Installing ArchLinux, then his A Relatively Quick Guide to Installing Gentoo.

The Gentoo home page has Get started as a clickable link which suggests how to install Gentoo.

Getting started with Gentoo states "we got you covered every step of the way". Whilst that is true, most people who have ever installed Gentoo, and some other distros, don't need quite that much detail. It says:

Step 1: Boot a live environment. While it states to "Choose between a lean Gentoo installation CD, a LiveCD/DVD, LiveGUI USB, or any distribution you like to perform the installation.", my suggestion, and this guide will assume, that you use the install-<arch>-minimal-<release timestamp>.iso from the Gentoo mirror in your chosen country. Mine for today is the install-amd64-minimal-20251026T170339Z.iso.

Step 2: Follow the installation instructions states, "The Gentoo Handbook provides detailed documentation that guides you through the installation process."

To me "provides detailed documentation" is accurate. Also, there is considerably more detail than most people who have experience installing Gentoo need at this point. The purpose of this "Gentoo Quick Install Guide" is to cut out all the extra detail and just provide what is needed, in this case, to install a working Gentoo environment for amd64 using systemd as the init system. If you've never installed Gentoo before, this guide is not for you. My recommendation would be to use the Gentoo Handbook and select the Quick links that matches your target machines.

Let the installation begin!

Write the downloaded ISO file to bootable media and boot your target computer with it. Once you are at the livecd ~ # login prompt, read in the message of the day two items that will allow you to ssh into the computer and work from a terminal on another computer:

To start an ssh server on this system, type "/etc/init.d/sshd start". If you need to log in remotely as root, type "passwd root" to reset root's password to a known value.

Suggested: remote into the target computer using ssh and create at least one tmux session

livecd ~ # /etc/init.d/sshd start
livecd ~ # passwd

Ensure a network connection can reach the Internet

Since the Live CD starts dhcpcd, there might already be an IP address and routing configured for this computer. Issue ip a then ping -c2 gentoo.org to check. If your network connection is already working, just note the local IP to ssh into it from your source machine. If not, and you know your network, you can set a manual IP address and route, I have a HOW-TO for manually setting up a network connection . Or, if you need more help with this, the Gentoo Handbook explains several methods.

There is one more suggestion for remote installation from another computer, and that is to run tmux so that you can leave the remote session if needed without losing your work and having to start over.

livecd ~ # tmux
livecd ~ # tmux ls

Then from your source machine run tmux ls so that you can see your session on the other computer.

livecd ~ # tmux ls
0: 1 windows (created Sun Oct 12 09:53:24 2025) (attached)

Now you can ssh into the machine and run tmux a -t 0 to attach to that running tmux session, and run ctrl+b d if you want to detach so that you can exit the target computer for whatever reason.

Preparing the disks

To see what disk(s) are available run lsblk with these options:

livecd ~ # lsblk -o +fstype,model

NAME       MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS         FSVER MODEL
loop0        7:0    0 669.6M  1 loop /run/rootfsbase
sda          8:0    0 232.9G  0 disk                      Samsung SSD 860 EVO 250GB
sdb          8:16   1  28.6G  0 disk                              Ultra USB 3.0
├─sdb1       8:17   1  28.6G  0 part                     exfat
│ └─ventoy 253:0    0 761.9M  0 dm   /run/initramfs/live iso9660
└─sdb2       8:18   1    32M  0 part                     vfat

My target drive will be the 256GB Samsung 860 SSD. My choice for partitioning is gdisk, and this drive will have a 1GB partition for an EFI System Partition (ESP), a 10GB partition for swap (since this is a laptop and I plan to use hibernation, which requires swap space larger than or equal to the amount of RAM memory - 8GB on this laptop - and I like round numbers), 70GB for /, and the remainder for /home.

livecd ~ # gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 1
First sector (34-488397134, default = 2048) or {+-}size{KMGTP}:
Last sector (2048-488397134, default = 488396799) or {+-}size{KMGTP}: +1G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): EF00
Changed type of partition to 'EFI system partition'

Command (? for help): n
Partition number (2-128, default 2):
First sector (34-488397134, default = 2099200) or {+-}size{KMGTP}:
Last sector (2099200-488397134, default = 488396799) or {+-}size{KMGTP}: +10G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'

Command (? for help): n
Partition number (3-128, default 3):
First sector (34-488397134, default = 23070720) or {+-}size{KMGTP}:
Last sector (23070720-488397134, default = 488396799) or {+-}size{KMGTP}: +70G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): n
Partition number (4-128, default 4):
First sector (34-488397134, default = 169871360) or {+-}size{KMGTP}:
Last sector (169871360-488397134, default = 488396799) or {+-}size{KMGTP}:
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): Y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.
livecd #

Run that lsblk command again, this time with your device specified:

livecd ~ # lsblk -o +fstype,model /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS FSTYPE MODEL
sda      8:0    0 232.9G  0 disk                    Samsung SSD 860 EVO 250GB
├─sda1   8:1    0     1G  0 part             vfat
├─sda2   8:2    0    10G  0 part
├─sda3   8:3    0    70G  0 part
└─sda4   8:4    0 151.9G  0 part

Creating file systems

The EFI system partition (sda1 for me) must be formatted as FAT32. Choose what you want for / and/or /home. I also give my partitions labels (names) that match their mount points to more easily distinguish them in lsblk output:

livecd ~ # mkswap -L swap /dev/sda2
livecd ~ # mkfs.vfat -n EFI -F 32 /dev/sda1
livecd ~ # mkfs.xfs -L root /dev/sda3
livecd ~ # mkfs.xfs -L home /dev/sda4
livecd ~ # lsblk -o +fstype,model /dev/sda
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS FSTYPE MODEL
sda      8:0    0 232.9G  0 disk                    Samsung SSD 860
├─sda1   8:1    0     1G  0 part             vfat
├─sda2   8:2    0    10G  0 part             swap
├─sda3   8:3    0    70G  0 part             xfs
└─sda4   8:4    0 151.9G  0 part             xfs

Activate the swap partition, mount your / partition, make the directory for the ESP partition under /root, and mount /home is you have it as a separate partition:

livecd ~ # swapon /dev/sda2
livecd ~ # mount /dev/sda3 /mnt/gentoo
livecd ~ # mkdir /mnt/gentoo/efi
livecd ~ # mount /dev/sda1 /mnt/gentoo/efi
livecd ~ # mkdir /mnt/gentoo/home
livecd ~ # mount /dev/sda4 /mnt/gentoo/home

Installing the Gentoo installation files

A stage file, also known as a stage tarball, is an archive containing a minimal Gentoo environment, typically serving as a seed for a Gentoo install, and can be obtained from the Gentoo mirror closest to your location. Get the one that suits the type of install and init system you choose; for me today that file is a systemd desktop file. You can download the file with wget, or use links per the Gentoo Handbook's suggestion. My choice is wget with --show-progress:

livecd ~ # wget --show-progress https://gentoo.osuosl.org/releases/amd64/autobuilds/current-stage3-amd64-desktop-systemd/stage3-amd64-desktop-systemd-20251026T170339Z.tar.xz

Make sure to also get the associated checksum file (stage3-amd64-desktop-systemd-20251026T170339Z.tar.xz.sha256 is mine), verify the tarball is not corrupt, and install the files to disk.

livecd ~ # sha256sum --check stage3-amd64-<release>-<init>.tar.xz.sha256
stage3-amd64-desktop-systemd-20251026T170339Z.tar.xz: OK
sha256sum: WARNING: 12 lines are improperly formatted
livecd ~ # tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner -C /mnt/gentoo/

Installing the Gentoo base system

We'll need a resolv.conf file for DNS resolution:

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

Then we'll use this unique genfstab bash script to create /etc/fstab for us:

livecd ~ # genfstab -U /mnt/gentoo/ >> /mnt/gentoo/etc/fstab

Check the fstab file by running egrep -v "(^#|^ *$)" /mnt/gentoo/etc/fstab to make sure the uncommented lines are correct for your system.

Now it's time to chroot (change root) into the new Gentoo system by running arch-chroot, which is another bash script on the Gentoo live media that comes from the Arch Linux camp, then set your prompt to reflect we have now moved into the chroot.

livecd ~ # arch-chroot /mnt/gentoo
livecd / # export PS1="(chroot) ${PS1}"
(chroot) livecd / #

Next install Gentoo's ebuild repo by running emerge-webrsync, then make sure you have the correct profile selected with eselect profile show, and if it's not the one you expected, then show them all with eselect profile list|less and change it to the one you desire with eselect profile set x.

NB: Gentoo has 2 init systems - OpenRC and systemd. The profiles with systemd in the name are for it, the ones without systemd in the name are for OpenRC.

(chroot) livecd / # emerge-webrsync
(chroot) livecd / # eselect profile show
default/linux/amd64/23.0/desktop/systemd

Just like my friend Scott, vim has become the only editor for me, so let's install a binary package of it now so that as we configure software we use vim, and we don't have to use nano, which is the $EDITOR of the Gentoo minimal install system. To get binary packages we first need to download their keys for file verification with getuto. Yes, Gentoo now has a binary package host.

For amd64 (x86-64) and arm64 (aarch64), the Gentoo binhost includes many packages used on desktop systems.

(chroot) livecd / # getuto
(chroot) livecd / # emerge --getbinpkg -atv app-editors/vim

Now set vim as your $EDITOR with these commands:

(chroot) livecd / # eselect editor set vim
(chroot) livecd / # . /etc/profile && export PS1="(chroot) ${PS1}"
(chroot) livecd / # eselect editor show
vim

That should show the $EDITOR that you set.

USE flags are keywords that embody support and dependency-information for a certain concept. They are a core feature of Gentoo, and a good understanding of how to deal with them is needed for administering a Gentoo system.

NB: In order to install the software in the manner of this guide, there are two files which need to be updated: /etc/portage/make.conf and /etc/portage/package.use. By default Gentoo now creates a directory for /etc/portage/package.use/, /etc/portage/package.accept_keywords/, and /etc/portage/package.mask/ and you would create a file under those directories for each package where you wanted to make changes from that package's defaults. IMO that is convoluted and obfuscates something that was formerly simple. Therefore, I remove those directories and use files instead. If you have an AMD system use */* VIDEO_CARDS: amdgpu radeonsi rather than */* VIDEO_CARDS: intel nvidia.

(chroot) livecd # rm -rf /etc/portage/package.accept_keywords/
(chroot) livecd # rm -rf /etc/portage/package.mask/
(chroot) livecd # rm -rf /etc/portage/package.use/
(chroot) livecd # vim /etc/portage/package.use
*/* VIDEO_CARDS: intel nvidia
sys-kernel/gentoo-kernel-bin initramfs -debug -generic-uki modules-compress -test -verify-sig
sys-kernel/installkernel -dracut systemd efistub grub -refind -systemd-boot ugrd -uki -ukify
sys-kernel/linux-firmware -bindist -compress-xz compress-zstd -deduplicate -dist-kernel initramfs redistributable -savedconfig
app-misc/tmux systemd -debug -jemalloc -selinux -sixel -utempter vim-syntax

The other file to edit is just as crucial. Add the following lines to that file:

(chroot) livecd # vim /etc/portage/make.conf
FEATURES="${FEATURES} getbinpkg"
FEATURES="${FEATURES} binpkg-request-signature"
USE="-wayland -device-mapper"
ACCEPT_LICENSE="* -@EULA"
GRUB_PLATFORMS="efi-64"

Set your timezone and check your date ( America/Chicago is mine, choose the one appropriate to you, and tab completion works here):

(chroot) livecd / # date ; ln -sf /usr/share/zoneinfo/America/Chicago /etc/localtime ; date

Configure locales

Setup the language(s) you will use on your computer with locales. There 500 or more locales supported. Choose your language with the character format UTF-8. Then update your system.

(chroot) livecd / # vim /etc/locale.gen
(chroot) livecd / # locale-gen
[1/2] Compiling locale: C.UTF-8
[2/2] Compiling locale: en_US.UTF-8
(chroot) livecd / # eselect locale set 4
Setting LANG to en_US.utf8 ...
(chroot) livecd / # env-update && source /etc/profile && export PS1="(chroot) ${PS1}"

Install a kernel and firmware

I am installing a kernel (get the Gentoo binary kernel) and the firmware (intel-microcode for Intel; AMD is in linux-firmware) at the same time. You may not need or want firmware - read the next paragraph for details about linux-firmware. Check postinstall messages in /var/log/portage/elog/summary.log, and use eselect kernel to see that your link is setup.

The sys-kernel/linux-firmware (and other firmware packages) requires a license, so you must add an ACCEPT_LICENSE choice to /etc/portage/make.conf. If you don't need or want any firmware, you can skip this and just install gentoo-kernel-bin by itself, which does not require a license. This is why we added the EULA license to make.conf earlier.

(chroot) livecd # emerge -atv sys-kernel/gentoo-kernel-bin sys-kernel/linux-firmware sys-firmware/intel-microcode
(chroot) livecd # less /var/log/portage/elog/summary.log
(chroot) livecd # eselect kernel show
/usr/src/linux-6.12.47-gentoo-dist

Configure the bootloader

For this installation GRUB was installed as the bootloader when emerging gentoo-kernel-bin as a result of the grub USE flag enabled for sys-kernel/installkernel and initramfs USE flag enabled for sys-kernel/gentoo-kernel-bin. Yes, USE flags are important, and provide the software of your choice if different than the profile's USE flags. These are the changes I make in Gentoo's default GRUB configuration file.

(chroot) livecd # vim /etc/default/grub
GRUB_PRELOAD_MODULES="part_gpt"
GRUB_DISTRIBUTOR="Gentoo"
GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_TIMEOUT_STYLE=menu
GRUB_CMDLINE_LINUX="net.ifnames=0 panic=30 loglevel=3 modprobe.blacklist=pcspkr"

Installing GRUB

(chroot) livecd # grub-install --efi-directory=/efi
Installing for x86_64-efi platform.
Installation finished. No error reported.

(chroot) livecd # ls -l /efi/EFI/gentoo/grubx64.efi
-rwxr-xr-x 1 root root 147456 2025-10-25 08:19 /efi/EFI/gentoo/grubx64.efi

To generate the final GRUB configuration, run the grub-mkconfig command:

(chroot) livecd # grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/kernel-6.12.47-gentoo-dist
Found initrd image: /boot/intel-uc.img /boot/amd-uc.img /boot/initramfs-6.12.47-gentoo-dist.img
Warning: os-prober will not be executed to detect other bootable partitions.
Systems on them will not be added to the GRUB boot configuration.
Check GRUB_DISABLE_OS_PROBER documentation entry.
Adding boot menu entry for UEFI Firmware Settings ...
done

Networking information

Give your computer a name:

(chroot) livecd / # echo gentooligan > /etc/hostname

Configuring the network

If a static IP address is not desired for this computer, emerge -atv net-misc/dhcpcd then systemctl enable dhcpcd will be enough. If you prefer to configure your network for a static IP address, add net.ifnames=0 to GRUB when we configure it in a bit, and create /etc/systemd/network/10-wired.network with your desired information replacing mine:

(chroot) livecd # vim /etc/systemd/network/10-wired.network
[Match]
Name=eth0
[Network]
Address=192.168.100.28/24
Gateway=192.168.100.1
DNS=192.168.100.1

(chroot) livecd # systemctl enable systemd-networkd.service
Created symlink '/etc/systemd/system/dbus-org.freedesktop.network1.service' → '/usr/lib/systemd/system/systemd-networkd.service'.
Created symlink '/etc/systemd/system/multi-user.target.wants/systemd-networkd.service' → '/usr/lib/systemd/system/systemd-networkd.service'.
Created symlink '/etc/systemd/system/sockets.target.wants/systemd-networkd.socket' → '/usr/lib/systemd/system/systemd-networkd.socket'.
Created symlink '/etc/systemd/system/sysinit.target.wants/systemd-network-generator.service' → '/usr/lib/systemd/system/systemd-network-generator.service'.
Created symlink '/etc/systemd/system/network-online.target.wants/systemd-networkd-wait-online.service' → '/usr/lib/systemd/system/systemd-networkd-wait-online.service'.

System information

Set the root password using the passwd command.

(chroot) livecd # passwd
passwd: password updated successfully

Create a normal user account.

(chroot) livecd / # useradd -m -G users,wheel,audio mingdao
(chroot) livecd / # passwd mingdao
passwd: password updated successfully

Get systemd ready for first boot:

(chroot) livecd / # systemd-machine-id-setup
(chroot) livecd / # systemctl enable gpm.service
(chroot) livecd / # systemctl enable sshd.service
(chroot) livecd / # systemctl enable systemd-timesyncd.service

Leave the chroot and reboot into your shiny, new, Gentoo system!

(chroot) livecd / # exit
livecd /mnt/gentoo # cd
livecd ~ # umount -R /mnt/gentoo
livecd ~ # swapoff /dev/sda2
livecd $ # reboot