Simple Arch Linux Install

There’s no doubt about it -

Installing Arch Linux is hard.

I remember the first time looking at all the linux distributions and coming across Arch. Manual install from the command line?

Talk about intimidating!

So, why on earth would anyone want to install this advanced, ‘super complicated’ Linux distribution?

One of the main reasons to choose Arch is due to the simplicity and minimal amount of software and space that is required.

In addition, it’s fun to learn new things. There’s satisfaction in knowing you’re able to accomplish something that very few other people are capable of doing.

Check out the YouTube video below for a few of the key points:

Let’s get started because today I’ve got something special for you. You’re going to get my personal step by step guide and a detailed, but easy to understand Arch Linux installation.

But first, do to the versatility of this amazing distro, we need to make a few things clear.

There are a million ways to get Arch up and running.

Below is but one specific way. In my opinion, it’s the best way to do it.

… okay. So maybe I’m a little biased since this install meets my needs specifically, but that’s what makes this Arch so amazing!

Arch Linux is so customizable that no matter what you use it for, you can create an install that’s specific to your needs.

This is not a standard installation. This is a LVM on LUKS with a UEFI system. There is nothing basic about it.

Even though this is an advanced install, this guide is written with the noob in mind. Anyone should be able to install Arch on a similar system if they follow the steps, step by step, found in the guide below.

It’s important to remember that ever computer is different. These instructions work flawlessly on the hardware that I use.

Geforce GTX 965M

This install is on a hardcore gamer laptop

This bad boy has 16 gigabytes of RAM and 500 gigs of storage.

Why do I need such a powerful machine for a distro that can run on a computer with a minimum of 512 MB RAM and less than 800 MB of disk space?

Well, one of my favorite past times is building an ethical hacking lab which requires multiple virtual servers. Anyone who knows anything about running multiple virtual machines on a single piece of hardware all at once (sometimes up to 10 at a time or more!), knows that a resources get used up quick!

Now that we have a general idea of my personal system requirements -

Let’s get started.

Step 1 - Get A Copy Of Arch Linux on USB

On an existing Linux platform, head over to the official Arch download site.

Choose a method of getting the latest copy. There are many options to download arch including torrents (which is my preference).

Once you have a copy, plug in your USB and use the following command to get arch installed on the USB.

#! /bin/bash

dd if=/path/to/archlinux.img of=/dev/sdX bs=16M && sync

dd Command Explained

An overly simplified explanation of dd is basically that ‘if’ is the source data, ‘of’ is the destination for that data. You can kind of think of it like copy (again overly simplified).

So in this example, dd is copying your downloaded copy of Arch Linux to the USB that can be found in the path /dev/sdX (with ‘X’ being a variable usually ‘a’ or ‘b’ - depending on which slot you inserted the USB into.)

bs is simply referring to how many bytes to read and write at a time. It’s the speed at which data is transferred. 16M ensures a proper and optimal copy takes place onto our USB.

Step 2 - UEFI or ‘BIOS’ Setup

My system uses UEFI aka Unified Extensible Firmware Interface or EFI for short. Without getting too in depth, UEFI is basically the modern replacement for BIOS.

To get to the BIOS screen, press the power button and immediately start pressing the ‘F2’ button over and over again until you are brought to the BIOS menu.

Once there, arrow over to the security tab and disable secure boot so that it looks like this: Arch Linux Secure Boot

Next, tab over to the boot tab so that and disable fast boot so that it looks like this:

Arch Linux Fast Boot

Finally, save and exit the UEFI BIOS menu.

Step 3 - Boot From USB and Connect To Wi-Fi

#! /bin/bash


Step 4 - Killing 2 Birds (System Wipe and Partitioning) With Sgdisk

#! /bin/bash

sgdisk -Z -a 2048 -o /dev/sda -n 1::+512M -n 2::: -t 1:ef00

I absolutely love this one liner. Not only does it completely clean your existing data on the computer, but it also creates the partition structure we need to get arch installed properly.

Let’s dig in a little deeper:

We use -Z to destroy existing GPT data structures.

The -a tag followed by 2048 will set our alignment value.

We then want to clear out all partition data on our working partition /dev/sda using -o.

Now that everything is cleared out, it’s time to start building our partition scheme.

Using -n let’s create two new partitions. The 1st we size at 512Mb. This will be our boot partition. The 2nd will automatically size to take up the remaining disk space.

Only two partitions?

Yup. As you will soon see we are going to make our install super secure as well as fast using LVM and LUKS on our Linux file system. If we want any additional partitions we can add them in our virtual machine later.

The last part of this one liner is defining our partition types. For this we use -t. Our first partition type is the UEFI system (or just EFI) and it’s code is ef00. Our second partition is undefined, so it defaults to 8300 aka linux file system.

Step 5 - Better Encrypt Or Risk Getting Hacked

This next step protect your private data stored on partitions from what are known as ‘bare-metal attacks’. These are the attacks where hackers can physically break into your system using a USB aka pentest.

#! /bin/bash

cryptsetup -c aes-xts-plain64 -s 512 -h sha512 -i 5000 --use-random --verify-passphrase luksFormat /dev/sda2

cryptsetup luksOpen /dev/sda2 luks

Step 6 - Create Your Physical Volume, Volume Group, And Logical Volume

#! /bin/bash

pvcreate /dev/mapper/luks
vgcreate vg /dev/mapper/luks
lvcreate -l 100%FREE vg-lvol0

Step 7 - Make and Mount Filesystems

#! /bin/bash

mkfs.ext4 /dev/mapper/vg-lvol0
mkfs.fat -F32 /dev/sda1
mount /dev/mapper/vg-lvol0 /mnt
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot

Step 8 - (Finally) Pacstrap

#! /bin/bash

pacstrap /mnt \
    base base-devel \
    iw wget openssh wpa_supplicant wireless_tools dhcpcd dialog git \
    intel-ucode nvidia nvidia-libgl nvidia-utils \
    xorg-server xorg-server-utils xorg-xinit xf86-input-synaptics xf86-video-intel \
    i3 rxvt-unicode \
    vim vim-spell-en \
    lxterminal \

Step 9 - fstab

#! /bin/bash

genfstab -pU /mnt >> /mnt/etc/fstab
echo 'tmpfs    /tmp    tmpfs    defaults,noatime,mode=1777    0    0' >> /mnt/etc/fstab

Step 10 - Enter Into You’re New System

#! /bin/bash

arch-chroot /mnt

Step 11 - Locals

#! /bin/bash

echo "en_US.UTF-8" > /etc/locale.gen
echo "KEYMAP=us" > /etc/vconsole.conf
echo "LANG=en_US.UTF-8" > /etc/locale.conf
ln -s /usr/share/zoneinfo/America/Chicago /etc/localtime
hwclock --systohc --utc

Step 12 - Host Name

#! /bin/bash

echo INSERT_NAME_OF_SYSTEM_HERE > /etc/hostname

Step 13 - mkinitcpio

#! /bin/bash

sed -i "/^HOOK/s/block/block keymap encrypt/" /etc/mkinitcpio.conf
sed -i "/^HOOK/s/filesystems/lvm2 filesystems/" /etc/mkinitcpio.conf
sed -i "/^MODULES/s/''/'ext4'/" /etc/mkinitcpio.conf
mkinitcpio -p linux
bootctl --path=/boot install

Step 14 - Hosts

#! /bin/bash

sed -i "/$/ arch/" /etc/hosts
sed -i "/::1/s/$/ arch/" /etc/hosts

Step 15 - Arch Config

#! /bin/bash

vim /boot/loader/entries/arch.conf

title Arch Linux
linux /vmlinuz-linux
initrd /intel-ucode.img
initrd /initramfs-linux.img
options cryptdevice=UUID=$(blkid -s UUID -o value /dev/sda2):lvm:allow-discards root=/dev/mapper/vg0-root rw quiet loglevel=0 udev.log-priority=3

Step 16 - Boot Loader

#! /bin/bash

vim /boot/loader/loader.conf
default Arch Linux
timeout 0
editor 0

Step 17 - Set Root Password

#! /bin/bash