A text version plus my notes for future reference on Arch Linux instalation based on the video Arch Linux: Full Installation Guide - A complete tutorial/walkthrough in one video! from LearnLinuxTV. This is how I followed the guide and how I'm going to make this personal "reminder" of the steps I took to install Arch Linux on my computer, so I can use this later for more installations without needing to search parts of the original video.
Download the ISO (09:03):
Use USBImager to write the ISO to a USB drive (10:22):
Instead of USBImager, I use Ventoy as a way of easily creating bootable media.
Just need to drop the ISO onto the USB drive, but secure boot need to be disabled for this to work, wich can be challenging in some motherboards...
Observation about booting from usb: my old motherboard for some reason show the USB twice, but one of those have the word (UEFI) in it, the other doesn't, the installation only work if the installintion is done from the one with the word (UEFI) int it.
If you have a keyboard with a different layout from the default (us):
Changing the keyboard layout (arch wiki reference):
# List available keymaps
localectl list-keymaps
# Change the kymap
# BR ABNT2: br-abnt2
localectl set-keymap --no-convert br-abnt2
The font may be to small during the installation.
Changing installation font (reddit + arch wiki):
# List available fonts
ls /usr/share/kbd/consolefonts/
# Change to another font (my recomendation: ter-132n)
setfont ter-132n
Check if you have an IP address (12:07):
ip addr show
How to connect to wifi during the installation (12:46):
# Start iwctl interactive mode
iwctl
# List all wireless interfaces you have installed
device list
# Trigger device to scan local area for wifi networks (<station> is the name of the wireless device found in the previous command, normally it will be wlan0)
station <station> scan
# Get list of available wifi networks found on scan
station <station> get-networks
# Connect to a wifi network (<network_name> is the name/ssid of the network you want to connect to)
station <station> connect <network_name>
# To exit the iwd prompt, press Ctrl+D
Testing the connection (16:11):
# Now `ip addr show` should show your IP address if everything worked
ip addr show
# Test if the connection is working
ping -c 5 8.8.8.8
I'm only using UEFI with encryption, so the other sections where skipped...
...
...
Finding the device name for the disk we will work with (45:57):
# List all disks (for the example, it will be "/dev/sda")
fdisk -l
Partitioning the disk (47:18):
# Start the fdisk interactive mode (for the example, it will be "/dev/sda" disk)
fdisk /dev/sda
# List all partitions
p
# Create a new GPT partition layout
g
# Create a new partition (partition for EFI)
n
> Partition number (1-128, default 1): # use default
> First sector (2048-1048575966, default 2048): # use default
> Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-1048575966, default 1048575966): +500M
# Set the type of the new partition
t
> Partition type or alias (type L to list all): 1 # EFI
# Create a second partition (partition for /boot (grub))
n
> Partition number (2-128, default 2): # use default
> First sector (1026048-1048575966, default 1026048): # use default
> Last sector, +/-sectors or +/-size{K,M,G,T,P} (1026048-1048575966, default 1048575966): +500M
# Create a third partition (partition for lvm)
n
> Partition number (3-128, default 3): # use default
> First sector (2050048-1048575966, default 2050048): # use default
> Last sector, +/-sectors or +/-size{K,M,G,T,P} (2050048-1048575966, default 1048575966): # use default
# Set the type of the new partition
t
> Partition number (1-3, default 3): # use default
> Partition type or alias (type L to list all): 30 # LVM
# Check partitions, should have two 500M partitions, first one being of type EFI and second one one being Linux filesystem, and the third one being LVM and having the size of the remaining space
p
# Write the partition table and exit fdisk
w
# List disks (should be same output as we got before in the fdisk prompt (when used the command "p" before "w"))
fdisk -l
Formating the partitions (51:45)
# Format the first partition (/dev/sda1) as fat32
mkfs.fat -F32 /dev/sda1
# Format the second partition (/dev/sda2) as ext4
mkfs.ext4 /dev/sda2
We're not goint to format the third partition, we will set it up for LVM instead, but first we will set encryption for it (52:27):
# Setting up encryption for the third partition (/dev/sda3)
cryptsetup luksFormat /dev/sda3
# Unlocking the encrypted partition to work with it and naming it lvm (/dev/mapper/lvm)
cryptsetup open --type luks /dev/sda3 lvm
Setting up LVM (54:20):
# ------------------------------ Configuring LVM ----------------------------- #
# Creating a physical volume
pvcreate --dataalignment 1m /dev/mapper/lvm
# Creating a volume group
vgcreate volgroup0 /dev/mapper/lvm
# Creating a logical volume for root filesystem (/)
lvcreate -L 30GB volgroup0 -n lv_root
# Creating a logical volume for home (/home)
lvcreate -l 100%FREE volgroup0 -n lv_home
# ------------------------------ Activating LVM ------------------------------ #
# Loading the kernel module dm_mod
modprobe dm_mod
# Scan for volume groups
vgscan
# Activating the volume groups found
vgchange -ay
Formating LVM volumes and mounting partitions/logical volumes (57:49):
# Formating the first logical volume (lv_root) as ext4
mkfs.ext4 /dev/volgroup0/lv_root
# Mounting lv_root at /mnt
mount /dev/volgroup0/lv_root /mnt
# Creating a directory for the boot partition (/mnt/boot)
mkdir /mnt/boot
# Mouting /dev/sda2 at /mnt/boot
mount /dev/sda2 /mnt/boot
# Formating the second logical volume (lv_home) as ext4
mkfs.ext4 /dev/volgroup0/lv_home
# Creating a directory for the home logical volume (/mnt/home)
mkdir /mnt/home
# Mounting lv_home at /mnt/home
mount /dev/volgroup0/lv_home /mnt/home
Setting up fstab file (59:43)
# Creating etc directory
mkdir /mnt/etc
# Generating fstab file
genfstab -U -p /mnt >> /mnt/etc/fstab
30GB for lv_root is too small for my needs, I set it to 80GB normally.
Install base packages for Arch Linux(1:02:12):
# Install package group base in /mnt
pacstrap -i /mnt base
Configure installation through chroot environment (1:03:10):
# Attach to work in progress installation in chroot environment
arch-chroot /mnt
# Install kernel latest and lts
pacman -S linux linux-headers linux-lts linux-lts-headers
# Install a text editor (nano in the guide, but I prefer vim)
pacman -S nano
# or
pacman -S vim
# base-devel is a group of development packages that is oftem needed and openssh is allows to manage the installation remotely (ssh)
pacman -S base-devel openssh
# Enabling ssh service
systemctl enable sshd
# Adding network support and wifi support
pacman -S networkmanager wpa_supplicant wireless_tools netctl
# Option to use an wifi menu to connect to wifi via terminal
pacman -S dialog
# Enabling network manager
systemctl enable NetworkManager
# Add lvm support
pacman -S lvm2
Ensuring that our boot process supports our configuration by editing a configuration file called mkinitcpio.conf (1:11:23):
# Opening the mkinitcpio.conf file in nano (or use vim)
nano /etc/mkinitcpio.conf
Find the line:
# HOOKS default
HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
Add lvm2 in between block and filesystems: Also add encrypt in between block and lvm2 if you use encryption:
# HOOKS with encrypt and lvm2
HOOKS=(base udev autodetect modconf block encrypt lvm2 filesystems keyboard fsck)
Make the changes in mkiniticpio.conf take effect(1:13:05):
# Create a initial ramdisk environment (initramfs) using linux (latest)
mkinitcpio -p linux
# Also create a initial ramdisk environment (initramfs) using linux-lts
mkinitcpio -p linux-lts
Configuring locale (1:14:15):
Edit the /etc/locale.gen:
# Opening the locale.gen file in nano
nano /etc/locale.gen
Uncomment the line referent to your locale(1:14:27):
# For US English:
en_US.UTF-8 UTF-8
# For Brazil portuguese:
pt_BR.UTF-8 UTF-8
# or both ¯\_(ツ)_/¯
Save the file and run locale-gen to generate the locale files(1:15:07):
locale-gen
Set a secure password for root user(1:15:23):
# Execute the following command while in arch-chroot environment to set root password
passwd
Create an user account for you (1:15:49):
# <user_name> is the name of the user account you want to create... wellington for me :)
useradd -m -g users -G wheel <user_name>
# Set the new user password
passwd <user_name>
Install sudo if not installed(1:16:42):
# Observation: if it's already installed, there is no need to install it again
pacman -S sudo
Associating the wheel group with sudo (1:17:16):
Open the sudoers file using visudo, you can force nano putting EDITOR=nano in front of the visudo command:
# Open sudoers file in nano
EDITOR=nano visudo
Uncomment the line %wheel ALL=(ALL) ALL
and save the file:
## Uncomment to allow member of group wheel to execute any command
%wheel ALL=(ALL) ALL
Without linux-firmware the device wlan0 would not appear in the network manager, so I had to install it (arch wiki reference):
# Install linux-firmware
pacman -S linux-firmware
Also, I only installed the package networkmanager
and skiped the instalation of wpa_supplicant
, wireless_tools
and netctl
, then I used the tui provided by networkmanager
to configure the wifi network (arch wiki reference):
# Open the Terminal User Interface (TUI) of NetworkManager
nmtui
Packages recommended to install when using UEFI guide (with or without encryption) (1:20:24):
Observation: non UEFI parts of the guide will be skiped.
pacman -S grub efibootmgr dosfstools os-prober mtools
Creating EFI directory for GRUB (when using UEFI) and mounting the EFI partition on the new directory (1:21:03):
# Creating EFI directory
mkdir /boot/EFI
# Mounting first partition (/dev/sda1) on /boot/EFI
mount /dev/sda1 /boot/EFI
Installing GRUB on the master boot record (following UEFI guide) (1:21:55):
grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
Setting GRUB locale/language (1:24:02):
# Check if locale folder exists in /boot/grub
ls -l /boot/grub
# If it doesn't exist, create it
mkdir /boot/grub/locale
# Copy grub locale file from /usr/share/locale to /boot/grub/locale
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
If encryption was used onto the disk, you need to edit the /etc/default/grub
file to add/set the encryption settings (1:25:40):
# Opening default grub config file with nano
nano /etc/default/grub
Uncomment the line GRUB_ENABLE_CRYPTODISK=y
:
# Uncomment to enable booting from LUKS encrypted disks
GRUB_ENABLE_CRYPTODISK=y
Edit the line with GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 quiet"
adding the parameters cryptdevice=/dev/<encrypted_partition>:volgroup0:allow-discards
before the "loglevel":
# Example:
GRUB_CMDLINE_LINUX_DEFAULT="cryptdevice=/dev/sda3:volgroup0:allow-discards loglevel=3 quiet"
Save and close the file.
Generate the grub configuration file (1:27:55):
# Generate grub configuration file
grub-mkconfig -o /boot/grub/grub.cfg
Exiting chroot and rebooting (1:28:16):
# Exiting chroot
exit
# Unmounting all partitions
umount -a
# Reboot the system
reboot
For GRUB to find other Operational Systems, like Windows, you also need to add the following line to the /etc/default/grub
file (arch wiki reference):
GRUB_DISABLE_OS_PROBER="false"
And if there is NTFS partitions on any disks, it is also a good idea to add ntfs surpport installing the package ntfs-3g (arch wiki reference):
pacman -S ntfs-3g
Boot the system and log as the user that was created on section 4.
Creating and enabling swapfile (1:30:36):
# Become root (need root password)
su
# cd into the root directory
cd /root
# Create an empty 2GB file (filled with zeroes) with the name swapfile
dd if=/dev/zero of=/swapfile bs=1M count=2048
# Adjusting file permissions
chmod 600 /swapfile
# Transforming the file into an actual swapfile
mkswap /swapfile
# Making a fstab backup
cp /etc/fstab /etc/fstab.bak
# Adding the swapfile to fstab
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
# Check if fstab was correctly modified
cat /etc/fstab
# The swapfile isn't active yet (check with free)
free -m
# It will be activated on the next reboot or with the following commands:
# Mount the swapfile
mount -a
# Enable swapfile now
swapon -a
# Now the command free shows the swapfile as being active
free -m
Setting up timezone (1:35:01):
# Check for available timezones
timedatectl list-timezones
# Set timezone to your location (America/Sao_Paulo for me)
timedatectl set-timezone America/Sao_Paulo
Enabling systemd-timesyncd service so that the system syncs the time at start (1:36:28):
# Sync time at start
systemctl enable systemd-timesyncd
Setting the hostname of the system (1:36:58):
# File /etc/hostname probably doesn't exists yet
cat /etc/hostname
# Set hostname as a name of your choice
hostnamectl set-hostname <hostname>
# Now the file /etc/hostname was generated
cat /etc/hostname
Editting the hosts file (1:38:20):
Open the file /etc/hosts
:
nano /etc/hosts
Add the following lines to the file:
127.0.0.1 localhost
127.0.1.1 <hostname>
Observation: Use the name chosen as hostname instead of <hostname>
.
Installing the micro code for the CPU (1:39:19):
For AMD CPU:
pacman -S amd-ucode
For Intel CPU:
pacman -S intel-ucode
Installing xorg and gpu drivers (1:40:11):
# Installing xorg
pacman -S xorg-server
# If you have an intel or amd GPU, install the mesa package
pacman -S mesa
# If you have a nvidia GPU, install the nvidia or nvidia-lts packages (or both)
pacman -S nvidia nvidia-lts
Enabling multilib (required for some packages, like steam
for example) (arch wiki reference):
Uncomment section [multilib]
in /etc/pacman.conf
:
[multilib]
Include = /etc/pacman.d/mirrolist
Installing yay (LearnLinuxTV: Linux Essentials - The Arch User Repository (AUR)):
# Essential dependencies
pacman -S base-devel git
# Clone yay repository
git clone https://aur.archlinux.org/yay.git
# Enter the directory
cd yay
# Build and install the package
# Observation: in the guide, he uses only `makepkg -s`, but for me it only works with `makepkg -si`
makepkg -si
Activating numlock at early boot (so it's not needed to enable it manually to type the encryption password) (arch wiki reference):
# Install AUR package mkinitcpio-numlock
yay -S mkinitcpio-numlock
# Edit the file `/etc/mkinitcpio.conf`
nano /etc/mkinitcpio.conf
In the line HOOKS=(...
move keyboard
to before modconf
, and add keymap
, consolefont
and numlock
after keyboard. Example:
HOOKS=(base udev autodetect keyboard keymap consolefont numlock modconf block encrypt lvm2 filesystems fsck)
My locale.conf file with fallback (arch wiki reference):
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
LC_ADDRESS=pt_BR.UTF-8
LC_COLLATE=pt_BR.UTF-8
LC_CTYPE=pt_BR.UTF-8
LC_IDENTIFICATION=pt_BR.UTF-8
LC_MEASUREMENT=pt_BR.UTF-8
LC_MESSAGES=pt_BR.UTF-8
LC_MONETARY=pt_BR.UTF-8
LC_NAME=pt_BR.UTF-8
LC_NUMERIC=pt_BR.UTF-8
LC_PAPER=pt_BR.UTF-8
LC_TELEPHONE=pt_BR.UTF-8
LC_TIME=pt_BR.UTF-8
# Install GNOME
pacman -S gnome
# Install GNOME Tweaks (optional)
pacman -S gnome-tweaks
# Enable gdm (login screen)
systemctl enable gdm
GNOME don't set the language correctly, you need to set it up manually, or else there will be some glitches.
Settings -> Region & Language -> "Change the Unspecified to an actual language"
For gnome I would just quit to use with arch and go back to pop-os. Pop-os is an awesome distro and the plugins don't break everytime I decide to update the system.
# Install Plasma
pacman -S plasma-meta
# Install default applications
pacman -S kde-applications
# Enable sddm (login screen)
systemctl enable sddm
For now I would not install 'kde-applications', instead I'm using the apps as this installation guide: https://github.com/XxAcielxX/arch-plasma-install
Plus Bismuth for tiling.
# Install Xfce
pacman -S xfce4
# Install default applications
pacman -S xfce4-goodies
# Install lightdm (login screen)
pacman -S lightdm lightdm-gtk-greeter
# Enable lightdm (login screen)
systemctl enable lightdm
# Install MATE
pacman -S mate
# Install extras
pacman -S mate-extra
# Install lightdm (login screen)
pacman -S lightdm lightdm-gtk-greeter
# Enable lightdm (login screen)
systemctl enable lightdm
The fonts I'm using are fira sans/fira code and the ones on this reddit comment:
pacman -S adobe-source-han-sans-otc-fonts adobe-source-han-serif-otc-fonts noto-fonts noto-fonts-cjk ttf-fira-sans
# AUR
yay -S noto-fonts-tc ttf-tw nerd-fonts-fira-code
Observation: there is also this gist about improving fonts, I had a quick look at it, but I didn't follow or checked it right... leaving the link here for me to check it later...
Also, because I'm using a nvidia gpu and I had some scaling configurations, I first configured everything in nvidia-settings, then I got the "CurrentMetaMode" with the following command:
nvidia-settings -q CurrentMetaMode -t
and I made a script to apply it on ~/.local/bin/load-nvidia-settings.sh
:
#!/bin/bash
s="$(nvidia-settings -q CurrentMetaMode -t)"
if [[ "${s}" != "" ]]; then
s="${s#*" :: "}"
nvidia-settings -a CurrentMetaMode="<PASTE_THE_RESULT_OF_THE_LAST_COMMAND_HERE>"
fi
Observation: I don't remember from were I got this script...
And to auto execute it at the start of the session, I added the following line to ~/.xprofile
:
# Sleep 10 because my bad choice of gpu + bad choice o monitor...
# Also, restarting plasmashell because without that the taksbar doesn't show up...
$(sleep 10 && ~/.local/bin/load-nvidia-settings.sh && sleep 1 && kquitapp5 plasmashell && kstart5 plasmashell) &
I have migrated from GNOME to Plasma a few months ago, after the latest GNOME update broke pop-shell extension... AGAIN!
I don't dislike Plasma, but after a few months it still don't feel right... I'll try to jump to dwm soon...