Skip to content

Instantly share code, notes, and snippets.

@dixiedream
Last active October 28, 2025 18:08
Show Gist options
  • Select an option

  • Save dixiedream/55ad623c8ccc914b6adeb646584a86d8 to your computer and use it in GitHub Desktop.

Select an option

Save dixiedream/55ad623c8ccc914b6adeb646584a86d8 to your computer and use it in GitHub Desktop.
Arch installation

Arch installation steps

My goto arch installation steps heavily inspired by the Arch Linux wiki. Change var noted with {{ VAR }} notation to your setup and taste.

Bear in mind that if you plan to dual boot with Windows, it'd be better to have it first installed as it ofter messes things at bootloader level

Index

  1. Install preparation
  2. Drive partition and file system
  3. Bootstrap the system
  4. Generate fstab non encrypted skippable
  5. Chroot
  6. Initramfs Archlinux skippable
  7. Locales skippable
  8. Hostname
  9. Build
  10. Setup root password
  11. Bootloader
  12. Create user skippable
  13. Create swap file skippable
  14. Microcodes and display drivers
  15. Network
  16. Closing and rebooting
  17. Post installation skippable

1 Install preparation

Keyboard layout skippable

# set italian keyboard layout
loadkeys it

Internet connection

Wired

Check if you have an IP address

ip a

Wi-Fi

If you're running an Archlinux live

iwctl
device list
station {{ DEVICE }} scan
station {{ DEVICE }} get-networks
station {{ DEVICE }} connect {{ SSID }}
quit
ip a

If you're running an Artix Linux live follow the Connman chapter then come back.

SSH connection skippable

On the remote (target) machine

passwd

Now check that PermitRootLogin yes is present (and uncommented) in /etc/ssh/sshd_config.

systemctl start sshd

2 Drive partition and file system

Partitioning

# Example of valid devices: sda, vda, nvme0n1
fdisk -l
fdisk /dev/{{ DEVICE }}

EFI GPT

  • Create a new partitioning layout of type GPT with g
  • Create a 300Mb partition for the EFI with n, press Enter for 0 as first/starting sector then select +300M as last/ending sector
  • Set the type for this partition as EFI with t then 1 for selecting the EFI type
  • Create another partition for the root directory with n, this time press Enter two times (we need every remaining space as storage)
  • The type of this partition should be already set as Linux or Linux filesystem*

BIOS DOS MBR legacy vbox-qemu

  • Create a new partitioning layout of type DOS with o
  • Create a new partition for the root directory with n, then press Enter two times (we need every remaining space as storage)
  • The type of this partition should be already set as Linux or Linux filesystem*
  • Make the partition bootable by press a

* If not the case, press t to select the partition type menu, press L to list all types then insert the number corrisponding to Linux filesystem

FROM NOW ON MAKE SURE TO SKIP UNREQUIRED STEPS FOR YOUR PARTITION SCHEME

Formatting

Format EFI partition

# Examples of valid EFI partition: sda1, vda1, nvme0n1p1
mkfs.vfat -F 32 /dev/{{ EFI_PARTITION }}

Disk encryption skippable

# Examples of valid root partition: sda2 vda2 nvme0n1p2
cryptsetup -y -v luksFormat /dev/{{ ROOT_PARTITION }}
cryptsetup open /dev/{{ ROOT_PARTITION }} cryptroot

Create root file system

# WITH encryption
mkfs.ext4 /dev/mapper/cryptroot
# WITHOUT encryption
mkfs.ext4 /dev/{{ ROOT_PARTITION }}

Mounting

Mount root

# WITH encryption
mount /dev/mapper/cryptroot /mnt
# WITHOUT encryption
mount /dev/{{ ROOT_PARTITION }} /mnt

Mount EFI partition

mkdir /mnt/boot
mount /dev/{{ EFI_PARTITION }} /mnt/boot

3 Bootstrap the system

Change neovim with your editor of choice (vim, nano, vi, micro)

# Archlinux
pacman -Sy archlinux-keyring
pacstrap /mnt base base-devel linux linux-firmware wpa_supplicant git neovim

# Artix Linux
basestrap /mnt base base-devel linux linux-firmware runit elogind-runit connman connman-runit wpa_supplicant git neovim

4 Generate fstab non encrypted skippable

# Archlinux
genfstab -U -p /mnt >> /mnt/etc/fstab

# Artix linux
fstabgen -U /mnt >> /mnt/etc/fstab

5 Chroot

# Archlinux
arch-chroot /mnt
# Artix linux
artix-chroot /mnt

6 Initramfs Archlinux skippable

Add hooks to the mkinitcpio.conf file

# /etc/mkinitcpio.conf

# WITH encryption
HOOKS=(base systemd autodetect microcode keyboard sd-vconsole modconf kms block sd-encrypt filesystems fsck)
# WITHOUT encryption
HOOKS=(base systemd autodetect microcode modconf kms keyboard sd-vconsole block filesystems fsck)

7 Locales skippable

ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
# Sync with machine clock
hwclock --systohc
# Open the file and uncomment the desired locale
nvim /etc/locale.gen
# Re generate locale infos
locale-gen
# Set for next boots
echo "LANG=en_US.UTF-8" > /etc/locale.conf
echo "KEYMAP=it" > /etc/vconsole.conf

8 Hostname

Choose hostname

nvim /etc/hostname

Create or edit the /etc/hosts file

127.0.0.1	localhost
::1		localhost
127.0.1.1	{{ HOSTNAME }}.local	{{ HOSTNAME }}

9 Build

mkinitcpio -p linux

10 Setup root password

passwd

11 Bootloader

Select proper steps based on your current or desired setup

Single boot

Systemd boot EFI systemd

Setup bootloader

bootctl install

Edit the content of loader.conf. Ensure those line are present

# /boot/loader/loader.conf
console-mode max
editor no

Create a new boot entry

# /boot/loader/entries/arch.conf
title Archlinux
linux /vmlinuz-linux
initrd /initramfs-linux.img
# uncomment if WITH encryption
# options rw rd.luks.name={{ device-UUID }}=cryptroot root=/dev/mapper/cryptroot
# uncomment if WITHOUT encryption
# options rw root=UUID={{ device-UUID }}

Override {{ device-UUID }} with output command of blkid (on Vim: :r !blkid) corrisponding to your dev/{{ ROOT_PARTITION }} UUID (valid examples are: sda2 or nvme0n1p2... even when encrypted!)

bootctl update
bootctl list

Syslinux BIOS-MBR systemd

syslinux-install_update -i -m -a

Edit the /boot/syslinux/syslinux.cfg file checking the root partition matches with your /dev/{{ ROOT_PARTITION }}

Refind BIOS-MBR EFI systemd runit

pacman -S refind
refind-install

# Check the configuration file and eventually setup the root partition
nvim /boot/refind_linux.conf

Dual boot

If dual boot is needed try to use separate drives for the installations.

Windows OS

It's advisable to set the Windows installation first than the Linux one, as Windows tends to overwrite boot priority or mess your disk.

First follow the systemd boot chapter then mount Windows EFI partition and copy the Microsoft folder inside your EFI folder at /boot, here is an example

# use the MOUNTPOINT you prefer
mount /dev/sdb1 /{{ MOUNTPOINT }}
cp -ax /{{ MOUNTPOINT }}/EFI/Microsoft /boot/EFI/

Linux

If the other Linux installation is on the same hard drive just add a second entry like you did in the systemd boot chapter and you're done.

In case you have a dedicated linux install (bootloader + root) on another hard drive just follow the Arch wiki

TL;DR

pacman -S edk2-shell
cp /usr/share/edk2-shell/x64/Shell.efi /boot/shellx64.efi

Then create a new loader like this

# /boot/loader/entries/mySecondLinux.conf
title   MySecondLinux
efi     /shellx64.efi
options -nointerrupt -nomap -noversion {{ EFI_HD_MAP }}:{{ EFI_PATH }}

Where the EFI_HD_MAP variable points to the result of the map command from the UEFI Shell provided by the edk2-shell package installation (ex: HD0b, FS1 or BLK1) and the EFI_PATH is the path for the second linux bootloader, you can find that using the efibootmgr command.

12 Create user skippable

useradd -m -g users -G wheel {{ USERNAME }}
passwd {{ USERNAME }}
EDITOR=nvim visudo

13 Create swap file skippable

change the count number as you wish (default 4G)

dd if=/dev/zero of=/swapfile bs=1G count=4 status=progress
chmod 600 /swapfile
mkswap /swapfile
swapon /swapfile
echo "/swapfile none swap defaults 0 0" >> /etc/fstab

14 Microcodes and display drivers

15 Network

Again, select based on your preference

systemd-networkd systemd

Wired

Create these files

# /etc/systemd/network/en.network
[Match]
Name=en*

[Network]
DHCP=yes

[DHCP]
RouteMetric=10

Wi-Fi

# /etc/systemd/network/wl.network
[Match]
Name=wl*

[Network]
DHCP=yes

[DHCP]
RouteMetric=20

Setup Wi-Fi connection

Get a wifi interface name with

ip a

Create this file

# /etc/wpa_supplicant/wpa_supplicant-{{ WIFIINTERFACE }}.conf
ctrl_interface=/run/wpa_supplicant
ctrl_interface_group=wheel
update_config=1

ap_scan=1

# Begin network section

Then use this command to connect

wpa_passphrase {{ SSID }} >> /etc/wpa_supplicant-{{ WIFIINTERFACE }}.conf

When you need to connect to a WPA-ENTERPRISE or others add this block to the conf file

WIFI

# /etc/wpa_supplicant/wpa_supplicant-{{ WIFIINTERFACE }}.conf
network={
    ssid="{{ SSID }}"
    key_mgmt=WPA-EAP
    eap=PEAP
    identity="{{ USERNAME }}"
    password="{{ PASSWORD }}"
    phase2="autheap=GTC"
  }

WIRED

# /etc/wpa_supplicant/wpa_supplicant-wired-{{ ETHINTERFACE }}.conf
network={
    ssid="{{ SSID }}"
    key_mgmt=WPA-EAP
    eap=PEAP
    identity="{{ USERNAME }}"
    password="{{ PASSWORD }}"
    phase2="autheap=GTC"
  }

Enable services

systemctl enable systemd-networkd
systemctl enable systemd-resolved
systemctl enable wpa_supplicant@{{ WIFIINTERFACE }}

Connman runit systemd

Connman out of the box already setup wired connection. The only thing remain is to enable the service after the reboot

# run this after the reboot!
ln -s /etc/runit/sv/connmand /run/runit/service/

# If your network card doesn't turn on after booting...
connmanctl enable wifi

Basics steps for connecting to a wifi with connman

# make sure your wifi card is on
connmanctl
scan wifi
services
agent on
connect {{ LONG_WIFI_ID }}

Visit the arch wiki for support on connecting to wifi Connman

16 Closing and rebooting

Ending live session

exit
# Ignore the error if appears
umount -R /mnt
reboot

After reboot todo list:

  • Enable and start network service (systemd-networkd or connman)
  • Start some display server (Xorg, Wayland), install a desktop environment (KDE, Gnome, Cinnamon...), a window manager (DWM, i3, hyprland, sway)... or you can continue reading below

17 Post installation skippable

Those following steps are strictly personal to my setup, feel free to check it out.

Ansible

Follow the instruction on the repo Ansible

Bash scripts unmantained

I've created a fork of LARBS

git clone https://github.com/dixiedream/LARBS.git
cd LARBS
sh larbs.sh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment