How to Install the Operating System Gentoo Linux

Introduction

Welcome, brave soul, to the world of Gentoo Linux—where you compile everything from scratch, including your courage. If you’ve ever yearned to experience the exhilarating thrill of watching progress bars crawl at 0.1% per minute, you’ve come to the right place!

In this tutorial you will learn, step-by-step, how to install Gentoo Linux, configure its kernel, master Portage, and finally boot into your own custom-compiled system. By the end, you’ll feel like a wizard, calling emerge spells to materialize software from source code.

Prerequisites

  • A computer (virtual or physical) with at least 2 GB RAM (4 GB or more recommended for large packages).
  • Internet connection—preferably faster than a dial-up modem, unless you enjoy recounting your life story to the download manager.
  • Gentoo Handbook open in another window:
    https://wiki.gentoo.org/wiki/Handbook:Main_Page
  • Patience, coffee, and maybe a small meditation session. You will need them.

1. Downloading and Preparing Installation Media

Head to the Gentoo download page and fetch the latest minimal install ISO for your architecture (e.g., amd64). Then:

  • Burn ISO to a USB stick: dd if=install-amd64-minimal-.iso of=/dev/sdX bs=4M sync.
  • Boot from USB. If your BIOS is suspicious, tell it you have a PhD in bootloaders.

1.1. Setting Your Time

Once you’re in the live environment:

date

If it’s wrong, use:

ntpd -q -g

Your system clock should now be as accurate as your coffee-to-sleep ratio.

2. Disk Partitioning and Filesystems

Time to carve your disk into elegant slices. We’ll assume a simple layout:

  • /dev/sda1: EFI System (200 MiB)
  • /dev/sda2: Swap (size = RAM)
  • /dev/sda3: Root (rest of disk)

Use your favorite partitioning tool (fdisk, gdisk, parted):

fdisk /dev/sda

Then create filesystems:

mkfs.vfat -F32 /dev/sda1  
mkswap /dev/sda2  swapon /dev/sda2  
mkfs.ext4 /dev/sda3

Mount them:

mount /dev/sda3 /mnt/gentoo  
mkdir /mnt/gentoo/boot  mount /dev/sda1 /mnt/gentoo/boot

3. Installing the Stage Tarball

Download a stage3 archive:

cd /mnt/gentoo  
links https://bouncer.gentoo.org/fetch/root/all/releases/amd64/autobuilds/

Extract it:

tar xpvf stage3-.tar.xz --xattrs-include=. --numeric-owner

4. Configuring Portage and Chroot

Copy DNS info:

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

Mount virtual filesystems:

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

Enter the new world:

chroot /mnt/gentoo /bin/bash  
source /etc/profile  
export PS1=(chroot) {PS1}

4.1. Selecting a Profile

Gentoo profiles define default settings. List the options:

eselect profile list

Then pick one, e.g., default/linux/amd64/17.1:

eselect profile set 17

4.2. Tuning /etc/portage/make.conf

Edit /etc/portage/make.conf to set your CHOST, MAKEOPTS, and USE flags:

Variable Example Value Description
CHOST x86_64-pc-linux-gnu Your CPU/ABI
MAKEOPTS -j5 #cores 1
USE X alsa gtk qt5 Enable desktop features

5. Installing System Tools and Kernel

Update Portage tree:

emerge --sync

Install the Gentoo-sources kernel and basic tools:

emerge sys-kernel/gentoo-sources sys-apps/bsdtar sys-kernel/genkernel

Configure the kernel with genkernel:

genkernel all

If you prefer hand-tuning, explore /usr/src/linux and run make menuconfig.

6. Configuring the System

  • Edit /etc/fstab to mount your partitions:
/dev/sda3  /       ext4    defaults,noatime    0 1  
/dev/sda1  /boot   vfat    defaults             0 2  
/dev/sda2  none    swap    sw                   0 0  
  • Set timezone:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime  
echo Region/City > /etc/timezone
  • Configure locales in /etc/locale.gen, then:
locale-gen  
echo LANG=en_US.UTF-8 > /etc/locale.conf
  • Set hostname:
echo mygentoo > /etc/hostname
  • Configure networking (example for DHCP on eth0):
emerge --noreplace net-misc/dhcpcd  
rc-update add dhcpcd default

7. Installing the Bootloader

Install GRUB:

emerge --ask sys-boot/grub:2  
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=gentoo  
grub-mkconfig -o /boot/grub/grub.cfg

8. Final Steps and Reboot

Set root password:

passwd

Exit and unmount:

exit  
cd /  
umount -l /mnt/gentoo/dev{/shm,/pts,}  
umount -R /mnt/gentoo

Reboot:

reboot

Remove the installation media, and watch your custom-built Gentoo system spring to life!

9. Post-Installation Tips

  • Keep your system healthy: emerge --update --deep --newuse @world.
  • Use dispatch-conf or etc-update for config file management.
  • Explore Gentoo Wiki daily it’s more addictive than social media.

Conclusion

Congratulations! You’ve survived compiling your own Linux distribution from source. Remember, with great power comes great responsibility—and occasional recompiles. Now that you’re the master of your system, sit back, relax, and maybe even enjoy watching those emerges.

If all else fails, there’s always #gentoo on Libera.Chat. Happy compiling!

Official Website of Gentoo Linux

Download TXT




Leave a Reply

Your email address will not be published. Required fields are marked *