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
- Install preparation
- Drive partition and file system
- Bootstrap the system
- Generate fstab
non encryptedskippable - Chroot
- Initramfs
Archlinuxskippable - Locales
skippable - Hostname
- Build
- Setup root password
- Bootloader
- Create user
skippable - Create swap file
skippable - Microcodes and display drivers
- Network
- Closing and rebooting
- Post installation
skippable
# set italian keyboard layout
loadkeys itCheck if you have an IP address
ip aIf you're running an Archlinux live
iwctl
device list
station {{ DEVICE }} scan
station {{ DEVICE }} get-networks
station {{ DEVICE }} connect {{ SSID }}
quit
ip aIf you're running an Artix Linux live follow the Connman chapter then come back.
On the remote (target) machine
passwdNow check that PermitRootLogin yes is present (and uncommented) in /etc/ssh/sshd_config.
systemctl start sshd# Example of valid devices: sda, vda, nvme0n1
fdisk -l
fdisk /dev/{{ DEVICE }}- Create a new partitioning layout of type GPT with
g - Create a 300Mb partition for the EFI with
n, pressEnterfor 0 as first/starting sector then select+300Mas last/ending sector - Set the type for this partition as EFI with
tthen1for selecting the EFI type - Create another partition for the root directory with
n, this time pressEntertwo times (we need every remaining space as storage) - The type of this partition should be already set as Linux or Linux filesystem*
- Create a new partitioning layout of type DOS with
o - Create a new partition for the root directory with
n, then pressEntertwo 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
# Examples of valid EFI partition: sda1, vda1, nvme0n1p1
mkfs.vfat -F 32 /dev/{{ EFI_PARTITION }}# Examples of valid root partition: sda2 vda2 nvme0n1p2
cryptsetup -y -v luksFormat /dev/{{ ROOT_PARTITION }}
cryptsetup open /dev/{{ ROOT_PARTITION }} cryptroot# WITH encryption
mkfs.ext4 /dev/mapper/cryptroot
# WITHOUT encryption
mkfs.ext4 /dev/{{ ROOT_PARTITION }}# WITH encryption
mount /dev/mapper/cryptroot /mnt
# WITHOUT encryption
mount /dev/{{ ROOT_PARTITION }} /mntmkdir /mnt/boot
mount /dev/{{ EFI_PARTITION }} /mnt/bootChange 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# Archlinux
genfstab -U -p /mnt >> /mnt/etc/fstab
# Artix linux
fstabgen -U /mnt >> /mnt/etc/fstab# Archlinux
arch-chroot /mnt
# Artix linux
artix-chroot /mntAdd 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)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.confChoose hostname
nvim /etc/hostnameCreate or edit the /etc/hosts file
127.0.0.1 localhost
::1 localhost
127.0.1.1 {{ HOSTNAME }}.local {{ HOSTNAME }}mkinitcpio -p linuxpasswdSelect proper steps based on your current or desired setup
Setup bootloader
bootctl installEdit the content of loader.conf. Ensure those line are present
# /boot/loader/loader.conf
console-mode max
editor noCreate 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 listsyslinux-install_update -i -m -aEdit the /boot/syslinux/syslinux.cfg file checking the root partition matches with your /dev/{{ ROOT_PARTITION }}
pacman -S refind
refind-install
# Check the configuration file and eventually setup the root partition
nvim /boot/refind_linux.confIf dual boot is needed try to use separate drives for the installations.
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/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.efiThen 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.
useradd -m -g users -G wheel {{ USERNAME }}
passwd {{ USERNAME }}
EDITOR=nvim visudochange 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/fstabAgain, select based on your preference
Create these files
# /etc/systemd/network/en.network
[Match]
Name=en*
[Network]
DHCP=yes
[DHCP]
RouteMetric=10# /etc/systemd/network/wl.network
[Match]
Name=wl*
[Network]
DHCP=yes
[DHCP]
RouteMetric=20Setup Wi-Fi connection
Get a wifi interface name with
ip aCreate 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 sectionThen use this command to connect
wpa_passphrase {{ SSID }} >> /etc/wpa_supplicant-{{ WIFIINTERFACE }}.confWhen 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 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 wifiBasics 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
exit
# Ignore the error if appears
umount -R /mnt
reboot- 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
Those following steps are strictly personal to my setup, feel free to check it out.
Follow the instruction on the repo Ansible
I've created a fork of LARBS
git clone https://github.com/dixiedream/LARBS.git
cd LARBS
sh larbs.sh