9.2 KiB
Arch Linux Installation Guide
Pre-installation
Update the system clock
timedatectl set-ntp true
Partition the disks
Partition your hard drive with cfdisk.
It can be sda, sdb, sdc, nvme0n1 or other drive names.
cfdisk /dev/sdx
Chose dos if available.
Example layout
boot- 256Mswap- (optional, recommended size is the size of RAM or half of it)root- 30GB (10GB for root in VM will be enough, but on physical hardware 30GB-50GB is recommended)home- rest of the drive
Format the partitions
mkfs.fat -F 32 /dev/sdx1 # boot partition
fatlabel /dev/vda1 boot
mkswap -L swap /dev/sdx2 # swap partition, if created
mkfs.ext4 -L root /dev/sdx3 # root partition
mkfs.ext4 -L root /dev/sdx4 # home partition
You can replace ext4 with btrfs.
Mount the file systems
mount -L root /mnt
mount -Lm boot /mnt/boot
mount -Lm home /mnt/home
swapon /dev/sdx2
Flag explanation
-L, --label- Mount the partition that has the specified label.-m, --mkdir- Allow to make a target directory (mountpoint) if it does not exist yet.
Mount additional drives/partitions if exist and needed with:
mount /dev/sdy /mnt/exampleFolder
Installation
Install essential packages
Use the pacstrap script to install the base package, Linux kernel and firmware for common hardware:
pacstrap /mnt base base-devel linux linux-firmware
Configure the system
Fstab
Generate an fstab file:
genfstab -U /mnt >> /mnt/etc/fstab
Chroot
Change root into the new system:
arch-chroot /mnt
Time zone
Set the time zone:
ln -sf /usr/share/zoneinfo/Region/City /etc/localtime
Run hwclock to generate /etc/adjtime:
hwclock --systohc
Localization
Install any text editor (vim, nano) of your choice.
pacman -S vim
Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 and other needed locales.
vim /etc/locale.gen
Generate the locales by running:
locale-gen
Create the locale.conf file, and set the LANG variables accordingly:
vim /etc/locale.conf
LANG=en_US.UTF-8
Variations
If you want to specify which time, number, etc. formats to use, you can do so using the following variables:
LANGLANGUAGELC_ADDRESSLC_COLLATELC_CTYPELC_IDENTIFICATIONLC_MEASUREMENTLC_MESSAGESLC_MONETARYLC_NAMELC_NUMERICLC_PAPERLC_TELEPHONELC_TIME
For example:
LC_ADDRESS=lv_LV.UTF-8
LC_IDENTIFICATION=lv_LV.UTF-8
LC_MEASUREMENT=lv_LV.UTF-8
LC_MONETARY=lv_LV.UTF-8
LC_NUMERIC=lv_LV.UTF-8
LC_PAPER=lv_LV.UTF-8
LC_TELEPHONE=lv_LV.UTF-8
LC_TIME=lv_LV.UTF-8
Boot loader
First install grub and os-prober (to detect other operating systems installed):
pacman -S grub os-prober efibootmgr
If ls /sys/firmware/efi/efivars lists files, you have a UEFI system.
ls /sys/firmware/efi/efivars
Install grub:
For BIOS systems
grub-install --recheck /dev/sdx
For UEFI systems
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub
To enable os-prober uncomment GRUB_DISABLE_OS_PROBER=false in /etc/default/grub file:
To enable os-prober, GRUB_DISABLE_OS_PROBER=false in /etc/default/grub:
vim /etc/default/grub
Must be at the end of the file.
Make config
grub-mkconfig -o /boot/grub/grub.cfg
Root password
Set the root password:
passwd
Add user(s)
Create a regular user and password. Replace username with your desired username.
useradd -mG username wheel
passwd username
Configure sudo
Uncomment %whell ALL=(ALL:ALL) ALL or %whell ALL=(ALL:ALL) NOPASSWD: ALL for no password option:
vim /etc/sudoers
Package manager
Enable several handy features of pacman package manager:
vim /etc/pacman.conf
Uncomment/add the following lines:
Color # Automatically enable colors only when pacman’s output is on a tty.
VerbosePkgLists # Displays name, version and size of target packages formatted as a table for upgrade, sync and remove operations.
ParallelDownloads = 12 # Specifies number of concurrent download streams. The value needs to be a positive integer. The number of CPU threads on your computer is recommended.
ILoveCandy # Otherwise what is the point of using Arch Linux at all?
[multilib] # Enable 32bit repository (required by steam)
Include = /etc/pacman.d/mirrorlist
Network configuration
Create the hostname file and enter machine name. Replace myhostname with a name that will be seen by other devices on the same network.
vim /etc/hostname
myhostname
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.
Install and enable networkmanager and/or bluez:
pacman -Syu networkmanager bluez wget git
systemctl enable NetworkManager
systemctl enable bluetooth
Reboot the system
exit # exit chroot environment
umount -R /mnt
reboot
Post-installation configuration
Once shutdown is complete, remove your installation media. If all went well, you should boot into your new system. Log in as your root to complete the post-installation configuration. See Arch linux's general recommendations for system management directions and post-installation tutorials.
Desktop Environment
Install your favorite desktop environment, for example KDE, GNOME or other:
pacman -S plasma kde-applications
pacman -S gnome
Display Login Manager
Enable login manager at launch.
KDE
sudo systemctl enable sddm
sudo systemctl start sddm
GNOME
sudo systemctl enable gdm
sudo systemctl start gdm
Wi-Fi
To connect to Wi-Fi run:
nmcli dev wifi list # list all available networks
nmcli dev wifi -a connect "name" # connect to network
Optional
Reflector
Install reflector for better Arch Linux mirror setup:
sudo pacman -S reflector
sudo reflector --sort rate --protocol https --save /etc/pacman.d/mirrorlist --latest 200
Configure reflector to run on startup:
sudo systemctl start reflector.timer
sudo systemctl enable reflector.timer
sudo vim /etc/xdg/reflector/reflector.conf
Uncomment/add the following lines:
--save /etc/pacman.d/mirrorlist
--protocol https
--sort rate
--latest 200
Paru
Install paru - AUR helper:
git clone https://aur.archlinux.org/paru-bin
cd paru-bin
makepkg -si