Minimal Arch Linux Installation Guide: Get Ready In Half An Hour

Created: 2019-02-01

Step by step guide to install a minimal Arch Linux OS with graphical user interface, a terminal emulator and a browser in just 20 - 30 minutes. But of course:

If you want to try it, I would recommend you to install it first on a virtual machine, so you can’t break anything.


The default console keymap is US. Available layouts can be listed with:

ls /usr/share/kbd/keymaps/**/*.map.gz

Then load your prefered layout:

loadkeys <lang-code>

For example:

loadkeys de-latin1

Are you connected to the Internet? You absolutely need Internet for the installation! If your computer is connected to a LAN cable, that shouldn’t be a problem unless you’re using completely exotic hardware.

ping -c 3 google.com

If you are not connected to the Internet, check your available network interfaces…

ip link

Output could something like this:

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN mode DEFAULT group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
2: enp0s25: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN mode DEFAULT group default qlen 1000
    link/ether xxxxxxxxxxxxxxxxx brd xxxxxxxxxxxxxxxxx
3: wlp3s0: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc mq state UP mode DORMANT group default qlen 1000
    link/ether xxxxxxxxxxxxxxxxx brd xxxxxxxxxxxxxxxxx

…and try to configure your favorite one with DHCP:

dhcpd <INTERFACE>

For example:

dhcpd enp0s25

Or use your WLAN interface to connect to the Internet:

wifi-menu

Update the package repository:

pacman -Syy

Install the reflector package which generates an optimized mirror list based on the given country name. (In this case for Germany):

pacman -S reflector
reflector -c "Germany" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist

Have a look at the available hard disks and their partitions. The partitions are not important now, but it can make it easier to identify your disks and reduce the risk of overwriting the wrong one:

fdisk -l

Run cfdisk on your selected hard drive and create a primary and bootable partition. It is important not to apply cfdisk to a partition, but to the disk itself. /dev/sda != /dev/sda1

cfdisk /dev/sdX

After you have created the partition, it have to be formatted. For example with ext4 or btrfs. Now it is important to select the partition:

mkfs.ext4 /dev/sdXY

You now have to mount the partition created this way to /mnt:

mount /dev/sdXY /mnt

The following command installs the base system on the given partition:

pacstrap -i /mnt base

If there are problems with incorrect packet data (invalid or corrupted package (PGP signature)), run the following commands and try again:

pacman-key --init
pacman-key --populate archlinux
pacman-key --refresh-keys

After the installation is finished you can create the fstab file with the following command:

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

Now chroot into your currently installed system with bash:

arch-chroot /mnt /bin/bash

Install nano:

pacman -S nano

Edit /etc/locale.gen and uncomment your preferred language(s) for utf-8 and en_US.UTF-8 UTF-8:

nano /etc/locale.gen

For example:

de_DE.UTF-8 UTF-8 
en_US.UTF-8 UTF-8

And now, create your locale file(s):

locale-gen

(The next two points can be skipped if you later want to synchronize the time settings over the Internet.)

Select your time zone. (With a few chars and the tab key you can auto complete possible continents and cities):

ln -sf /usr/share/zoneinfo/<CONTINENT>/<CITY> /etc/localtime

For example:

ln -sf /usr/share/zoneinfo/Europe/Berlin /etc/localtime

Update your hardware clock:

hwclock --systohc --utc

Give your computer a name (hostname):

echo <HOSTNAME> > /etc/hostname

Create/edit /etc/hosts and add your hostname and some needed informations:

nano /etc/hosts
127.0.0.1   localhost.localdomain   localhost                    
::1              localhost.localdomain   localhost
127.0.1.1   localhost.localdomain   <HOSTNAME>

Change the root password:

passwd

Install sudo, grub and the kernel. Optional: dialog, netctl, dhcpcd and wpa_supplicant if you have set up your Internet connection with wifi-menu, so you can use wifi-menu again after the next reboot:

pacman -S grub sudo dialog netctl wpa_supplicant dhcpcd linux linux-headers linux-firmware

Install Grub on your hard disk (not the partition). If you have other non Linux/Unix-like operating systems on your computer (e.g. Windows) and want to be able to boot them via Grub then install os-prober and mount it, Grub should recognize the operating system then:

grub-install /dev/sdX

Create the grub configuration file:

grub-mkconfig -o /boot/grub/grub.cfg

At this point you should enable the dhcpcd daemon to your preferred network interface to avoid doing this at every new startup. (Not necessary if you used wifi-menu and want to stay with it):

systemctl enable dhcpcd@<INTERFACE> --now

Exit the chroot environment:

exit

Unmount the arch partition:

umount -R /mnt

Reboot your system (Important: Did you configure grub correctly and without error messages? If this is not the case, you can only boot into your newly installed system under certain circumstances {boot from live medium again, mount your existing /mnt partition, chroot into it and try to install grub again}. So you should be sure now):

reboot

Login as root and create a new user:

useradd -m -g users -G wheel -s /bin/bash <USERNAME>

Change the password for your new user:

passwd <USERNAME>

Edit the /etc/sudoers file and uncomment the following line:

nano /etc/sudoers
%wheel     ALL=(ALL) ALL

Exit the root environment:

exit

Login as new created user and install X, a window manager with a simple menu and status bar, audio, a terminal emulator and a web browser (In this example i3 with dmenu and i3status, the xfce4 terminal and chromium):

sudo pacman -S pulseaudio pulseaudio-alsa alsa-utils xorg xorg-xinit i3-wm dmenu i3status chromium xfce4-terminal

Put i3 in your ~/.xinitrc file, so startx knows what to do:

$ echo "exec i3" > ~/.xinitrc

Start X:

startx

No sound?

Type win + enter (to open the installed terminal) execute the following command and try again:

alsactl init

There you go. Now you have a minimal Arch Linux operating system on your computer. Without garbage and only with the software you wanted. With win + d a small menu opens at the top of the screen - from there you can start your programs.


TODO