This guide is updated to date 2020-06-27
I use UEFI mode, LVM to manage the volumes and LUKS to encrypt the LVM volumes. Also I install the system with the Ethernet cable plugged in.
Check if my network interface is listed and enabled
ip link
Check if I have an assigned ip
ip addr
Check if I have internet connection
ping archlinux.org
Update the system clock using timedatectl to ensure the system clock is accurate
timedatectl set-ntp true
Check if the clock is ok
timedatectl status
Install reflector to update the mirrorlist
pacman -S reflector
Update the mirrorlist
reflector --country Switzerland --country Estonia --country Finland --country Iceland --country Romania --country Bulgaria --country Netherlands --age 24 --protocol https --sort rate --save /etc/pacman.d/mirrorlist
Update the repository Index
pacman -Syyy
See the disks availables
fdisk -l
or lsblk
Identify the disk you want to use. For concrete commands I will use /dev/sda
as my disk.
Start the partitioner
fdisk /dev/sda
Show current partitions
p
Create an empty partition table and create EFI partition
g (to create an empty GPT partition table)
n (and enter)
enter
enter
+500M (Size: 500 Megabytes)
t (and enter)
1 (For EFI)
Create boot partition
n (and enter)
enter
enter
+500M
Create LVM partition using the remaining space.
n (and enter)
enter
enter
enter
t (and enter)
enter
30 (Linux LVM)
Show current partitions again to check what we have done.
p
If that is ok, then finalize partition changes.
w
fat for EFI, ext4 for boot, LVM with LUKS the rest (with ext4 for root and home partitions).
EFI
mkfs.fat -F32 /dev/sda1
(sda1 => device partition number one)
Boot
mkfs.ext4 /dev/sda2
(sda2 => device partition number two)
After the following command you will be prompted to set the passphrase (the password) for that partition. Do not forget it!
cryptsetup luksFormat /dev/sda3 #(sda3 => device partition number three)
cryptsetup open --type luks /dev/sda3 lvm
Set up LVM
pvcreate --dataalignment 1m /dev/mapper/lvm
# Create volume group called vgmain (you will use this name)
vgcreate vgmain /dev/mapper/lvm
# Logical volume of 50GB for the root partition
lvcreate -L 50GB vgmain -n lv_root
# Logical volume taking the 100% of the free space for the home partition
lvcreate -l 100%FREE vgmain -n lv_home
modprobe dm_mod
vgscan
vgchange -ay
Format the root partition
mkfs.ext4 /dev/vgmain/lv_root
Mount the root partition
mount /dev/vgmain/lv_root /mnt
Create the boot partition mount directory
mkdir /mnt/boot
Mount the boot partition
mount /dev/sda2 /mnt/boot
Format the home partition
mkfs.ext4 /dev/vgmain/lv_home
Create the home partition mount point
mkdir /mnt/home
Mount the home volume
mount /dev/vgmain/lv_home /mnt/home
Create the /etc dirctory
mkdir /mnt/etc
Create the /etc/fstab file. flag -U is to use UUIDs for source identifiers.
genfstab -U -p /mnt >> /mnt/etc/fstab
Check the /etc/fstab file
cat /mnt/etc/fstab
This will download and install around 500MB of packages from the mirrors we update with reflector before.
pacstrap -i /mnt base
Access the in-progress Arch installation
arch-chroot /mnt
Install a kernel, headers and firmware for common hardware
I use the LTS version, if you use not lts, install the same things but remove the -lts from the packages. You can install both if you want too.
pacman -S linux-lts linux-lts-headers linux-firmware
Install a text editor
pacman -S nano
Install some packages useful to build software, network management and LVM
pacman -S base-devel openssh networkmanager wpa_supplicant wireless_tools netctl dialog lvm2
Enable OpenSSH
systemctl enable sshd
Enable NetworkManager
systemctl enable NetworkManager
Edit file /etc/mkinitcpio.conf
nano /etc/mkinitcpio.conf
On the "HOOKS" line, add "encrypt lvm2" in between "block" and "filesystems"
It should look similar to the following (don't copy this line in case they change it):
HOOKS=(base udev autodetect modconf block encrypt lvm2 filesystems keyboard fsck)
Create the initial ramdisk for the LTS kernel. Some warnings here are ok.
mkinitcpio -p linux-lts
Set the time zone
ln -sf /usr/share/zoneinfo/America/Buenos_Aires /etc/localtime
Run hwclock to generate /etc/adjtime
hwclock --systohc
Edit /etc/locale.gen and uncomment en_US.UTF-8 UTF-8 and other needed locales. Generate the locales:
nano /etc/locale.gen # Edit, save the file and exit.
locale-gen
Create the locale.conf file, and set the LANG variable accordingly:
nano /etc/locale.conf # LANG=en_US.UTF-8
Make the keyboard layout persistent (us is the default though):
nano /etc/vconsole.conf # KEYMAP=us
Create the hostname file:
nano /etc/hostname
myhostname
Add matching entries to hosts:
nano /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 Network Management software
pacman -S iproute2
Set the root password
passwd
Create a user for yourself
useradd -m -g users -G wheel <username>
Set your password
passwd <username>
Install sudo
pacman -S sudo
Allow users in the 'wheel' group to use sudo
EDITOR=nano visudo
Uncomment:
%wheel ALL=(ALL) ALL
Install packages for GRUB
pacman -S grub efibootmgr dosfstools os-prober mtools
Edit /etc/default/grub
nano /etc/default/grub
Uncomment:
GRUB_ENABLE_CRYPTODISK=y
Add cryptdevice=<PARTUUID>:vgmain to the GRUB_CMDLINE_LINUX_DEFAULT line If using standard device naming, the option will look like this:
The entire line for me at this point is:
GRUB_CMDLINE_LINUX_DEFAULT="loglevel=3 cryptdevice=/dev/sda3:vgmain:allow-discards quiet"
Create the directory for EFI boot
mkdir /boot/EFI
Mount the EFI partition
mount /dev/sda1 /boot/EFI
Install GRUB
grub-install --target=x86_64-efi --bootloader-id=grub_uefi --recheck
Create the locale directory for GRUB
mkdir /boot/grub/locale
Copy the locale file to locale directory
cp /usr/share/locale/en\@quot/LC_MESSAGES/grub.mo /boot/grub/locale/en.mo
Generate GRUB's config file
grub-mkconfig -o /boot/grub/grub.cfg
Create swap file. 6GB based on It's FOSS - Swapfile
fallocate -l 6G /swapfile
chmod 600 /swapfile
mkswap /swapfile
Back up the /etc/fstab file just in case
cp /etc/fstab /etc/fstab.bak
Add the swap file to the /etc/fstab file
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab
Check the /etc/fstab file to make sure it includes all the right partitions
cat /etc/fstab
You should have a mountpoint for the root filesystem, boot partition, home partition, and swap file.
Install CPU Microde files (AMD CPU). I have AMD!
pacman -S amd-ucode
If you have an Intel CPU then install CPU Microde files
pacman -S intel-ucode
Install Xorg if you plan on having a GUI
pacman -S xorg-server
I have a Nvidia GPU but if you have an Intel or AMD GPU then install 3D support for Intel or AMD graphics
pacman -S mesa
Install Nvidia Driver packages if you have an Nvidia GPU. My option here
pacman -S nvidia-lts nvidia-utils
If you didn't install the LTS kernel, then install just the nvidia
and nvidia-utils
, NOT the nvidia-lts
.
If you're installing Arch inside a Virtualbox virtual machine, install these packages:
pacman -S virtualbox-guest-utils xf86-video-vmware
Exit the chroot environment
exit
Unmount everything (some errors are okay here)
umount -a
Reboot the machine
reboot
After the base install, I use my own dotfiles (WIP) to set up all my environment, tools and preferences. You can use it too, make your own or check the Arch Wiki for post installation recommendations.