Skip to content

Arch Linux Setup: Installation

Denis Mitana edited this page Jul 17, 2020 · 5 revisions

Installation

Install essential packages

$ pacstrap /mnt base linux linux-firmware base-devel less which vim tmux python3 htop ntfs-3g openssh lvm2 xclip git wget curl dhcpcd netctl iputils iwd iw wpa_supplicant wireless_tools wifi-menu dialog networkmanager man-db man-pages texinfo

Configure the system

Fstab

Generate an fstab file (use -U or -L to define by UUID or labels, respectively):

$ genfstab -U /mnt >> /mnt/etc/fstab

Chroot

Change root into the new system:

$ arch-chroot /mnt

Time zone

Set the appropriate time zone:

$ ln -sf /usr/share/zoneinfo/Europe/Bratislava /etc/localtime

Run hwclock to generate /etc/adjtime:

$ hwclock --systohc

Localization

Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8andsk_SK.UTF-8 UTF-8` (and other needed) locales. Generate the locales by running:

$ locale-gen

Create the locale.conf file, and set the LANG variable accordingly:

$ echo 'LANG=en_US.UTF-8' > /etc/locale.conf

Network configuration

Create the hostname file:

$ echo 'MYHOSTNAME' > /etc/hostname

Add matching entries to hosts:

vim /etc/hosts

127.0.0.1	localhost
::1		localhost
127.0.1.1	myhostname.localdomain	myhostname

If the system has a permanent IP address, it should be used instead of 127.0.1.1.

Initrams

Due to LVM modify mkinitcpio.conf and recreate the initramfs image.

In case your root filesystem is on LVM, you will need to enable the appropriate mkinitcpio hooks, otherwise your system might not boot. Enable udev and lvm2 for the default busybox-based initramfs. udev is there by default. Edit the file and insert lvm2 between block and filesystems like so:

/etc/mkinitcpio.conf
HOOKS=(base udev ... block lvm2 filesystems)

Recreate the initramfs image:

$ mkinitcpio -P

Root password

Set the root password:

$ passwd

Boot loader

First, install the packages grub, efibootmgr and os-prober: GRUB is the bootloader while efibootmgr is used by the GRUB installation script to write boot entries to NVRAM. os-prober allows grub-mkconig to search for other installed systems and automatically add them to the menu.

$ pacman -S grub efibootmgr os-prober

Execute the following command to install the GRUB EFI application grubx64.efi to esp/EFI/GRUB/ and install its modules to /boot/grub/x86_64-efi/.

$ grub-install --target=x86_64-efi --efi-directory=/efi --bootloader-id=GRUB

If you use LVM for your /boot or / root partition, make sure that the lvm module is preloaded and root= kernel parameter points to the mapped device.

/etc/default/grub

GRUB_PRELOAD_MODULES="... lvm"
GRUB_CMDLINE_LINUX_DEFAULT="... root=/dev/vg0/root"

Use the grub-mkconfig tool to generate /boot/grub/grub.cfg.

$ grub-mkconfig -o /boot/grub/grub.cfg

Note: To remove the grub delete GRUB from /efi/EFI/ and delete a boot entry from NVRAM using efibootmgr.

$ rm -rf /efi/EFI/GRUB/

# List boot entries to find out Boot000N boot number
$ efibootmgr -v

# Delete a boot entry
$ efibootmgr -b <N> -B

Enable microcode updates.

For AMD processors, install the amd-ucode package.

For Intel processors, install the intel-ucode package.

$ yay -S intel-ucode

grub-mkconfig will automatically detect the microcode update and configure GRUB appropriately. After installing the microcode package, regenerate the GRUB config to activate loading the microcode update by running:

$ grub-mkconfig -o /boot/grub/grub.cfg

Note: grub-mkconfig does not add the microcode images to the fallback initramfs boot entry. So add /boot/intel-ucode.img after initrd manually.

Reboot

Exit the chroot environment by typing exit or pressing Ctrl+d.

Optionally manually unmount all the partitions with umount -R /mnt: this allows noticing any "busy" partitions, and finding the cause with fuser.

Finally, restart the machine by typing reboot: any partitions still mounted will be automatically unmounted by systemd. Remember to remove the installation medium and then login into the new system with the root account.

Continue to Post-Installation