Gentoo installation

Yusef Aslam - 25 Sep 2024

Tags: gentoo,linux,installation

Boot into ISO

Set keymap

1
loadkeys uk

Configure networking

If using ethernet it should already be setup with dhcp if not, run dhcpcd.

If using wifi run net-setup <wlan interface name> and select your SSID and enter the password.

Partition the disks

First, you need to check whether the ISO is running in UEFI mode or BIOS mode, to do this, run ls /sys/firmware/efi, if anything shows up you are running in UEFI mode, if not you are running in BIOS mode.

UEFI requires a 100MB FAT filesystem at the start of the disk which will contain the ESP (EFI System Partition).

BIOS does not require this. Although if your disk is formatted as GPT, an 8mb unformatted partition with the bios-grub flag enabled is required at the start of the disk.

Swap partitions need to be the same size as the amount of RAM you have. If hibernation is required, the swap partition needs to be twice the size of the total amount of system memory:

  • 8GB RAM = 16GB Swap
  • 16GB RAM = 32GB Swap

Make filesystems on the disks

For ext4:

1
mkfs.ext4 <part>

Mount rootfs in /mnt/gentoo

1
mount -v <part> /mnt/gentoo

Turn swap on

1
swapon <swappart>

cd into /mnt/gentoo and fetch stage3 tarball

Use a desktop profile if you are going to have any sort of window manager or desktop environment.

There’s also Plasma and Gnome profiles, use those when you are using Plasma or Gnome.

You can use the links web browser to download the stage3 tarball:

1
links https://www.gentoo.org

unzip stage3 tarball

With:

1
tar xf stage3* --xattrs-include='*.*' --numeric-owner

configure /etc/portage/make.conf

Compile options, accepted licenses etc.. https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Stage

chroot into /mnt/gentoo

First run:

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

Use arch-chroot as it automatically mounts the required partitions necessary to chroot.

Then run:

1
cd /mnt/gentoo && arch-chroot .

When inside the chroot run:

1
export PS1="(chroot) ${PS1}"

Grab a snapshot of the repo with emerge-webrsync

This will sync a snapshot of the Gentoo repos from 24 hours ago which is sufficient.

Add mirrors to make.conf

First grab mirrorselect with:

1
emerge -av1 app-portage/mirrorselect

Then select the mirrors and add to make.conf with:

1
mirrorselect -i -o >> /etc/portage/make.conf

Enable binary package support

Add this to /etc/portage/make.conf:

1
2
3
4
5
# Appending getbinpkg to the list of values within the FEATURES
# variable
FEATURES="${FEATURES} getbinpkg"
# Require signatures
FEATURES="${FEATURES} binpkg-request-signature"

Then run getuto to grab signatures for binary packages.

Install a kernel

With sys-kernel/gentoo-kernel-bin you get a binary kernel without the need for any of that manual stuff, quick and simple.

Setup timezone, fstab, keymap, and hostname

There are 5 files that now need to be configured:

  • /etc/localtime which will be a link to your timezone, for example:

    1
    
    ln -sv /usr/share/zoneinfo/Europe/London /etc/localtime
    
  • /etc/hostname which contains the hostname
  • /etc/vconsole.conf which contains the keymap for the system console, e.g:

    1
    
    KEYMAP=uk
    
  • /etc/fstab which contains filesystem information and where to mount them, type of filesystem, filesystem options, fsck options, etc..
  • /etc/hosts which contains your hostname alias to localhost

Install the bootloader

Install grub with emerge -av sys-boot/grub, then run grub-install /dev/<name of disk>, make sure you do not install grub onto a partition, this command needs to run on your whole disk.

Then, run grub-mkconfig -o /boot/grub/grub.cfg to generate the configuration file.

Set the root password

You need to set the root password so that you can login to the system after reboot, to do this run: passwd root and enter the password.

Installation is nearly done

All that is left now is to install a display manager, text editor, and a desktop environment or window manager.

Regenerated at : November 20, 2024 - 13:38:24 GMT