Arch Linux - Base Installation

This post will assume the following partition layout:

  • / for system installation,

  • /home for user files,

  • /data for any other data. I usually keep all my development on this partition, so when I need to reinstall the system, I will not be formatting this partition.

Format partitions

Issue lsblk to identify the partirions that you will need. In my case, since I only have one drive it will be:

mkfs.ext4 /dev/sda1
mkfs.ext4 /dev/sda2

Mount partitions

mount /dev/sda1 /mnt
mkdir -p /mnt/home
mkdir -p /mnt/data
mount /dev/sda2 /mnt/home
mount /dev/sda3 /mnt/data

Connect to the Internet

There are few ways of foing it, but the most convinient for me is to execute the below, and just choose the network and type in the password

wifi-menu -o

Setup mirrors

I tend to use vi to edit text files, but you can also use nano. Just uncomment the closest mirror to you, and save file.

vi /etc/pacman.d/mirrors

Install the system

I also install base-devel group, to include some additional packages

pacstrap /mnt base base-devel

Export partition table

We need to export the current partition table to /etc/fstab so when we reboot, the newely installed system boots.

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

Chroot into new install

We need to chroot into new installation to setup some basics before we reboot.

arch-chroot /mnt

Install basic packages

pacman -S grub-bios linux-lts linux-lts-headers iw wpa_supplicant dialog

Prepare locales

Uncheck the required locale based on your language, and save file.

nano /etc/locale.gen

Generate locales

locale-gen

Additional tweaks

For some reason I need to manually specify LANG variable, so first command adds it. The second command forces the terminalsto have uk keymap

echo LANG=en_GB.UTF-8 > /etc/locale.conf
echo KEYMAP=uk > /etc/vconsole.conf

Timezone setup

rm /etc/localtime
ln -s /usr/share/zoneinfo/Europe/London /etc/localtime
hwclock --systohc --utc

Set hostname

echo arch > /etc/hostname

Set root password

passwd

Install boot manager

grub-install --target=i386-pc --recheck /dev/sda

Install unicodes if you need to

pacman -S intel-unicode

Configure boot manager

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

Exit chroot

We can now exit chroot, unmount all partitions and reboot to our new installation.

exit
umount -R /mnt
reboot

Login

In the following steps we will add system user and grant them with the administrative permissions. Login as root (as it’s currently the only system user) and execute following commands, replacing any USERNAME with your actuall username:

useradd -m -G wheel,users -s /bin/bash USERNAME
passwd USERNAME

This user was added to the wheel group. We will now allow any users in that group to perform any administrative system operations. Uncomment the following in visudo

%wheel ALL=(ALL) NOPASSWD: ALL

Add 32-bit packages support

If you will be installing programs that will require 32-bit package versions like Steam, enable them by uncommenting in /etc/pacman.conf

[multilib]
Include = /etc/pacman.d/mirrorlist

Connect to the Internet

wifi-menu -o

Update the system and enable 32-bit packages

pacman -Syu

At this point we have base installation complete. In next parts, we will install graphical environment (i3) and prepare the system for Web Development using:

  • PHP in Docker LEMP stack

  • Django

  • Hugo

Stay tuned.