User:Pietinger/Draft/Quick Installation OpenRC for an UEFI System

From Gentoo Wiki
Jump to:navigation Jump to:search

This article has been created for experienced users who desire a quick, less detailed installation guide for AMD64 systems. It doubles as a checklist so essential installation steps are not forgotten. New Gentoo users can also use it as a guide if they stumble with the options in our Handbook:AMD64.


[ --- S t a r t D e l e t e --- ]

Link to the outdated original article: Quick_Installation_Checklist

Please edit this article as much as possible, so the result can be transferred to an official place (please talk with @sam and @oldfashionedcow)

Some remarks:

1. In the original script was no systemd specific stuff; so, I have not added it. IMHO it would be best if we take this short article, copy it, and make a 2nd "Quick Installation Systemd for an UEFI System" where all OpenRc stuff (and grub) is deleted, and systemd stuff (and systemd-boot) is inserted. (must be made by a systemd expert; I am not)

2. I have added chapter "Prerequisites" - renamed now to "About the installation".

3. I have changed size for ESP according to our Handbook (1GB) and use /efi as mountpoint.

4. I have deleted wrong 4th partition (/boot/efi) according to our Handbook.

5. I have deleted old MBR stuff.

6. I am using PARTLABEL in fstab ... so, it is independent if User has /dev/sda or /dev/nvme0n1

7. I have deleted all the manual kernel configuration stuff

8. I have added a chapter "System logger" + @immolo added cron:

Special:Diff/1290222/1291803

9. Chapter "Install vi" => Deleted.

10. ... Maybe the Warning below should be deleted also ... ?!


[ --- E n d D e l e t e --- ]


Warning
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.

About the installation

The following should be checked and carried out before starting the installation:

  • In UEFI (BIOS) SecureBoot is disabled, Fast Boot is disabled, CSM mode (or Legacy) is disabled, and the system time is set to UTC.
  • The system is connected to a router with activated DHCP, so system gets an IP address from the router.

Preparing the disks

Note
If building within a QEMU or using a VirtIO driver, probably have to substitute the drive/partition name sda with vda throughout this article.

Create three partitions. 1024MB for UEFI ESP, 2048MB swap and the rest goes to /

root #parted -a optimal /dev/sda

Or, if system has a M.2 SSD:

root #parted -a optimal /dev/nvme0n1

In parted the same commands are used for both hard disk types:

> mklabel gpt
> unit mib
> mkpart primary ESP 1 1024
> set 1 boot on
> mkpart primary Swap 1024 3072
> mkpart primary Root 3072 -1
> q

Format the partitions:

root #mkfs.vfat -F 32 /dev/sda1
root #mkswap /dev/sda2 && swapon /dev/sda2
root #mkfs.ext4 /dev/sda3

Or

root #mkfs.vfat -F 32 /dev/nvme0n1p1
root #mkswap /dev/nvme0n1p2 && swapon /dev/nvme0n1p2
root #mkfs.ext4 /dev/nvme0n1p3

Mount partitions

Create the mountpoint for the (new) root partition:

root #mkdir -p /mnt/gentoo/

Mounting the (new) root partition:

root #mount /dev/sda3 /mnt/gentoo

Or

root #mount /dev/nvme0n1p3 /mnt/gentoo

Create the mountpoint for the ESP:

root #mkdir -p /mnt/gentoo/efi

Mounting the ESP:

root #mount /dev/sda1 /mnt/gentoo/efi

Or

root #mount /dev/nvme0n1p1 /mnt/gentoo/efi

The stage file

Sync the system time

root #chronyd -q

Find nearest mirror from this list.

Navigate to the /mnt/gentoo directory:

root #cd /mnt/gentoo

Download the stage 3. Be sure to replace the keyword (amd64 and date stamp in the example below) with the correct architecture and date:

Tip
If the system is being planned to be used as a desktop then it is recommended to use a stage3-desktop tarball to prevent wasting unnecessary recompiling for USE flag changes which can lead to multiple hours of extra install time.
root #wget https://distfiles.gentoo.org/releases/amd64/autobuilds/current-stage3-amd64-openrc/stage3-amd64-openrc-XXXXXXXXXXXXXXX.tar.xz

Unpack the stage 3 file:

root #tar xpvf stage3* --xattrs-include='*.*' --numeric-owner

Chroot

Chroot into the extracted stage3:

root #cp -L /etc/resolv.conf etc && arch-chroot .

Portage

Configuring the repository:

root #mkdir -p /etc/portage/repos.conf
root #cp /usr/share/portage/config/repos.conf /etc/portage/repos.conf/gentoo.conf
Note
Don't forget to edit the make.conf file.

Sync the Gentoo repository, set CPU_FLAGS and update the @world set:

root #emerge-webrsync
root #emerge --ask app-portage/cpuid2cpuflags
root #cpuid2cpuflags
root #echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpu-flags
root #emerge -avuDN @world

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
Note
Spaces are not allowed between groups.

Configure system

Locale

Set system locale:

FILE /etc/env.d/02localeExample 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="pc"

Timezone

Set the appropriate timezone:

root #ln -sf /usr/share/zoneinfo/Europe/Helsinki /etc/localtime

Editing the fstab file

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

FILE /etc/fstab
PARTLABEL=ESP     /efi        vfat    noauto,noatime    1 2
PARTLABEL=Root    /           ext4    noatime           0 1
PARTLABEL=Swap    none        swap    sw                0 0
/dev/cdrom        /mnt/cdrom  auto    noauto,ro         0 0

Kernel

Installing firmware:

root #emerge --ask sys-kernel/linux-firmware

When using an Intel CPU:

root #mkdir -p /etc/portage/package.license
root #echo "sys-firmware/intel-microcode intel-ucode" >> /etc/portage/package.license/intel-microcode
root #emerge --ask sys-firmware/intel-microcode

Installing a distribution kernel:

root #echo "sys-kernel/installkernel dracut" >> /etc/portage/package.use/installkernel
root #emerge --ask sys-kernel/installkernel sys-kernel/gentoo-kernel-bin

Bootloader

Emerge GRUB:

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

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

root #grub-mkconfig -o /boot/grub/grub.cfg
Generating grub configuration file ...
...
done

Network

To start dhcpcd at boot:

root #rc-update add dhcpcd default
root #rc-service dhcpcd start

For wireless networks install net-misc/networkmanager:

root #emerge --ask net-misc/networkmanager
root #rc-update add NetworkManager default
Tip
Once inside the installation the user can run nmtui to configure connecting to the wireless network

System logger and cron

FILE /etc/portage/package.use/sysklogdAdd cron USE flag
app-admin/sysklogd logrotate
root #emerge --ask app-admin/sysklogd
root #rc-update add sysklogd default
root #rc-update add cronie default

Clean up

Exit chroot, unmount partitions, and reboot:

root #exit
root #umount -R /mnt/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.