Arch Linux Installation
These are my short notes on installing Arch on my laptop (an Asus Zenbook 14).
It has UEFI Boot and a single hard disk of 500Gb. It has an Italian keyboard
(it
), a NVIDIA card and an Intel processor.
Mandatory disclaimer: Do not follow this guide. Follow the real guide over in the Arch wiki.
Get an installation ISO
Download from www.archlinux.org/download/ the latest ISO and ask a friend with windows to use Rufus to make a bootable USB stick with it. Say thanks and buy them a snack.
Plug that bad boy in and hold F2
as the pc is booting up. Enter the BIOS and
set the USB stick to the highest boot priority. Once in the arch installation
environment, continue on.
Setup the setup environment
1# Set the language
2loadkeys it
3# Connect to wifi
4iwctl
Inside iwctl
you should use station wlan0 connect <some wifi>
. It will ask
for the password interactively. ping archlinux.org
to see if it worked.
Set the time, so the mirrors do no fail because they are in the future:
1timedatectl set-ntp true
Partition the disk
I assume that the disk is /dev/sda
, but change it if it’s different under fdisk -l
.
1fdisk /dev/sda
2> g # New GUID partition table
3> n # New partition
4> # Default ID
5> # Default start sector
6> +500M # Min BOOT is 300Mb
7> t # Change partition type
8> # Default ID
9> 1 # EFI system
10> n
11> # Default ID
12> # Default start sector
13> +8G
14> t
15> # Default ID
16> 19 # Linux SWAP
17> n
18> # Default ID
19> # Default start sector
20> # Default end sector - Rest of disk
21> t
22> # Default ID
23> 20 # Linux filesystem
24> p # Print table - check if everything is OK
25> w # Write to disk
Make the filesystems. I assume that /dev/sda1
is boot, /dev/sda2
is swap, and dev/sda3
is root.
1mkfs.fat -F 32 /dev/sda1
2mkswap /dev/sda2
3mkfs.ext4 /dev/sda3
Mount the filesystems:
1mount /dev/sda3 /mnt
2mkdir /mnt/boot
3mount /dev/sda1 /mnt/boot
4swapon /dev/sda2
Pacstrapping
1# Update mirrors
2reflector --latest 100 --country 'Italy,Germany,' --sort rate --save /etc/pacman.d/mirrorlist
3
4# Pacstrap basic stuff:
5pacstrap /mnt base linux-zen linux-zen-headers linux-firmware base-devel \
6 sudo man-db man-pages texinfo intel-ucode \
7 iwd neovim python git curl
8
9# Generate an fstab file:
10# This allows the kernel to know what to mount at boot, and do it automatically.
11genfstab -U /mnt >> /mnt/etc/fstab
Now we can chroot
in the new environment with arch-chroot /mnt
.
Setup the installation
While inside the new installation (previous step):
1# Set the local clock
2ln -sf /usr/share/zoneinfo/Europe/Rome /etc/localtime
3hwclock --systohc
4
5# `nvim /etc/locale.gen` and uncomment `en_US.UTF-8 UTF-8`.
6locale-gen
7echo "LANG=en_US.UTF-8" > /etc/locale.conf
8echo "KEYMAP=it" > /etc/vconsole.conf
9
10# Give the machine an hostname:
11echo "neutrino" > /etc/hotname
12
13# Change the root password
14passwd
If pac-strapping does not work due to keyring stuff, try:
1pacman-keys --init
2pacman-keys --populate
3pacman -Syu achlinux-keyring
4# Possibly follow with another pacman-keys --populate
Setup the bootloader
I use the simplest of the simple bootloaders, systemd-boot
.
It is already in the installation, as it is part of systemd
. Install it to the boot
folder:
1bootctl install
Make the loader configurations. If you boot and the kernel tells you “You’re on your own, good luck”,
you probably fucked up this step (you can fix it by returning to the live
installation, with the usb key, and redoing this step).
Edit /boot/loader/loader.conf
:
default arch.conf
timeout 5
console-mode max
editor no
Add the two main loaders for arch linux, the canonical one (arch.conf
) and the fallback one
(arch-fallback.conf
). Edit /boot/loader/entries/arch.conf
and enter:
title Arch Linux
linux /vmlinuz-linux-zen
initrd /intel-ucode.img
initrd /initramfs-linux-zen.img
options root=/dev/sda3
Then cp /boot/loader/entries/arch.conf /boot/loader/entries/arch-fallback.conf
, and
edit the copy (/boot/loader/entries/arch-fallback.conf
):
title Arch Linux
linux /vmlinuz-linux-zen
initrd /intel-ucode.img
initrd /initramfs-linux-zen-fallback.img <<< This is the only line that changed
options root=/dev/sda3
We can now reboot:
1exit # exit the chroot environment
2umount -R /mnt
3reboot
If everything goes to plan, you should get a prompt asking for username (root
) and a password
(whatever you changed it to before).
Setup new installation wifi
The live image needs some fine tuning to allow internet access.
Edit /etc/iwd/main.conf
to:
[General]
EnableNetworkConfiguration=true
[Network]
EnableIPv6=true
NameResolvingService=systemd
Edit /etc/systemd/network/25-wireless.network
to:
[Match]
[Network]
DHCP=yes
IgnoreCarrierLoss=3s
Edit the /etc/systemd/resolved.conf
file to set some DNS addresses.
Put some DNS servers from the examples (just the numerical address) to DNS=
and fallback-DNS=
. Leave a space between the different addresses.
Enable the services:
1systemctl enable --now systemd-resolved.service
2systemctl enable --now systemd-networkd.service
3systemctl enable --now iwd.service
Now you can use iwctl
to setup a connection just like the installation environment.
Remember to set the NTP servers and enable NTP sync. Edit
/etc/systemd/timesyncd.conf
and add any NTP servers you like (I use arch’s),
and enable systemd-timesyncd.service
if not enabled yet.
Post installation
Now the live environment boots and has internet access, but it is not really useful as-is.
Make a new user
1groupadd docker
2useradd -m -G wheel,docker -s /bin/zsh hedmad
3passwd hedmad
Edit /etc/sudoers
and uncomment the lines giving the wheel
group access to
sudo
. This should be done with visudo
:
1export EDITOR=/usr/bin/nvim
2visudo
Now we can restart and login with our user hedmad
. zsh
will ask some
variables to be set, but we can just ignore it and select q
(or 0
) and skip
this, as we’re gonna pull in the configs with chezmoi
.
Setup yay
1pacman -S --needed git base-devel
2git clone https://aur.archlinux.org/yay.git
3cd yay
4makepkg -si
5cd ..
6rm -rf yay
Xorg
Xorg is the most used display server. It is what renders the windows you see.
Install the xorg
package and the graphics card drivers. I use the proprietary
drivers as the open-source ones did not play nice with PRIME rendering (for some
reason I don’t really get):
1# As we are using the zen kernel, the nvidia drivers need to be recompiled
2# at every update. This is done automatically with `dkms`. To run a progam with
3# accelleration, run `prime-run <executable>`.
4sudo pacman -S xorg nvidia-dkms nvidia-prime
We need a wait to start X. We could use a display manager, but this is arch,
so it’s bloat. We install xinit
to start X:
1sudo pacman -S xorg-xinit
Add to Xorg the keyboard layout. Edit /etc/X11/xorg.conf.d/00-keyboard.conf
:
Section "InputClass"
Identifier "system-keyboard"
MatchIsKeyboard "on"
Option "XkbLayout" "it,us"
Option "XkbModel" "pc104"
Option "XkbVariant" "nodeadkeys,"
Option "XkbOptions" "grp:win_space_toggle"
EndSection
I use the it keyboard without dead keys as my main (built in) keyboard, but sometimes I need to swap to us to use my portable Corne keyboard (that uses the US layout).
Pull in the config files with chezmoi
, so we can use them when needed:
1chezmoi init https://github.com/MrHedmad/dotfiles.git
A desktop
The terminal is cool and all, but we would like a desktop. I choose plasma
, from KDE. I also add NetworkManager
to better handle GUI network manager. It also works with iwd
after some configuration (refer to the wiki).
1sudo pacman -Syu plasma networkmanager kde-applications
Get a web browser
To look at this guide more cleanly (and get off your phone), install a web browser. I choose firefox:
1sudo pacman -S firefox
I use a theme found here.
Configure the terminal
The zsh shell is currently pretty boring. Install oh-my-zsh and Powerlevel10k to give it some zest.
1# Follow the guide on their github.
2# Keep in mind that pulling a script from github and passing it to `sh` from
3# curl is a major security risk. Pull it first, then run it.
4# Reccomended: install fira code nerd font
5sh -c "$(curl -fsSL https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
6git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k
Microphone
To enable the microphone, the specific module for Alsa has to be loaded manually.
This should work out-of-the-box, but it does not. It’s an easy tweak though.
Edit /etc/pulse/default.pa
and add the following line after the line
.ifexists module-udev-detect.so
:
1load-module module-alsa-source device=hw:0,0
Test the mic with pavucontrol
(sudo pacman -S pavucontrol
) or with this snippet (needs alsa-utils
):
1test-microphone() {
2 arecord -vvv -f dat /dev/null
3}
4# Used with `test-microphone`. Shows the levels detected by the mic
:: WORK IN PROGRESS ::
Extras
Add some wallpaper (optional)
Install archlinux-wallpaper
, then choose a wallpaper by right clicking > Desktop Options:
1# They get installed in /usr/share/backgrounds/archlinux
2# They are a bit old, but they check out.
3sudo pacman -S archlinux-wallpaper
I use wave
.
Audio management
You probably need these at some point:
1sudo pacman -S alsa-utils pavucontrol
They are used to manage the low-level microphone and playback drivers/devices.
Other programs
There are many other programs which are useful to me.
1# The set command here allows for in-line comments, so you can copy-paste
2# this command as-is and run it.
3set -k
4
5sudo pacman -Syu \
6 via polkit \ # VIA needs to do some setup. Run `pkttyagent &` before the first run. See `polkit` for info.
7 okular \ # PDF and more reader. This pulls is all qt deps, but... whatever.
8 kwantum qt5ct \ # Edit qt apps looks. I use KT-Arc for the theme.
9 engrampa \ # Graphical zip file manager
As a bioinformatician, I also need these:
1set -k
2sudo pacman -S \
3 r gcc-fortran \ # gcc-fortran is needed to compile most packages
4 python python-pip python-venv \
5 rustup \ # Run the extra steps below
6 docker \ # Run the extra steps below
7 texlive-most \ # For latex, and R too (knitting). You can select just a subset of the whole package.
8
9yay -S \
10 rstudio-desktop-bin \ # Currently glitched. See the aur page
11 visual-studio-code-bin \ # The proprietary one, to access packages easily. Has telemetry.
12
13## Rust finalization
14rustup default stable
15
16## Docker finalization
17sudo systemctl enable --now docker.service
Extra packages for some R packages:
1sudo pacman -S proj