First of all, this tutorial doesn't prevent you from following the ArchWiki - Installation guide, it is not standalone.
Pre-installation#
First basic steps#
For those first steps, I think you are a big boy enough to do them alone.
So you can download the ArchLinux iso, verify its signature, boot the live environment, set the keyboard layout, verify the boot mode, connect to the internet, update the system clock. If you're not confident with those steps check the ArchWiki.
Partition the disks#
Identify the block device associated to disks with lsblk
or fdisk -l
.
Now we will use dm-crypt to encrypt an entire system with LVM on LUKS on only one disk.
UEFI is enabled, so I will use a GPT partition type and an EFI system partition (ESP).
So we will have two partitions: one ESP and one partition that will host the LUKS container.
Secure erase#
Don't forget to check the drive preparation.
LUKS container#
Lot of people will use the default values of cryptsetup
but for a more secure setup I used camellia
for ciphering rather than the NIST validated (understand NSA compliant) AES algorithm, the much stronger and newer password-based key derivation function argon2
rather than the default pbkdf2
, and the SHA-2 sha512
instead of the default sha256
because SHA-3 keccak
or finalist blake2
are not available here.
cryptsetup benchmark
won't show you those and sometimes even /proc/crypto
will not show you camellia
for example (even if it is available).
Create the LUKS encrypted container:
If you don't fear the NSA or just want to comply to your corporate policy use those settings than can be more than 10 times faster thanks to the embedded TPM enabling to use AES-NI (AES instruction set).
Open the LUKS container:
The decrypted container is now available at /dev/mapper/cryptlvm
.
Preparing the logical volumes#
Create a physical volume on top of the opened LUKS container:
Create a volume group, adding the previously created physical volume to it:
Create all your logical volumes on the volume group:
Format your filesystems on each logical volume:
Mount your filesystems:
Check the partition table: lsblk -f /dev/sda
.
Installation#
Select the mirrors#
Again, here it let you select the mirrors.
Install the base packages#
Install the base + some useful packages:
Note: neovim
is the Vim's future text editor, the command called nvim
will allow to edit files from the chrooted environment.
Fstab#
Generate an fstab file by UUID:
Check /mnt/etc/fstab
correctness and add /efi/EFI/arch /boot none defaults,bind 0 0
to mount the EFI mountpoint at boot since we mounted ESP outside of /boot
.
So you should have something similar to:
Chroot#
Change root into the new system:
Time zone#
Set the time zone:
Run hwclock
to generate /etc/adjtime
:
Localization#
Uncomment locales in /etc/locale.gen
, and generate them with:
As I'm French, for me locales were:
Set variables in /etc/locale.conf
, for example:
Set the keyboard layout in /etc/vconsole.conf
, for example (for AZERTY
default keyboard):
Network configuration#
Create the hostname file (/etc/hostname
):
Add matching entries to /etc/hosts
:
Initramfs#
Configuring mkinitcpio HOOKS in /etc/mkinitcpio.conf
to work with encrypt
:
Recreate the initramfs images:
Copy linux images to ESP:
Root password#
Easy!
Change root password:
Boot loader + Microcode (rEFInd)#
I know what you're about to say:
WTF man! Why don't you use GRUB?
Because rEFInd works better for EFI partitions as the name states.
About Microcode:
For AMD processors, install the amd-ucode
package.
For Intel processors, install the intel-ucode
package.
Warning: this won't work for VirtualBox, check the ArchWiki.
Then we need to edit /boot/refind_linux.conf
:
Note: Use backslashes \
for initrd
and forward slashes /
for other attributes.
Note: The UUID value is the one of the device block where is the LUKS container.
For example, you can display it with lsblk -f /dev/sda2
or retrieve it with
lsblk -f /dev/sda2 | grep nvme | awk '{ print $4 }' >> /boot/refind_linux.conf
.
Note: add pci=noaer
to disable PCI Express Advanced Error Reporting
if you have a lot of error displaying in the TTY.
Copy /boot/refind_linux.conf
to /efi/EFI/arch/refind_linux.conf
.
And also edit /efi/EFI/refind/refind.conf
in order to work with %v
in refind_linux.conf
:
So this way we have to configure the boot entries only once for multiple kernels.
Do not bind mount the ESP to /boot
before using refind-install
else it will fail:
Alternative bootloader (Grub)#
Warning: As I'm not using Grub, this section may be outdated.
If you like pain (and don't have any style), you can still try to make GRUB2 works with an UEFI LVM on LUKS install.
Since we have linux
, linux-zen
and linux-lts
installed, we want a better multiple kernels management:
So we will edit /etc/default/grub
:
- Disable submenu:
GRUB_DISABLE_SUBMENU=y
- Recall previous entry:
GRUB_DEFAULT=saved
andGRUB_SAVEDEFAULT=true
No we need the configuration for LVM on LUKS:
Add some custom entries in /etc/grub.d/40_custom
:
Install grub fully into the ESP:
Then generate the grub config:
The linux part of /efi/grub/grub.cfg
should now look like this:
Reboot#
You know how to reboot right?
Ok ok, but it's better to unmount all the partitions first umount -R /mnt
.
Post-installation#
Before we begin#
It could be nice to setup a DHCP client to avoid manual IP configuration.
Enable this DHCP client temporarily (we'll install dhclient with NetworkManager later):
Then list you interfaces to retrieve your interface name:
networkctl list
- or
ip link
For example for a Wired adapter using DHCP,
create the file /etc/systemd/network/20-wired.network
:
Then restart the network manager and it's included DHCP client & start the DNS client:
Now we have Internet access, let's update the system before installing anything:
We'll use a lot this terminal so let's get a fancier zsh shell:
To enable the ZSH plugins, add this to your .zshrc
:
System administration#
Users, groups and privilege escalation#
We already installed sudo
with pacstrap
.
Add a new user and assign sudo privilege
And uncomment %wheel ALL=(ALL) ALL
.
Exit root session and log back as user.
Creating default XDG directories
Package management#
Repositories#
Send stats about packages.
Arch User Repository#
Install a pacman wrapper for AUR support, for example pikaur
, pakku
, yay
:
Please, don't install yaourt
, check the pacman wrapper ArchWiki page.
Graphical user interface#
Display drivers#
Install some utils and associated drivers (example for intel iGPU):
See the wiki for AMD & NVIDIA drivers.
Desktop environments#
As we want a true graphical library backed desktop environment (understand a Qt DE as GTK is only the GIMP library), we have barely two choices: KDE or LXQT, but LXQT is very light (nice for a VM but too light for a nice desktop experience).
Install KDE Desktop Environment
Configure KDE:
- System Settings > Workspace Behavior > Desktop Effects > Disable
Translucency
that behave bad for dark themes. - System Settings > Startup and Shutdown > Background Services > Disable Bluetooth, we don't need it
- System Settings > Search > File Search > Deselect "Enable File Search"
- System Settings > Regional Settings > Set Language and Formats
- System Settings > Inputs Devices > Keyboard > Layouts > Check
Configure layouts
and add your keymap
PS: you may want to install a VTE before rebooting or you'll be forced to use a TTY.
Audio server#
Replace PulseAudio with PipeWire + WirePlumber:
Refs.: PipeWire - Audio, WirePlumber
Networking#
If not already installed, install NetworkManager network manager and applets, (also install DHCP client now before internet is interrupted).
Strenght of NetworkManager
are: official package for KDE applet, integrated wifi manager, nice integration with KDE.
Drawback of NetworkManger
: does not support dhcpcd ≥ 9.0.0 currently. So let's change of DHCP client and use dhclient
instead.
Encrypted Wi-Fi passwords by using KDE wallet.
Alternative with systemd-resolved#
Install systemd-resolvconf
.
Disallow /etc/resolv.conf
overwrite if you plan to install a DNS server like
dnsmasq or systemd-resolved, else skip this:
Replace /etc/resolv.conf
with a symbolic link so any software will rely on 127.0.0.53
.
Define DNS servers:
Enable lax DNSSEC:
Enable lax DNS over TLS:
Disable multicast services:
Restart and apply:
Verify the configuration was applied with resolvectl status
.
General#
Software#
Install a VTE (Virtual Terminal Emulator):
Install net browsers and plugins.
Install media software (lot of codecs are already installed as dependencies of media players):
- video player: vlc, smaplayer
- media metadata: mediainfo mediainfo-gui
- video converter: handbrake
- download youtube audio/video: yt-dlp
- audio player: audacious clementine elisa
- image viewer: nomacs gwenview
Install general software:
Man#
Install the man CLI and the linux pages:
Fonts#
Install some fonts!
Theming#
Colorized command output#
Aliases for colorized output:
Color wrappers:
KDE#
The following setup was for Qt5 / Plasma 5 and is no longer working unless it has been ported since now.
- DE: KDE/Plasma
- Theme engine: Kvantum https://github.com/tsujan/Kvantum/tree/master/Kvantum
- Global theme: Midnight Red https://store.kde.org/p/1231509/
- Plasma style: Midnight Red https://www.opendesktop.org/p/1231508
- Application style: kvantum-dark (Midnight Red tweaked) https://www.opendesktop.org/p/1231512
- Colors: Midnight Red https://www.pling.com/p/1231507
- Icons: Obsidian Red https://store.kde.org/p/1169579
- Fonts:
- General: Noto Sans 10 pt
- Fixed width: Hack 9pt
- Terminal Emulator
- Terminal: Konsole https://konsole.kde.org/
- Konsole colorscheme: Otto https://store.kde.org/p/1358261
- Tmux
- Theme: Tmux Themepack (Powerline Default Red) https://github.com/jimeh/tmux-themepack
- Wallpaper
- Makepkg Not War - BlackArch Linux wallpaper http://fav.me/ddqz8wc
- Mouse
- Cursor: Bibata Extra (Bibata Dark Red) https://store.kde.org/p/1269768/
- VSCode
- Color Theme: One Dark Pro https://marketplace.visualstudio.com/items?itemName=zhuangtongfa.Material-theme
- File Icon Theme: Seti https://marketplace.visualstudio.com/items?itemName=qinjia.seti-icons
- Application Launcher
- Start Icon: Ardour Icon from Qogir https://www.pling.com/p/1296407/ https://github.com/vinceliuice/Qogir-icon-theme/blob/master/src/scalable/apps/ardour.svg
- oh-my-zsh
- Theme: Spaceship https://github.com/denysdovhan/spaceship-prompt
Ref. [KDE/Plasma] AL/BA DarkRed - my 1st rice
As Midnight theme seemed broken lately, I replaced it with Neon Knights Red (still Qt5 / Plasma 5), which is even better looking and doesn't require an external icon pack or kvantum. I made a color matching wallpaper theme pack.
Since not many themes have been ported for Qt 6 / Plasma 6, I'm now using Otto with this matching wallpaper I made.
Oh-my-zsh#
Install oh-my-zsh:
Then I'm using the Spaceship ZSH theme:
And since we are using the AUR package of oh-my-zsh, we will use the spaceship theme as an oh-my-zsh theme:
I'm using this zshrc.
Tmux#
Install a Terminal multiplexers:
Then I'm using a Powerline theme of Tmux Themepack.
This manually installable like that:
Then adding a line with the desired theme in ~/.tmux.conf
:
I'm using this tmux conf.
Neovim#
Install neovim:
I'm using this neovim config.
SDDM#
Install SDDM theme (sddm-sugar-dark) via System settings > Startup and Shutdown > Login Screen (SDDM) > Theme > Get new login screens.
Then custom the theme: sudoedit /usr/share/sddm/themes/sugar-dark/theme.conf
.
Most often you'll want to change those parts:
rEFInd#
Install rEFInd theme (rEFInd theme Regular):
Nice to have#
Set X11 keyboard layout (example: for password prompt in SDDM):
For automounting device:
Spectacle is a great KDE screenshot (and screen recording) application (working on Wayland). The plugins allow to upload picture to various cloud providers.
Spell checker (this one will work with vscode) but it's better if you can run a languagetool server:
KDE Partition Manager is like Gparted but in Qt.
Thunderbird is the most powerful email client but uses GTK. KMail is also mature and feature-rich but uses Qt and can be integrated into Kontact (with agenda, contacts, etc.).
Install a FTP, SFTP client.
Some pastebin clients:
Veracrypt is a disk encryption manager and create encrypted containers.
The best tldr client so far: tlrc.
Reflector#
Install Reflector:
a script which can retrieve the latest mirror list from the MirrorStatus page, filter the most up-to-date mirrors, sort them by speed
Automation#
Pacman hook#
You can also create a pacman hook that will run reflector and remove the .pacnew
file created every time pacman-mirrorlist
gets an upgrade.
Create /etc/pacman.d/hooks/mirrorupgrade.hook
:
This will get an unlimited list of all type of mirrors (IPv4/IPv6, ftp,https,http,rsync) located in France that synchronized within the last 24 hours and sort them by download speed.
Systemd service timer#
Run reflector
on a weekly basis, create /etc/systemd/system/reflector.timer
:
But we will also need a service file /etc/systemd/system/reflector.service
:
You can then start reflector one shot with systemctl start reflector.service
, or enable it to start at each boot with systemctl enable reflector.service
or just use the one week timer: systemctl start reflector.timer
and systemctl enable reflector.timer
.
PS: do not forget sudo systemctl daemon-reload
to get the new service available.
Virtualbox (host)#
Install VirtualBox, the dkms module and linux hearders:
Install the extension pack:
BlackArch#
We can transform our ArchLinux into a penetration testing distro and security lab by adding the BlackArch repos on top of it.
I also made a meta package to quickly install all common tools required for penetration testing: