Arch LinuxLinux Tutorials

Arch Linux Setup And Installation

This is the first of three tutorials covering the installation and configuration of Arch Linux. Throughout the series, we will install, and configure Arch Linux.

Background Information

Linux users at some point would have heard of Arch Linux. Some may have used it, some may never have used it. Some swear by it, while others may have been overwhelmed by it. Arch Linux is aimed targeted towards experienced Linux users, so it is most definitely not for beginners. Installation is manually done step by step. That is, you must create the partitions yourself, copy files over yourself, etc. because there is no installer. Everything is done manually. The biggest advantage of this method is that you have more control over the installation process.

Getting Started

Once you have obtained the ISO file, you can then burn the image to a CD or USB flash drive. The ISO image is only 586MB, small enough to burn on a CD. For virtual machines, the ISO is used directly by the VM software. The ISO contains a functional Arch system. You will use this to install and configure the operating system. Troubleshooting problems with installation can also be done using the live environment.


Boot up your machine and ensure that the system will attempt to boot from the CD/USB first. Once successful, you should see the Arch Linux boot menu. Select “Boot Arch Linux (x86_64)”.​The system will then load. If successful, you will be logged in as root. In the current directory, there will be a file called ‘install.txt’. This document is essential because it contains all of the instructions to install and configure Arch properly. Use ‘less’ to view it.

$ less install.txt

Arch Linux Installation

Remember, there is no installation program. You must do everything yourself. Once you have the file open, switch to the second terminal and log in as root. There is no password. Now we can begin the steps. We want to make sure that the keyboard settings are correct. The default for me is the US. If you would like a different keyboard layout, follow the guide for listing all of the possible choices. Use ‘loadkeys <layout>’ to change the keyboard.

arch linux configure hostname

Next, we want to see if UEFI support exists on the target system. If so, this directory, ‘/sys/firmware/efi/efivars’ should exist. In my case, because I was using a virtual machine without EFI support enabled, it was a BIOS system. Therefore the directory will not exist.​

arch linux efi support

Next step is to make sure the system clock is correct. We do this by syncing it with a network time protocol (NTP) server. The ‘timedatectl’ command is the tool used to do this. When run without arguments, it will show the current time settings. Running this command will ensure that the clock is correct.
$ timedatectl set-ntp true
Note that this requires an Internet connection. Test this using ‘ping’.
$ ping

EFI, NTP, and ping

We will discuss duplicate packets in the next guide.

Arch Linux Partitioning

Next, we need to set up the partitions required. We will create four of them. One for the BIOS boot, one for the ‘/boot’ directory, a swap space, and the main partition where the system will be installed. You can have another partition for directories like ‘/home’ or ‘/usr’ etc, but to keep it simple, let’s use ‘fdisk’ to create the partition.​First, find the target drive using ‘fdisk -l’. For my VM installation, it was ‘/dev/sda’ because it was the only one there, apart from the loop device.

$ fdisk -l
Once the drive has been identified, open ‘fdisk’ using the drive as the parameter.
$ fdisk /dev/sda

fdisk -l

If this is a brand new drive or image, it will create a DOS disklabel automatically. This was on my VM installation. If this occurs and you want to use GPT as your partition table, it is easy to change. Simply enter ‘g’ to replace the DOS table with GPT. WARNING, this will get rid of any partitions that were already there. Now we shall create 4 partitions (using the ‘n’ command in ‘fdisk’).

  1. Let’s create the BIOS boot section, which will take up about 128MB.
  2. Next, create the ‘/boot’ partition with a size of 128MB.
  3. Then make a swap partition 1GB in size.
  4. Finally, create the main partition that will occupy the rest of the drive.

fdisk new partitions

As you will notice, each partition is marked as of the type ‘Linux filesystem’ (code 20). For the first partition, we should change the partition type to be ‘BIOS boot’ (4) (running ‘t’). Use ‘L’ to list the codes to enter for each type. Finally, for the third, we want to change it to be ‘Linux swap’ (19).​The other two should remain ‘Linux filesystem’. Once the partitioning is complete, we must enter ‘w’ into fdisk to apply the partitions to the target drive.

partition tables arch linux

Now we can begin formatting the partitions. We don’t need to do anything else with the first partition, just the three others. We will use ‘mkfs’ to format the partitions. First, format the ‘/boot’ partition.
$ mkfs.ext2 /dev/sda2
It only needs to be an ‘ext2’ filesystem. Next, we need to create and activate the swap space.
$ mkswap /dev/sda3 
$ swapon /dev/sda3
Then finally, create the root partition.
$ mkfs.ext4 /dev/sda4

Installing the Base System

Partitions are formatted. Now, the next thing to do is to install the base system. Let’s mount the partitions. First, we will mount the root partition, then create the boot directory, and mount the boot partition to it.
$ mount /dev/sda4 /mnt 
$ mkdir /mnt/boot 
$ mount /dev/sda2 /mnt/boot
Next step is to run the ‘pacstrap’ script to download and install the components on the installation partition.
$ pacstrap /mnt base

arch linux installation

Then we need to generate the ‘fstab’ file (filesystem table) with ‘genfstab’. We will stick with using UUIDs to define volumes (‘-U’).
$ genfstab -U /mnt >> /mnt/etc/fstab


There are more tasks to do that require changing the root directory. The tool to do this is ‘arch-chroot’, which will change the live system root to the root of our new Arch installation.
$ arch-chroot /mnt
Following the guide, proceed to configure your time and date information. Set the correct timezone for your area, then create ‘/etc/adjtime’ using ‘hwclock’.
$ ls /usr/share/zoneinfo/ # To find the correct one 
$ ln -s /usr/share/zoneinfo/Region/City /etc/localtime 
$ hwclock --systohc

Next, the locale settings need to be established. Open ‘/etc/local.gen’ using either ‘vim’ or ‘nano’ and you will see a list of locales. Uncomment the ones you wish to use (remove the ‘#’ at the start of each one), then run ‘locale-gen’ to generate them.​Next, you need to set the ‘LANG’ variable in the file ‘/etc/locale.conf’ like this for example (check ‘/etc/locale.gen’ for more options):


Then in '/etc/vconsole.conf', set the keymap:

Hostname and Network

Next thing to do is to set the hostname. Simply run this command:
$ echo LinuxAndUbuntu > /etc/hostname 
$ cat /etc/hostname # To double-check
Then, the ‘/etc/hosts’ file should be edited to include the hostname according to the installation guide.

setup arch linux hostname

Initramfs and Root Password

We need to create the initramfs file so that Linux can boot. Running ‘mkinitcpio’ will create the file.​
$ mkinitcpio -p linux

initramfs arch linux

After generating the initramfs file, the next thing you must do is create symlinks of both the kernel and the initramfs. These are located in the /boot directory of the Arch system you installed.
$ ln -s /boot/vmlinuz-linux /vmlinuz-linux 
$ ln -s /boot/initramfs-linux.img /initramfs-linux.img 
$ ln -s /boot/initramfs-linux-fallback.img /initramfs-linux-fallback.img
Next, we need to set the root password in the chrooted environment using ‘passwd’. Otherwise, we can’t do anything with the system after reboot.

GRUB Installation and DHCP

The other crucial step we need to perform before rebooting is installing the boot loader. GRUB is what we will need to install using ‘pacman’.
$ pacman -S grub

grub installation

Next we need to install it to the drive we installed Arch on using ‘grub-install /dev/sdX’. Then finally, create the configuration file using ‘grub-mkconfig > /boot/grub/grub.cfg’.​Next, we should install dhcp using ‘pacman -S dhcp’. In the next guide, we will go through how to configure it so the system can have Internet access.

arch linux grub config and dhcp


At this point the installation is complete. You may now exit the chroot environment by running ‘exit’ and then reboot your machine. If there are any errors booting up the system, you will have to run the install disc again to diagnose the problems. There is plenty of information out there for those who need it.
In the next guide, we will look at configuring the system for Internet access, and software installation.

Leave a Comment

* By using this form you agree with the storage and handling of your data by this website.