Arch Linux is not a Linux Operating system for distro hoppers. It’s that kind of distro which once installed, you forget about formatting your hard drive and doing a fresh installation all over again. In this tutorial, we’ll look at how to install Arch Linux.
Arch Linux and its derivatives are rolling release, meaning you get fresh packages from upstream as soon as they are released.

Major advantages of Arch Linux are: distro

  1. It is not a bloated distro: Arch doesn’t ship with software packages that might not be of any use to the user. Arch let you install only the things you really need, this let you strip unnecessary features that comes by default with many Linux distros like Ubuntu, Fedora, OpenSUSE e.t.c. You build a lean and fast system.
  2. AUR ( Arch User repository) is really amazing, easy and peasy. It gives you access to lots of software packages not available in official repositories. This is a plus as compared to other Linux systems.You can use PKGBUILD without any manual intervention.
  1. Pacman package manager that automatically compile packages for you.
  2. Rolling release: This means you won’t have to reinstall your system. You always have newest packages in your system since all the packages are vanilla, practically pure from upstream
  3. Arch has a very detailed wiki making it best Linux reference, not only providing Arch Linux tutorials and how to, it gives you general Linux knowledge.

How to install Arch Linux is a bit complicated as compared to many other Linux distributions. There are projects aimed at simplifying Arch Linux installation, these include Manjaro, Antergos, Apricity,Ninja and many others. You can try simplifying installation of Arch Linux with those distributions if you don’t have all the time to build your Arch from the ground up.

How to install Arch Linux – Motivation

This mini-ebook was written to help you build your own Arch Linux desktop or server without the need of pre-build distros. I will provide here overview of the common ways to boot the installation media and get started. Remember that any installation of Arch needs an active internet connection since its installation process retrieves packages from a remote repository. You can do an offline installation of packages but I don’t recommend this method since it requires deep understanding of Arch Linux and Linux system in general.

Most guidelines provided here are simplified wiki’s. You can use my ebook alongside Arch’s wiki documentation. I’ve used a lot of screenshots and pictures for illustration purposes and to help new users follow along easily.

If you’re installing an Arch-based Linux distribution like Manjaro or Antergos, you may have to skip some parts of this section because they do offer GUI installer. It is a point to note that Arch installation is done in text mode (using terminal) only.

Download Arch ISO

You have to download Arch Linux ISO image to use in installation, it can be downloaded from:
Official Website: https://www.archlinux.org/download/

You can install Arch using bootable DVD or USB flash drive/key/stick for booting in BIOS and UEFI systems. A LiveUSB, LiveCD system can be used for installing Arch Linux, perform system recovery or maintenance. It is to be noted that live media uses SquashFS which discards all changes once the computer shuts down.

Complete steps of installing Arch Linux are as outlined below.

  1. Create bootable medium

1.1.1: Create bootable USB flash stick on a Linux system.

The best tool to create a bootable ISO on a Linux host is dd command. Make sure you’ve selected correct drive before issuing dd command, failure to may render your external storage drive unusable.

I recommend you use lsblk command to confirm usb drive.

1.1

My USB drive is on /dev/sdb.The syntax for creating bootable USB stick with dd command is:

# dd if=/path/to/archlinux.iso of=/dev/sdx bs=block-size status=status-like-progress && sync

Below example will create bootable arch from iso located in /home/josepy/Downloads (input file) to device at /dev/sdb ( output file) , using block size of 4M, showing transfer progress and doing sync to complete before ejecting.

# sudo su -
# dd if=/home/josepy/Downloads/archlinux-2016.02.01-dual.iso of=/dev/sdb of=/dev/sdb bs=4M status=progress && sync

1.1.2: Using Manual Formatting:

For this method to work, you should have syslinux package installed. If you’re running Arch, do:

# sudo pacman -S syslinux

I suppose you have a flash drive with targeted partition as /dev/sdb2 that must be formatted to FAT32. We’ll create a directory to mount Flash drive partition and ISO image.

# mkdir -p /mnt/{iso,usb}
# mount -o loop /home/josepy/Downloads/archlinux-2016.05.01-dual.iso /mnt/iso
# mount /dev/sdb2 /mnt/usb
# rsync -av /mnt/iso/* /mnt/usb
# umount /mnt/iso

1.2 Create bootable USB flash stick on Windows.

1.2.1: Using Rufus software package

Download Rufus USB Partitioner http://rufus.akeo.ie/
When you run it, you have two partition schemes options to select from:

  1. MBR for BIOS
  2. UEFI

The file system of FAT32 is required.

1.3 Boot and start Installation

Once you’ve created USB drive that’s bootable, plug in and start the system.

 

 

 

 

 

 

 

 

 

Choose ” Boot Arch Linux ( Architecture)”, since my machine is 64-bit, i will choose ” Boot Arch Linux (x86_64)”, then press enter key.
See below image.You’ll be dropped on root terminal with like below:

Now it’s time to start partitioning hard drive.

1.4 Partitioning

We’ll need three partitions. Partitioning can be done from existing/ other installed Linux system using GUI tools like gparted. Then just pointing root, home and swap partitions to respective partitions created earlier. Using GUI tools is a recommended method if you’ll be dual booting with other Linux

  1. Root partition
  2. Home partition
  3. Swap partition

First, check your disk location using lsblk command:

As you can see, my internal hard drive is /dev/sda. I will partition it to get three partitions. I’ll use fdisk command to do this:

The syntax is,

# fdisk /sdx

Since my drive is /dev/sda, it will be:

1.4.1 Create root partition

I’ll create a 10GB root partition, steps are

  1. Type fdisk /dev/sda
  2. Press n to create a new partition
  3. Press p to specify the primary partition type
  4. Press enter for default partition number
  5. Press Enter key for default First sector
  6. Type +10G to specify 10GB disk size for the root partition. Replace it with your value. M for MB, G for GB, T for terabyte e.t.c
  7. Type w to write changes to the partition table.

1.4.2 Create Home partition

Repeat the same process as in 1.4.1 to create a home partition, 1.4.3 Create a Swap partition

Repeat the same procedure as in 1.4.2 and 1.4.3 to create a swap partition.
You can view partition table by typing;

# fdisk /dev/sda

Then press p
We’ve successfully created three partitions, which are:

  1. Root partition on /dev/sda1
  2. Home partition on /dev/sda2
  3. Swap partition on /dev/sda3

1.4.4 Create a filesystem on created partitions

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

Create swap and turn it on.

# mkswap /dev/sda3
# swapon /dev/sda3

See image below 

1.4.5 Mount the partitions

Mount /dev/sda1

mount /dev/sda1 /mnt

Create dir for mounting /dev/sda2

mkdir /mnt/home

Mount /dev/sda2

mount /dev/sda2 /mnt/home 

If you Love what we do, support us by downloading this tutorial as pdf from the link below:

1.5 Install the base packages

Before you begin installation of base packages, it’s advisable to choose mirror closest to you. You can do this by editing the mirrorlist file located in /etc/pacman.d/ directory.

1.5.1 Modify Mirror list

# nano /etc/pacman.d/mirrorlist

Locate mirror close to you, then move it to the top, below nano keys can help you do easy navigation and copy-pasting:

  1. Ctrl + w : To do searching
  2. Alt+6: To copy a line
  3. page-up: To go to the top of the file
  4. Ctrl+ U: To paste a line
  5. Ctrl+X: To save changes, then press Y then enter key.

Since I reside in Africa, the mirror closest to my location is

## Score: 1.4, South Africa Server = http:ftp.wa.co.za/pub/archlinux/$repo/os/$arch//

It will be the first one in the mirror list. After editing mirror list, it’s time to install base packages from the fastest mirrors near you. But first, you should have a working internet connection:

1.5.2 Configure Networking

> Check if you have an ip address, if not and have DHCP, request for IP related information.You can request for IP via DHCP by

# dhclient ens3
# ifconfig ens3

Then test if you’ve internet connection by doing a ping test

# ping -c 3 8.8.8.8

If you’re using wireless networking, use tool called wifi-menu

# wifi-menu

On the popup window, Select your Wireless network then Press OK.

Set profile name and Press OK

If it has security key, enter it and press OK.

Pacstrap installs packages to the specified root directory. If no packages are given, packstrap defaults to the “base” group.

Pacstrap usage:
pacstrap [options] root [packages…]
Options:

-C : Use an alternate config file for Pacman
-c : Use the package cache on the host, rather than the target
-d : Allow the installation to a non-mountpoint directory
-G : Avoid copying the host’s Pacman keyring to the target
-i : Avoid auto-confirmation of package selections
-M : Avoid copying the host’s mirrorlist to the target
-h : Print help message

Now do the pacstrap installation of base and base-devel

pacstrap -i /mnt base base-devel

1.5.3 Create Local Repository

NOTE: THIS IS NOT DONE ON THE INSTALLATION MACHINE !!!

If you have an already installed Arch Linux system on your network, it’s not necessary to redownload base packages from the internet. This will help you save bandwidth if you’re on slow internet connection. I’m going to show you a trick on how to set local repo based on pre-installed Arch Linux. I have another running Arch Linux on my network with IP address:
IP aaddress:192.168.122.1
IP address of Arch being installed as seen from previous ifconfig command is: 192.168.122.203

  1. On installed Arch Linux, i’ll setup Apache web server server:
# sudo pacman -S apache

Then start Apache web server:

systemctl start httpd
systemctl enable httpd

Check status of httpd to make sure it’s running

# systemctl status httpd
  1. Next step is to create directory to house pacman packages on installed Arch Linux Apache’s root directory.
# mkdir /srv/http/arch

Rsync all packages at /var/cache/pacman/pkg directory to /srv/http/arch .

# rsync -av /var/cache/pacman/pkg /srv/http/arch

Change group ownership of /srv/http contents to http.

chown -R root:http /srv/http

Use repo-add command included with Pacman to generate a database for the custom repository.
# repo-add /srv/http/arch/pkg/custom.db.tar.gz /srv/http/arch/pkg/*.pkg.tar.xz

Wait for it to complete, then

  1. Go back to machine you’re installing New Arch Linux on. Modify pacman.conf file:

– Comment out core, extra and community repos, to look like below:

#[core]
#Include = /etc/pacman.d/mirrorlist

# [extra]
# Include = /etc/pacman.d/mirrorlist

# [community]
# Include = /etc/pacman.d/mirrorlist
Then add below repository just before the core repo:
[custom]
SigLevel = Never
Server = http:192.168.122.1/arch/pkg//

See below image:

  1. Run pacstrap to install base packages:
pacstrap -i /mnt base base-devel

After successful installation of base packages, you can move on to system configurations stage.

1.6 System configurations

1.6.1 Generating fstab file for auto-mounting partitions

fstab is a static information about the filesystems which contains descriptive information about the filesystems the system can mount. It is only read by programs. It is your duty to properly create and maintain this file.
Arch installation comes with a package called genfstab which tries to automate this process for you. genfstab generates output suitable for addition to an fstab file based on the devices mounted under the mount point specified by the given root.
Options that can be used with genfstab are:
Options:

-L Use labels for source identifiers (shortcut for -t LABEL)
-p Exclude pseudofs mounts (default behavior)
-P Include printing mounts
-t TAG Use TAG for source identifiers
-U Use UUIDs for source identifiers (shortcut for -t UUID)
-h Print help message

The syntax of usage is:
# genfstab [options] root
To generate fstab file, type

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

You can check generated fstab file and modify if necessary.

# cat /mnt/etc/fstab

Then chroot to run command or interactive shell with special root directory of /mnt

# arch-chroot /mnt/

If you had set local custom repository and would like to use it in the next installations, issue below commands before typing arch-chroot /mnt

# cp /etc/pacman.conf  /mnt/etc/pacman.conf
# cp /etc/pacman.d/mirrorlist   /mnt/etc/pacman.d/mirrorlist

1.6.2 Set timezone

We need to configure Timezone to get correct time on the system. Timezones are listed in /usr/share/zoneinfo/
Since my timezone is Africa/Nairobi, i will issue command:

#  ls -s /usr/share/zoneinfo/Africa/Nairobi > /etc/localtime

You can find your timezone by going through the list of timezones.

# ls -l /usr/share/zoneinfo

1.6.3 Generate correct locale

Since i’m using US english, my locale will be set to en_US.UTF-8.

#  mylocale=en_US
#  sed -i  '/en_US.UTF-8/s/^#//g'   /etc/locale.gen
# echo   LANG=$mylocale.UTF-8 > /etc/locale.conf

1.6.4 Set the hostname

The syntax is:

# echo hostname > /etc/hostname

In my case:

# echo archy  > /etc/hostname

1.6.5 Enable multilib repository

# nano /etc/pacman.conf

Uncomment multilib repository to look like below.

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

This is necessary if you’re running 64-bit system and would like to install 32-bit packages on it.

1.6.6 Add AUR repo

Add the following AUR repo content at the end of pacman.conf file.

[archlinuxfr]
SigLevel = Never
Server = http://repo.archlinux.fr/$arch

For how to use AUR,  check: yay – Best AUR Helper for Arch Linux / Manjaro and Pacman and yaourt package manager mastery Cheat Sheet

1.6.7 Install boot loader

Install Grub bootloader. Since this installation of Arch is on PC using BIOS, we don’t need a different partition to install bootloader on. If you’re using UEFI, consult Arch Wiki for details on how to set it up.
Download grub:

# pacman -S grub

Install grub

# grub-install /dev/sda/

If you encounter any problem trying to install grub, use –force flag:

# grub-install   /dev/sda  --force

1.6.7.1 Install os-prober

Os-prober utility is necessary if you have more than one OS on your machine. It will automate the process of adding other operating systems to grub menu for easy dual booting. Install it by typing:

# pacman -S os-prober
# os-prober

1.6.7.2 Generate a GRUB configuration file

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

1.7 Install Crucial software packages

It’s a rule of thumb to do system update and upgrade before installing any package:

$  sudo pacman –Syu
  1. Install bash
    # pacman -S bash bash-{completion,docs}
  1. Install X server
    #  pacman -S xorg-{server,utils,xinit,xinput,xwininfo,xlogo,xauth,xclock,twm}

3. Install Mesa 3D acceleration if you don’t want to install proprietary ones.

# pacman -S mesa mesa-libgl

4. Install Touchpad drivers

#  pacman -S xf86-input-{keyboard,synaptics,mouse,libinput}

5. A single command to get X working is:

# pacman -S xorg

Install Audio drivers

# pacman -S alsa-{utils,plugins,plugins,firmware} pulseaudio pulseaudio-{equalizer,alsa,gconf}
  1. Install net-tools
# pacman -S net-{snmp,tools}

Net-tools package provide network management tools. Arch comes with ifconfig replacement tool ip. To use ifconfig, net-tools package is required.

  1. Install sudo
# pacman -S sudo

Sudo allows a permitted user to execute a command as the superuser or another user, as specified by the security policy.

  1. Install dhclient – Dynamic Host Configuration Protocol Client
# pacman -S dhclient

Dhclient, provides a means for configuring one or more network interfaces using the Dynamic Host Configuration Protocol and BOOTP protocol.

1.8 Add standard user account

Installed Arch comes only with root account. In this section, we’re going to add standard user account:

  1. Set root password:
# passwd root

Enter your desired password and confirm.

  1. Add new user to the system.
# username="jose"
# useradd -m -g users  $username
# usermod   $username  -a -G wheel,storage,power,audio,games
#  chsh -s  /bin/bash  $username
  1. Set password for the user
# passwd $username

Enter desired password for the account and confirm .

  1. If you want the added user, a member of group wheel to execute any command, do the following:

> Set EDITOR to your favorite

#  echo  export EDITOR=vim >> ~/.bashrc

> Run visudo command

# visudo

And uncomment the line

# %wheel ALL=(ALL) ALL

to be:

%wheel ALL=(ALL) ALL

Then save and quit.

1.9 Install your favorite Desktop Environment

All linux systems are Desktop Environment agnostic. You can install any DE you want, at any time. I’m a big fan of KDE but i’ve used almost all Linux DE. In this section i will guide you through installation of top Linux Desktop Environments. The list is as shown below.
1.9.1 Install KDE plasma Desktop Environment

# pacman -S  plasma  kde-applications-meta  plasma-mediacenter
# systemctl enable  sddm.service

1.9.2 Install Gnome Desktop Environment

# pacman -S gnome gnome-extra gnome-tweak-tool

Then install GDM display manager:

#  pacman -S gdm

Start and enable gdm to start at boot:

# systemctl enable gdm

1.9.3 Install xfce Desktop Environment

# pacman -S  xfce4  xfce4-goodies  xfce4-mixer  gstreamer0.10-good-plugins   libxnvctrl  xscreensaver

1.9.4 Install cinnamon Desktop Environment

#  pacman -S cinnamon nemo-fileroller

Display manager.

# pacman –S gdm

Enable gdm to start at boot and start it

# systemctl enable gdm

Upto this point, you’ve finished install Arch Linux on your machine, so, Kudos!!.

You can now exit chroot , unmount partitions and reboot your system.

# exit
# umount -R /mnt/
# reboot
While it’s rebooting, you may eject installation medium since install Arch Linux process is complete.
If you Love what we do, support us by downloading this tutorial as pdf from the link below:

Once it’s done rebooting, you’ll see a Login screen. Since i’m using KDE, my Login screen looks like below:

Upto this point, We’ve completed a how to Install Arch Linux, if you’re here i know you’ve a running Arch with DE. Computinforgeeks  have many tutorials on Linux and Arch Linux.

Tags:
How to install Arch Linux from scratch
How to install Arch Linux on a Desktop, PC or server
Installing Desktop Environments on Arch Linux
How to install KDE, XFCE, GNOME 3 and others.
Arch Linux basic softwares installation