Difference between revisions of "Quick Installation Checklist"
Maffblaster (talk | contribs) (GRUB2 is going to be renamed to GRUB. Preemptively fixing links and text.) |
Maffblaster (talk | contribs) (→UEFI/GPT: +128.) |
||
(One intermediate revision by the same user not shown) | |||
Line 77: | Line 77: | ||
=== UEFI/GPT === | === UEFI/GPT === | ||
− | Create four partitions. 128MB for {{Path|/boot}}, | + | Create four partitions. 128MB for {{Path|/boot}}, 128MB for UEFI ESP, 1024MB swap and the rest goes to {{Path|/}} |
{{RootCmd|gdisk /dev/sda|output=<pre> | {{RootCmd|gdisk /dev/sda|output=<pre> | ||
Line 96: | Line 96: | ||
Partition Number: 2 ↵ | Partition Number: 2 ↵ | ||
First sector: ↵ | First sector: ↵ | ||
− | Last sector: + | + | Last sector: +128M ↵ |
Hex Code: EF00 ↵ | Hex Code: EF00 ↵ | ||
Revision as of 19:49, 8 August 2022
This article has been created for experienced users who desire a quick, less detailed installation guide. It doubles as a checklist so essential installation steps are not forgotten.
This document is intended for experienced users only. It is not a replacement for the Gentoo Handbook and will not help you install Gentoo any faster.
Do not expect to receive any kind of support when following this checklist. Installing according to the Handbook is fully supported however.
Format drive
If building within a QEMU or using a VirtIO driver, probably have to substitute the drive/partition name sda with vda throughout this article.
BIOS/MBR
Create three partitions. 128MB for /boot, 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
BIOS/GPT
Create four partitions. 128MB for /boot, 2MB for BIOS Boot, 1024MB swap and the rest goes to /
root #
gdisk /dev/sda
Create GPT partition table: Command: o ↵ This option deletes all partitions and creates a new protective MBR. Proceed? (Y/N): y ↵ Create Partition 1 (/boot): Command: n ↵ Partition Number: 1 ↵ First sector: ↵ Last sector: +128M ↵ Hex Code: ↵ Create Partition 2 (BIOS boot): Command: n ↵ Partition Number: 2 ↵ First sector: ↵ Last sector: +2M ↵ Hex Code: EF02 ↵ Create Partition 3 (swap): Command: n ↵ Partition Number: 3 ↵ First sector: ↵ Last sector: +1024MB ↵ Hex Code: 8200 ↵ Create Partition 4 (/): Command: n ↵ Partition Number: 4 ↵ First sector: ↵ Last sector: ↵ (for rest of disk) Hex Code: ↵ Write Partition Table To Disk: Command: w ↵ Do you want to proceed? (Y/N): Y ↵
Format the partitions:
root #
mkfs.ext4 /dev/sda1
root #
mkfs.ext4 /dev/sda4
root #
mkswap /dev/sda3 && swapon /dev/sda3
UEFI/GPT
Create four partitions. 128MB for /boot, 128MB for UEFI ESP, 1024MB swap and the rest goes to /
root #
gdisk /dev/sda
Create GPT partition table: Command: o ↵ This option deletes all partitions and creates a new protective MBR. Proceed? (Y/N): y ↵ Create Partition 1 (/boot): Command: n ↵ Partition Number: 1 ↵ First sector: ↵ Last sector: +128M ↵ Hex Code: ↵ Create Partition 2 (UEFI ESP): Command: n ↵ Partition Number: 2 ↵ First sector: ↵ Last sector: +128M ↵ Hex Code: EF00 ↵ Create Partition 3 (swap): Command: n ↵ Partition Number: 3 ↵ First sector: ↵ Last sector: +1024MB ↵ Hex Code: 8200 ↵ Create Partition 4 (/): Command: n ↵ Partition Number: 4 ↵ First sector: ↵ Last sector: ↵ (for rest of disk) Hex Code: ↵ Write Partition Table To Disk: Command: w ↵ Do you want to proceed? (Y/N): Y ↵
Format the partitions:
root #
mkfs.ext4 /dev/sda1
root #
mkfs.ext4 /dev/sda4
root #
mkswap /dev/sda3 && swapon /dev/sda3
root #
mkfs.vfat -F 32 /dev/sda2
Mount partitions
BIOS/MBR
root #
mkdir -p /mnt/gentoo
root #
mount /dev/sda3 /mnt/gentoo
root #
mkdir /mnt/gentoo/boot
root #
mount /dev/sda1 /mnt/gentoo/boot
BIOS/GPT
root #
mkdir -p /mnt/gentoo
root #
mount /dev/sda4 /mnt/gentoo
root #
mkdir /mnt/gentoo/boot
root #
mount /dev/sda1 /mnt/gentoo/boot
UEFI/GPT
root #
mkdir -p /mnt/gentoo
root #
mount /dev/sda4 /mnt/gentoo
root #
mkdir /mnt/gentoo/boot
root #
mount /dev/sda1 /mnt/gentoo/boot
root #
mkdir /mnt/gentoo/boot/efi
root #
mount /dev/sda2 /mnt/gentoo/boot/efi
Stage3
Find nearest mirror from this list.
Navigate to the /mnt/gentoo directory:
root #
cd /mnt/gentoo
Download the stage3 tarball. Be sure to replace the keyword (amd64 and date stamp in the example below) with the correct architecture and date:
root #
wget https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/stage3-amd64-openrc-20220320T170531Z.tar.xz
Unpack the stage3 file:
root #
tar xpf stage3*
(or with xattrs):
root #
tar --xattrs-include='*.*' --numeric-owner -xpf stage3*
Chroot
Chroot into the extracted stage3:
root #
cd /mnt/gentoo
root #
mount --types proc /proc /mnt/gentoo/proc
root #
mount --rbind /sys /mnt/gentoo/sys
root #
mount --make-rslave /mnt/gentoo/sys
root #
mount --rbind /dev /mnt/gentoo/dev
root #
mount --make-rslave /mnt/gentoo/dev
root #
mount --bind /run /mnt/gentoo/run
root #
mount --make-slave /mnt/gentoo/run
root #
cp /etc/resolv.conf etc && chroot . /bin/bash
root #
source /etc/profile
Portage
Sync the Gentoo repository:
root #
emerge-webrsync
User accounts
Change the root password:
root #
passwd
Create user(s):
root #
useradd -g users -G wheel,portage,audio,video,usb,cdrom -m username
root #
passwd username
Spaces are not allowed between groups.
Configure system
Install vi (optional)
vi installation is optional, you can use nano as it is a default editor in stage3.
root #
emerge -vq vim
/etc/fstab
Configure /etc/fstab to match the actual partitioning performed in the step above:
/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
/etc/portage/make.conf
Set preferred Portage options:
CFLAGS="-march=native -O2 -pipe"
CXXFLAGS="${CFLAGS}"
# Do NOT change CHOST setting
CHOST="x86_64-pc-linux-gnu"
# Choose desired USE flags
USE="alsa usb"
PORTDIR="/var/db/repos/gentoo"
DISTDIR="/var/cache/distfiles"
PKGDIR="/var/cache/binpkgs"
Locale
Set system locale:
LANG="en_US.UTF-8"
LC_COLLATE="C"
Add the locale to /etc/locale.gen:
en_US.UTF-8 UTF-8
C.UTF8 UTF-8
then generate the locale:
root #
locale-gen
Hostname
Edit /etc/conf.d/hostname
dns_domain_lo="mynetwork.net"
Keymap
Edit /etc/conf.d/keymaps
Clock
Edit /etc/conf.d/hwclock
Timezone
Set the appropriate timezone:
root #
ln -sf /usr/share/zoneinfo/Europe/Helsinki /etc/localtime
Kernel
Emerge
The sys-kernel/gentoo-sources package is the vanilla kernel with the Gentoo patchset applied. Choose between kernel sources. The sys-kernel/linux-firmware package contains binary blobs needed for some hardware (WLAN cards).
If sys-kernel/gentoo-sources has been selected:
root #
emerge -av sys-kernel/gentoo-sources sys-kernel/linux-firmware
root #
cd /usr/src/linux
Configure
Manual
Install sys-apps/pciutils
root #
emerge -av pciutils
Discover which modules are required for the system's hardware:
root #
lspci -nnk
Shorter version:
root #
lspci -nnk | grep "Kernel driver in use:"
Configure kernel by enabling each necessary module in the menuconfig interface. Search for specific module names by pressing / in menuconfig. Navigate to the associated feature by pressing the corresponding number listed on the left of the search results.
root #
make menuconfig
Once finished build kernel and modules:
root #
make -j2
Automatic
If things are working nicely in the current install environment, it is possible to use localyesconfig
to select all modules currently loaded by the LiveCD:
root #
make localyesconfig
Build the kernel and modules:
root #
make -j2
Install
Install the kernel and modules:
root #
make modules_install
root #
make install
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
:
32-bit UEFI is rare to find on PCs. Mostly older Apple hardware use this. It has nothing to do with the Gentoo architecture chosen.
GRUB_PLATFORMS="pc"
GRUB_PLATFORMS="efi-64"
Emerge GRUB:
root #
emerge --ask sys-boot/grub
- Supposing the system has PC BIOS:
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
- Edit GRUB's configuration file:
root #
nano /boot/grub/grub.cfg
Below is a simple GRUB configuration file:
set default=0
set timeout=1
menuentry "Gentoo" {
linux (hd0,1)/vmlinuz-3.14.4-gentoo root=/dev/sda3 rootfstype=ext4 net.ifnames=0 quiet ro
}
Alternatively 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 tools
Install tools needed for configuring the network interfaces:
root #
emerge --ask sys-apps/iproute2 net-misc/dhcpcd net-wireless/wireless-tools net-wireless/iw net-wireless/wpa_supplicant
Clean up
Exit chroot, unmount partitions, and reboot:
root #
exit
root #
cd /mnt
root #
umount -R gentoo
root #
reboot
See also
- Gentoo Handbook — an effort to centralize essential documentation for initial Gentoo installation and basic system administration.
- Installation — an overview of the principles and practices of installing Gentoo on a running system.