AMD64 Installation Guide

Home/About Xwinman Site Archive A Tiny Web DAW Polybar Config


README:

This article is for those whom desire a quick and specific installation guide. It also makes a sufficient checklist to ensure nothing is missing.
By the time you are done, you should have a minimal AMD64 system capable of standing on its own 2 feet. Written using the Archlinux Installation Media as a means for Chrooting.
Any Linux Live Media will work. This guide is only compatible with all 64-Bit X86 Intel, AMD and VIA chipsets. Most PCs, Laptops and Macs fall under this range.



| Warning
This is not an official Gentoo Wiki page. Please provide this resource in the Gentoo forums if you run into trouble. The content below is a modified version of this wiki page.


Format drive


| Danger!
THIS STEP WILL WIPE YOUR DRIVE! If you are unwilling to do so, please do not follow this guide and refer to the Gentoo Handbook instead.


BIOS (MBR)


Create two partitions. 1024MB for swap and the rest for /

root # cfdisk /dev/sda

Format the partitions:

root # mkfs.ext4 /dev/sda1
root # mkfs.ext4 /dev/sda3
root # mkswap /dev/sda2 && swapon /dev/sda2

Format the partitions as Extended File System Version 4. Assumes sda1 is root:

root # mkfs.ext4 /dev/sda1
root # mkswap /dev/sda2 && swapon /dev/sda2

UEFI (GPT)


| Note
For NVME, it's safe to assume nvme0n1 instead of sda. Partition scheming for NVME is a bit different, being nvme0n1pX instead of sdaX.


Create three partitions. 300MB for EFI, 1024MB swap and the rest goes for /


root # fdisk /dev/sda
Command (m for help): g

Created a new GPT disklabel (GUID: 15E591FB-FA4B-422E-91F7-BF2F82013199).

Command (m for help): n ↵
Partition number (1-128, default 1): ↵
First sector (2048-7814037134, default 2048): ↵
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-7814037134, default 7814035455): +300M ↵

Created a new partition 1 of type 'Linux filesystem' and of size 300 MiB.

Command (m for help): n ↵
Partition number (2-128, default 2): ↵
First sector (616448-7814037134, default 616448): ↵
Last sector, +/-sectors or +/-size{K,M,G,T,P} (616448-7814037134, default 7814035455): +1024M ↵

Created a new partition 2 of type 'Linux filesystem' and of size 1 GiB.

Command (m for help): n ↵
Partition number (3-128, default 3): ↵
First sector (2713600-7814037134, default 2713600): 2 ↵
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2713600-7814037134, default 7814035455): ↵

Created a new partition 3 of type 'Linux filesystem' and of size 3.6 TiB. ↵

Command (m for help): w ↵

Format the partitions as Extended File System Version 4:

root # mkfs.vfat /dev/sda1
root # mkswap /dev/sda2
root # swapon /dev/sda2
root # mkfs.ext4 /dev/sda3

Mount partitions


BIOS/MBR

root # mount /dev/sda3 /mnt
root # mkdir /mnt/boot
root # mount /dev/sda1 /mnt/boot

UEFI/GPT

root # mount /dev/sda4 /mnt/gentoo
root # mount /dev/sda1 /mnt/boot
root # mkdir -p /mnt/boot/efi
root # mount /dev/sda2 /mnt/boot/efi

Stage 3

Find nearest mirror from this list.

Navigate to the /mnt directory:

root # cd /mnt

Download the stage3 tarball of your choosing. This guide assumes you are using an OpenRC stage. Please ensure the links package (links2 on debian distros) is installed on host media.

root # links https://distfiles.gentoo.org/releases/amd64/autobuilds/


Unpack the stage 3 file:

root # tar -xpfv --xattrs-include='*.*' --numeric-owner stage3*#don't use the verbose (v) flag on slow TTYs.

Chroot

Chroot into the extracted stage3:

root # cd /mnt/
root # mount --types proc /proc /mnt/proc
root # mount --bind /sys /mnt/sys
root #
root # mount --bind /dev /mnt/dev
root # mount --bind /run /mnt/run
root # cp /etc/resolv.conf etc && chroot . /bin/bash
root # source /etc/profile

or if using Gentoo installation media:

root # cd /mnt/gentoo && cp /etc/resolv.conf etc && arch-chroot .

Portage


| Note
Don't forget to edit the make.conf file and configure ebuild repository.

Sync the Gentoo repository and update the @world set:

root # emerge-webrsync
root # emerge -avuDN @world

User accounts

Change the root password:

root # passwd

Create user(s):

root # useradd -m username
root # usermod -a -G wheel,portage,audio,video,usb,cdrom username
root # passwd username
Note
Spaces are not allowed between groups.

Configure system

Install vim (optional)

Note
vim's installation is optional, you can use nano if you prefer. It is prebuilt within the stage3 tarballs.
root # emerge -vq vim

Editing the fstab file

Configure /etc/fstab to match the actual partitioning performed in the step above:

FILE /etc/fstab
/dev/sda1		/boot		vfat		noauto,noatime	1 2
/dev/sda3		/		ext4		noatime		0 1
/dev/sda2		none		swap		sw		0 0
/dev/cdrom		/mnt/cdrom	auto		noauto,ro	0 0

Locale

Set system locale:

FILE /etc/env.d/02locale Example locale configuration
LANG="en_US.UTF-8"
LC_COLLATE="C"

Add the locale to /etc/locale.gen :

FILE /etc/locale.genExample locale configuration
en_US.UTF-8 UTF-8
C.UTF8 UTF-8

then generate the locale:

root # locale-gen

Hostname


Edit /etc/conf.d/hostname

FILE /etc/conf.d/hostnameExample Hostname configuration
HOSTNAME="Gentoo"

Timezone

Set the appropriate timezone. Substitute America/New_York with your Timezone:

root # ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime

Kernel

Emerge

To build the kernel from source with global use flags:

root # emerge -av sys-kernel/gentoo-kernel sys-kernel/linux-headers sys-kernel/linux-firmware --autounmask=y --autounmask-write
root # dispatch-conf

To install precompiled kernel images rather than compiling the kernel:

root # emerge -av sys-kernel/gentoo-kernel-bin sys-kernel/linux-headers sys-kernel/linux-firmware --autounmask=y --autounmask-write
root # dispatch-conf

Bootloader

Specify the correct setting for the system's firmware. BIOS/MBR is pc, 64-bit UEFI is efi-64, 32-bit UEFI is efi-32:

| Note
32-bit EFI is usually older Apple hardware. It has nothing to do with the Processor architecture.

Emerge GRUB:

root # echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf
root # emerge -av sys-boot/grub

Assuming the system has BIOS firmware:

root # grub-install /dev/sda

Supposing the system has UEFI firmware and the EFI partition is mounted in the /boot/efi directory:

root # grub-install --target=x86_64-efi --efi-directory=/boot/efi --removable

Use the grub-mkconfig command to generate the configuration file:

root # grub-mkconfig -o /boot/grub/grub.cfg
Found vmlinuz-3.14.4-gentoo

Network

For ethernet install dhcpcd:

root # emerge -av net-misc/dhcpcd
root # rc-update add dhcpcd default

For wireless networks install Network Manager (with wifi use flag):

root # emerge -av networkmanager
root # rc-update add NetworkManager default
root # rc-service NetworkManager start
root # nmtui

Alternatively use iwd and dhcpcd:

root # emerge -av iproute2 iwd wireless-tools dhcpcd
root # rc-update add iwd default
root # rc-update add dhcpcd default
root # rc-service iwd start
root # iwctl
[iwd]# exit

Exit the Chroot and Reboot into Gentoo

Exit chroot, unmount partitions, and reboot:

root # exit
root # umount -R /mnt
root # reboot

Assuming you configured everything according to this wiki, you should have a bootable system, albiet a minimal one. If you missed something, you can boot the live media and return to the Mount partitions section.