Creating a killer customised Linux distro with Arch & i3: Part II

Assuming you got here from part I of this guide, you are aware that the goal of this guide is to create a fast Linux distro mainly for writing, reading web content, programming, gaming and multimedia.
As previously discussed, the opted distribution is Arch Linux, because of the structure of the OS.
Arch Linux lets you start from scratch, install the features you need and remove the bloat.
Ideal for a system built on speed, I would say.

This part of the guide covers the installation of the Arch Linux core files and the initial setup of your system.
I will cover the installation of your desktop environment and applications in a later part of this guide.


Let’s get down and dirty, shall we?
First off, you will need to get your hands on a few things:

  • A desktop or a laptop (Believe it or not, this is pretty vital to the process)
  • A recent Arch Linux ISO
  • A 4GB+ flash drive, or a good ol’ CD or DVD (I would recommend a flash drive for speed though)
  • An application to create a bootable drive or disk with (i.e. “dd” on Linux, “Rufus” on Windows)
  • Motivation (A strong disliking of everything Windows helps.)
  • Last, but not least, Time (not the magazine, silly.)

Creating your installation media

Start off the process by heading off to for your Arch Linux ISO.
Feel free to pick your poison in download manners (Torrent, Mirror download close to you).

Once your download is done, create your bootable media with a tool (I’ll use creating a boot USB with “dd” as an example).

sudo fdisk -l
(to find out the what drive your USB is mounted to)
In this image you can see that in my case, the USB drive is mounted on /dev/sdb1.

First off, let’s unmount the drive with the following command:
sudo umount /dev/sdb1

From that point on, you can navigate to the directory where you stored your ISO (let’s assume ~/Downloads) with the following command:
cd ~/Downloads

I’ll assume the ISO file is called “arch.iso”. (Be sure to edit the command to your situation!)

sudo dd bs=4M if=arch.iso of=/dev/sdb1


Now that you have your boot drive, boot with the USB drive inserted.
You will be presented with the following screen:

I’ll assume you’re using a 64-bit machine, so in that case you will select the option “Boot Arch Linux (x86_64)”.
After a quick initialisation, you will be logged into a root environment, that will allow you to install Arch from the command line:


Check if you have internet access (I’ll assume a wired connection here, for more information on a wireless connection, see: Arch Wiki wireless network configuration):

If you get a ping back, it means you have internet access.

Verify boot mode:
ls /sys/firmware/efi/efivars

This command verifies if you are in UEFI boot mode.
If you get output here, you will have to do some additional steps when it comes to partitioning and bootloader.
But I’ll get to that later.

Set the correct time:
timedatectl set-ntp true && timedatectl set-timezone Europe/Amsterdam

Be sure to edit the timezone to the timezone you’re in!


Verify the existing partioning:
fdisk -l

fdisk -l shows you all the disks, with the optional partitioning.

Configure your partitions:

cfdisk is a console based partition tool. If you have multiple disks, be sure to execute both “cfdisk /dev/sda” and “cfdisk /dev/sdb”.

Create a partitioning like below:

The partitioning in the image is one where you separate the /home/ dir on another partition. This is not necessary and your installation will work if you don’t do this.

If you have a UEFI system, be sure to create an UEFI partition.
This partition should be around 256M, according to the Arch Wiki, and should be created before any other partition.
For more info, check out the Arch Wiki.

Once you have your partitions all set up, you can carry on to the formatting of your newly created partitions;
For your root (/) and /home directories, be sure to format them as EXT4 with the following commands:
mkfs.ext4 /dev/sdXY

Where X is the letter identifier, and Y the number identifier of your partition. In my case, I could run “mkfs.ext4 /dev/sda1” to format my root partition.

Format your swap partition:
mkswap /dev/sdXY && swapon /dev/sdXY

Where X is the letter identifier, and Y the number identifier of your partition. In my case, I could run “mkswap /dev/sda1 && swapon /dev/sda1” to format my swap partition.

In the case of an UEFI installation, be sure to format your UEFI partition as follows:
mkfs.fat -F32 /dev/sdxY

Where X is the letter identifier, and Y the number identifier of your partition. In my case, I could run “mkswap /dev/sda1 && swapon /dev/sda1” to format my swap partition

Mount your root and home directories:
mount /dev/sdXY /mnt
mkdir /mnt/home
mount /dev/sdXY /mnt/home

In case you’re installing in UEFI mode, be sure to create a /boot dir as well:
mkdir /mnt/boot
mount /dev/sdXY /mnt/boot

Once you’ve mounted all your directories, double-check your mounts with df

If everything is in order, you can now install your base system:
pacstrap /mnt base base-devel

This command installs both the base-devel packages, allowing for more tools at your disposal.

Once your base system is fully installed, create an fstab file, which creates information necessary to automatically mount directories.

Creating the fstab file is done as follows:
genfstab -U /mnt >> /mnt/etc/fstab

Alternatively, you can also pass the “-L” parameter instead of the “-U” parameter, to display labels instead of UUIDs.
Do a quick check of your fstab file with cat:

You can now switch to the root of your just installed system, to finish up setting up your system:
arch-chroot /mnt /bin/bash

Open /etc/locale.gen with your favourite text editor and uncomment the language that you prefer.
I prefer English (GB), so I’ll uncomment the line “en_GB.UTF-8″:

Then proceed to execute the command locale-gen which should give the following output:

With the command echo LANG=en_GB.UTF-8 > /etc/locale.conf you will tell your Arch installation that you’re using the locale files that you just generated.
If you’re not using en_GB.UTF-8, be sure to replace it with the one you use!
Then, verify with cat:

Use the command ln -sf /usr/share/zoneinfo/Europe/Amsterdam /etc/localtime to create a symlink to your timezone settings. Again, change this to reflect your own timezone!

Set your hardware clock, and verify it afterwards with the following commands:
hwclock --systohc and hwclock --show:

Set your machine’s hostname with the following command:
echo arch > /etc/hostname

(“arch” is the hostname for my machine, be sure to swap it with your preferred one.)

Then, edit your /etc/hosts file and add the following line:
Again, replacing “arch” with your preferred machine name.

Persist your networking with systemctl enable dhcpcd

Install a bootloader (my preference goes out to GRUB, so I’ll refer to that in this guide.):
pacman -S grub

(Note: if you’re installing it alongside another OS, install os-prober as well.)

Once GRUB is installed, run the following command:
grub-install /dev/sda

If you’re running an UEFI installation, be sure to run the following command instead:
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=grub

Independent of either UEFI or BIOS installation, issue the following command to create GRUB configs:
grub-mkconfig -o /boot/grub/grub.cfg

Create a root passwd, exit and reboot your machine:

Now, remove your installation media and boot your device.

If everything went smoothly, you should be seeing something like this:

…Congratulations, you just installed a Linux distribution from scratch!

But, you’re not rid of me yet!
Now comes the fun part of slowly turning a generic Arch install into your Arch install.

Post-installation and system configuration

After the reboot completes, log in as root and be sure to update your system with the following command:
pacman -Syu

This ensures that all applications that were installed during initial installation are up to date.
Now, open up your pacman configuration file under /etc/pacman.conf and uncomment the [multilib] repository.
This will then look as follows:
Include = /etc/pacman.d/mirrorlist

Once this is done, make sure you update your repository list with the following command:
pacman -Syy

This will look something like this:

Creating a user

Now that your system is in order, you can make your own user account.
Because doing everything with root is very, very bad practice.
You can create a new user as follows:
useradd -m -g users -G wheel,storage,audio,power -s /bin/bash rik

This command creates a new user called “rik”, who has the ability to turn the machine on and off, has access to audio, storage and is in the wheel group, which I will add super user rights to in a few. This user also uses the bash shell, but you can alter this to your liking.

Now, assign a password to your newly created user, by issuing the command “passwd [username]” as follows:
passwd rik

Now that your user is created with a password, make sure this account has the ability to issue commands as a super user.
This is done as follows; open the sudoers file with:

(tip: if you’re not comfortable with vi, you can change the editor by typing EDITOR=nano visudo, where nano is the editor of choice.)
Once this file is open, uncomment the following line:
%wheel ALL=(ALL) ALL

Since your new user account is set up, I would recommend switching to this account now and doing the following steps with that account.
This is done with the su rik command (be sure to change “rik” with your account name).

Driver installation

If you don’t know which brand of hardware you have, it is wise to issue the following command first:

This will give you output of all the PCI slots in use, including your graphics card.
In this list, look for the term VGA:

In my case, since I’m installing on a virtualbox, it will show the VirtualBox Graphics Adapter.
On your installation it will show either an Nvidia, AMD or Intel graphics card.
To generate an overview of all the available open-source drivers, issue the following command:
sudo pacman -Ss | grep xf86-video

This will give the following output:

Install your driver with the command sudo pacman -S xf86-video-[YOUR GRAPHICS ADAPTER]. Again, change the YOUR GRAPHICS ADAPTER part with your actual graphics adapter (Duh.)

I would advise you to install the proprietary drivers for Nvidia, if you plan on gaming with an Nvidia card because of performance.
To do this, issue the command sudo pacman -S nvidia libgl
After installing your drivers, I would advise you to reboot your machine.

X environment

Once your machine is rebooted, install the X environment:
sudo pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils xorg-twm xterm xorg-xclock

After the installation is finished, be sure to test your X environment with the following command:

You should be getting the following screen:

To exit your X environment, type exit in the terminal and press Enter.

(If you get an error saying that X can’t be started, verify your graphics driver installation.)

Once your X environment works, install your display manager (if you choose to use one.) and Window Manager. In my case I’ll install LightDM as my display manager, and i3 as my Window Manager:
sudo pacman -S lightdm lightdm-gtk-greeter i3

Be sure to install all the goodies in the i3 package (just press Enter):

You can always add a lightweight desktop environment during this installation as a fallback graphical desktop environment, by adding mate or lxde to the installation list. But that’s up to you.

Once everything is installed, enable lightdm to start on boot with the following command:
sudo systemctl enable lightdm

Subsequently, start the lightdm service with:
sudo systemctl start lightdm

You’ll be taken to your Display Manager GUI:

You’ll notice immediately that the fonts are a bit off.
This is because the fonts that lightdm uses by default are not installed yet.
We’ll fix this as soon as possible during the installation process.

Preparation for usage/ricing

First off, install yaourt to be able to install AUR packages.
This is done by first adding the repository for yaourt to your /etc/pacman.conf:

Server =$arch

And change the variable SigLevel to Optional as follows:

Your /etc/pacman.conf should look like this at the bottom:

Update your repositories with sudo pacman -Syy:

Then, install yaourt with the command:
sudo pacman -S yaourt

In order to use your system to the fullest and to be able to make your system more appealing visually (ricing), you’ll need a few things:

  • An audio handler
  • An i3 bar
  • A lockscreen handler
  • A file manager
  • A webbrowser
  • A background image handler
  • A screenshot handler
  • A compositor
  • A terminal emulator of your choosing
  • A text editor of your choosing
  • A hardware monitor
  • Multimedia applications (Spotify, Steam, Kodi, etc.)

In my case, this would be respectively;
pulseaudio, pavucontrol, playerctl as my audio handler,
polybar as my i3 bar,
i3lock as my lock screen handler,
ranger for file management,
firefox for web browsing,
feh for background images,
scrot for screenshots,
compton as my compositor,
termite as my terminal emulator,
vim as my preferred text editor,
conky as my hardware monitor
and the aforementioned multimedia applications.
I will also be using cava as a audio visualiser for Spotify.

Thankfully, these applications can all be installed with 2 commands:
sudo pacman -S ranger feh firefox scrot compton termite vim kodi steam steam-native-runtime lib32-alsa-plugins lib32-curl lib32-libgpg-error conky pulseaudio pavucontrol playerctl pulseaudio-ctl

Be sure to select font #4: ttf-dejavu:

yaourt -S polybar spotify cava

Do NOT run yaourt as super user, as it could severely break stuff (and not like the Limp Bizkit song).

Once you’ve installed all the applications listed above, I’d advise you to do a quick reboot.
If everything worked out nicely, you should see your Display Manager with proper fonts, and you should be able to select “i3” as a window manager for your session:

Once you login, you will be prompted to go through an initial (very basic) setup of i3:

Since we’re done with the system configuration, I would like to invite you to check out part III of this guide; Customising and ricing your installation.

If you have any question regarding this guide, be sure to drop me a line in the comments!

Leave a Reply