How to install and configure Gentoo Linux

Configurare noua (How To)

Situatie

1.Boot from the USB and open a terminal.

Check internet connectivity:

ping -c 3 gentoo.org

If not connected:

  • Use nmtui for Wi-Fi
  • Or configure networking manually using ip or dhcpcd

2. Disk Partitioning

Identify your disk:

lsblk

Assume /dev/sda.

Start partitioning:

fdisk /dev/sda

Example layout (UEFI):

  • /dev/sda1 — EFI partition (512 MB)
  • /dev/sda2 — root partition (remaining space)

3. Format Partitions

mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2
4.Mount Filesystems
mount /dev/sda2 /mnt/gentoo
mkdir -p /mnt/gentoo/boot
mount /dev/sda1 /mnt/gentoo/boot

5. Download and Extract Stage3

Go to:
https://www.gentoo.org/downloads/

Download a suitable stage3 tarball (OpenRC or systemd).

Example:

cd /mnt/gentoo
wget <stage3-url>
tar xpvf stage3-*.tar.xz –xattrs-include=‘*.*’ –numeric-owner

6. Configure Portage Environment

Copy DNS configuration:

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

Mount system directories:

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

7. Chroot into Gentoo

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

8. Sync Portage Tree

emerge-webrsync
emerge –sync

9. Configure make.conf

Edit:

nano /etc/portage/make.conf

Basic configuration:

COMMON_FLAGS=“-march=native -O2 -pipe”
MAKEOPTS=“-j$(nproc)

Optional USE flags:

USE=“X wayland alsa pulseaudio networkmanager”

Keep USE flags minimal at first.

10. Select Profile

eselect profile list
eselect profile set <number>

Choose based on your needs:

  • default/linux/amd64
  • desktop profile
  • systemd or OpenRC variant

11. Update System

emerge –ask –verbose –update –deep –newuse @world

This compiles the base system and may take significant time.

12. Timezone and Locale

Set timezone:

echo “Europe/Bucharest” > /etc/timezone
emerge –config sys-libs/timezone-data

Configure locale:

nano /etc/locale.gen

Add:

en_US.UTF-8 UTF-8

Generate:

locale-gen
eselect locale set en_US.utf8

13. Install Kernel

Recommended method:

emerge sys-kernel/gentoo-kernel

Manual method:

emerge sys-kernel/gentoo-sources
cd /usr/src/linux
make menuconfig
make -j$(nproc)
make modules_install
make install

14. Configure fstab

nano /etc/fstab

Example:

/dev/sda1 /boot vfat defaults 0 2
/dev/sda2 / ext4 noatime 0 1

15. Install Bootloader (GRUB)

emerge sys-boot/grub
grub-install –target=x86_64-efi –efi-directory=/boot
grub-mkconfig -o /boot/grub/grub.cfg

16. Set Root Password

passwd

17. Install Basic Tools

emerge vim sudo networkmanager

Enable networking:

rc-update add NetworkManager default

18. Create User

useradd -m -G wheel,audio,video -s /bin/bash youruser
passwd youruser

Enable sudo:

visudo

Uncomment:

%wheel ALL=(ALL:ALL) ALL

19. Exit and Reboot

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

Post-Installation Setup

Desktop Environment (example GNOME)

emerge gnome-base/gnome
rc-update add gdm default

Xorg (if needed)

emerge x11-base/xorg-server

Audio (PipeWire)

emerge media-video/pipewire

Performance Optimizations

Enable ccache:

emerge dev-util/ccache

Binary packages:

FEATURES=“buildpkg”

Common Pitfalls

  • Incorrect kernel configuration can prevent booting
  • Missing filesystem support in kernel
  • Overusing USE flags early in setup
  • Forgetting to mount /boot before installing kernel.

Solutie

Tip solutie

Permanent

Voteaza

(2 din 3 persoane apreciaza acest articol)

Despre Autor

Leave A Comment?