A step by step Arch Linux installation guide

      4 Comments on A step by step Arch Linux installation guide
It's only fair to share...Share on Facebook
Facebook
Share on Google+
Google+
Tweet about this on Twitter
Twitter
Share on Reddit
Reddit
Email this to someone
email
Arch Linux Installation live boot

Arch Linux Installation live boot

Many Linux users are stopped from using Arch Linux because they cannot install it. This Arch Linux installation guide will solve this problem. It shows the whole Arch Linux installation process step by step.

UEFI or legacy mode?

There are two possible options of Arch Linux installation: the legacy mode and the UEFI mode. I personally think that the Arch Linux installation in the legacy mode is more conservative, simpler, and more reliable. However, the UEFI mode is more up-to-date and some modern hardware supports only the UEFI installation.

This Arch Linux installation guide will use the UEFI mode, but I will point out the steps and commands that are different for the legacy mode. So, regardless of what mode you choose, this guide will help you to install Arch Linux with the minimal graphical environment.

The UEFI means Unified Extensible Firmware Interface and here are some of its benefits:

  • UEFI replaces the Basic Input/Output System (BIOS) interface.
  • UEFI is compatible with GPT tables.
  • It supports larger hard drives.
  • It is more configurable and, as a result, it boots faster.

In its turn, the GUID Partition Table (GPT) is more advanced than MBR partitions that is used in the legacy installation. It works with volumes larger than 2TB and supports up to 128 partitions.

So, let’s get started with detailed Arch Linux UEFI installation guide.

Video Tutorial

Before you start

Download Arch Linux ISO

First, download the Arch Linux installation ISO from the Arch Linux website.

You can download the torrent file or use the direct link. Just find your country and click on the link. Among the variety of files, choose the one which ends with .ISO. Click on it and save it.

download arch linux iso

Download the Arch Linux ISO

When the ISO is downloaded, you need to write it to your USB flash drive. Open the Linux terminal and use the following command:

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdx status=progress && sync

where /path/to/archlinux.iso is the path to your downloaded ISO file; /dev/sdx is your flash drive. You can find out this name with the command sudo fdisk -l and the size of your USB flash drive.

Practice your Arch Linux installation in VirtualBox

However, you may try the Arch Linux on a virtual machine first. It will help you to practice and avoid fails on the hardware. To run the Arch Linux in VirtualBox, do the following steps.

  1. Create a new machine and name it Arch Linux.
  2. Give it 2GB of RAM. If you lack the RAM on your PC, keep it at 1GGB.
  3. Create a new hard disk. Select VDI (VirtualBox Disk Image) and dynamically allocated size.
  4. Give the VDI 20GB and click Create.
  5. Click on the Settings icon. In the System tab, enable the UEFI mode.
  6. Click on the Start icon or just double-click on the Arch Linux.
  7. Specify the path to the downloaded Arch Linux ISO.

 

VirtualBox in the EFI mode

VirtualBox in the EFI mode

The boot process of live Arch Linux in the UEFI mode can be very slow. This is normal. Just wait some time. When the system is loaded, and you can start the Arch Linux installation.

Arch Linux installation

Check network connection

First of all, check the internet connection. I recommend you to use a wired connection. To check if your internet works, you need to ping to any server, for example, the Arch Linux website:

ping -c 3 archlinux.org
Test Arch Linux connection with ping

Test Arch Linux connection with ping

If you are not sure what interfaces are available, use

ip link

If you use a wired connection, it is usually picked up automatically. Wi-Fi requires some additional settings. For Wi-Fi run:

wifi-menu

You will see a window looking like this where you can choose the available networks:

wifi menu in Arch Linux

WI-Fi menu in Arch Linux

Type the password and connect to your Wi-Fi network. However, I still recommend using the wired internet connection.

Partition

Next step in our Arch Linux installation guide, is to list the available partitions of our hard drives:

fdisk -l

Most probably, you will have only two hard drives: the USB drive with the Arch Linux installation ISO and your computer HDD. When you have several hard drives, look at their size and define which one you want to use for the Arch Linux installation.

If you already have a partition table, skip this step. In the case your hard drive is brand-new as in the case of a virtual machine or you want to re-partition your hard drive, run this command to create a new partition table:

cfdisk /dev/sda

Note! Back up all your data, because creating a new partition table will erase everything from a drive.

In the label type window, select GPT.

Avalible partition types

Select GPT partition


Legacy mode! If you do the legacy installation, choose dos partition type and do not create the UEFI partition.


Clicking the New button and create 3 partitions:

  • /dev/sda1 # choose 512Mb of space (UEFI)
  • /dev/sda2 # choose at least 10 GB of space (root)
  • /dev/sda3 # choose all the left space (home)

Write the table to your hard drive and quit.

Now, list the partitions again:

lsblk

The /dev/sda disk should have three partitions. We need to format them.

The first partition is a UEFI one. It needs to be formatted in a FAT file system:

mkfs.fat -F32 /dev/sda1

Legacy mode! If you do the legacy installation, skip the step of UEFI formatting.


The other two partitions can be formatted in any Linux file system. I recommend using EXT4:

mkfs.ext4 /dev/sda2

mkfs.ext4 /dev/sda3

Next, mount the root and home partitions:

mount /dev/sda2 /mnt 

mkdir /mnt/home

mount /dev/sda3 /mnt/home

The root mounting point is the folder where the system will be installed. Check mounting points whether they were created successfully:

lsblk

lsblk

Install the system

Now, we start the installation process.

pacstrap -i /mnt base base-devel

When the system requests to choose the components to install, select all and yes. Wait some time until it completes.

Install the base of Arch Linux

Install the base of Arch Linux

Generate fstab file

Next step in this Arch Linux installation guide is to generate the fstab file:

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

To learn what -U and -p mean, type genfstab -help to see the description of these options.

Chroot to the installed system

Next, chroot (change root) to your account that is mounted to /mnt using the BASH environment:

arch-chroot /mnt /bin/bash
Arch Linux Installation: chroot

chroot

This way you change your live environment to the root environment of the installed Arch system. This way, you will be able to access the system as a root user. A bit later, you will have to add the regular user.

Set locale

To set the localization, you will have to work in Nano editor. Type

nano /etc/locale.gen

and press Enter.

Find the language you are going to use. In my case, I am going to install American English. Activate the search option by pressing the shortcut Ctrl + W (the shortcuts are listed at the bottom of the screen) and type #en_US. Press enter.

Search for #en_US in Nano

Search for #en_US in Nano

You should jump to the line #en_US.UTF-8 UTF-8

Uncomment it by removing the # sign. Press Ctrl + O to save and Ctrl + X to exit the editor.

Next, you have to generate the locale. Run:

locale-gen

Set the time zone

To set the time zone, type:

ln -sf /usr/share/zoneinfo/

and press the Tab key to see all the available options. In my case, I need to use Europe. Again, you can press the Tab key, and you will see all the available cities. I will use Stockholm. Save this link to  /etc/localtime. The final command will look as follows:

ln -sf /usr/share/zoneinfo/Europe/Stockholm /etc/localtime

Instead of Europe and Stockholm, you can select your region and time zone.

Set local time

To set the time on your PC, run this command:

hwclock --systohc --utc

Set hostname

Hostname is the computer’s name. Let’s name it archPC. Use the following command:

echo archPC > /etc/hostname

You also need to add this name to the hosts file. Type:

nano /etc/hosts

and press Enter.

In the Nano editor, add this line at the end of the file:

127.0.1.1 localhost.localdomain archPC
Arch Linux Installation: hostname

Set hostname

If you use a static IP address, replace 127.0.1.1 with your static IP address given by the Internet provider. Press Ctrl + O to save, Ctrl + X to exit the editor.

Enable network

First, install the network manager:

pacman -S networkmanager

Then enable it:

systemctl enable NetworkManager
Enable the Network Manager in Arch Linux

Enable the Network Manager

Now, the system will be able to run a network manager at the system boot and connect to the Internet automatically. Remember, these settings work only for the wired internet connection.

Set root password

Next, set the root password. Type:

passwd

and type your password twice. Be attentive, as you will see nothing while typing.

Set password during Arch Linux Installation

Set password

Install GRUB

Next, install the GRUB bootloader which is the vital component. Without it, your system will never boot. To install all the necessary packages, type the following command:

pacman -S grub efibootmgr

grub, efibootmgr installation in Arch Linux

Installation of GRUB and EFI packagesWhen GRUB and EFI packges are installed, install the bootlader and generate its configuration files by running these commands one by one:

mkdir /boot/efi
mount /dev/sda1 /boot/efi
lsblk # to check if everything is mounted correctly
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi --recheck grub-mkconfig -o /boot/grub/grub.cfg
GRUB installation in Arch Linux

GRUB installation


Legacy mode! If you do the legacy installation, install the GRUB in this way:

pacman -S grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg

Basically, the minimal installation of Arch Linux is complete.

Edit EFI bootloader


Legacy mode! If you do the legacy installation, skip this part.


However, we must make additional configurations with the bootloader. Create a BOOT directory:

sudo mkdir /boot/efi/EFI/BOOT

After that, copy GRUB bootloader to this directory and give it a different name:

sudo cp /boot/efi/EFI/GRUB/grubx64.efi /boot/efi/EFI/BOOT/BOOTX64.EFI

To be even safer, we can also create a startup script for EFI:

sudo nano /boot/efi/startup.nsh

In Nano editor, add these lines:

bcfg boot add 1 fs0:\EFI\GRUB\grubx64.efi "My GRUB bootloader"
exit
Arch Linux Installation: efi script

EFI script

To complete editing, press Ctrl + O to save the changes and Ctrl + X to exit the editor. In the end, run exit to exit the chroot account.

Reboot

Next, unmount all mounted partitions and reboot the system:

umount -R /mnt
reboot

If you did everything correctly, after the reboot, you will see the GRUB welcome screen with Arch Linux installed.

GRUB screen with Arch Linux

GRUB screen with Arch Linux

To continue, log in as a root user with a previously setup password.

Arch Linux root login

Log in as a root user

Add user

After the login, create a user account. It’s not a good idea to constantly work from the root account. Type:

useradd -m -g users -G wheel -s /bin/bash username

Write your own name instead of username.

Arch Linux Installation: add user

add user

Also, create a password for the new user:

passwd username

Instead of username, use the name you created in the previous step. Type the password twice.

Arch Linux Installation: add password

add password

Next, enable sudo privileges for a newly created user:

EDITOR=nano visudo

Using the arrow keys, scroll down the screen and find the line:

# %wheel ALL=(ALL) ALL

Uncomment it, by removing the # sign.

Arch Linux Installation: %wheel ALL=(ALL) ALL

Uncomment %wheel ALL=(ALL) ALL

Press Ctrl + O to save and Ctrl + X to exit the editor.

Now, exit the system by running the command:

exit

and log in as a new user with the username and password you created.

Install Audio, X window system, Xfce desktop, login manager

To make the new system usable, install audio, X Window System, Xfce desktop, and login manager. Type the following command:

pacman -S pulseaudio pulseaudio-alsa xorg xorg-xinit xorg-server xfce4 lightdm lightdm-gtk-greeter

If you install the system on VirtualBox, in the end, add virtualbox-guest-utils

When you press Enter, the system will offer to choose the components to install. Just press Enter twice to apply the default settings. After that, the system will request to choose the driver for the video card:

Arch Linux video driver options

Arch Linux video driver options

If you have a discrete video graphic card, select the second option. When you use integrated Intel video card, select the first option. The utility will install many packages. Wait some time until it completes.

Create xinit file

Xinit file allows to start an Xorg display server automatically. You need to create the xinitrc file with the command to launch Xfce desktop:

echo “exec startxfce4” > ~/.xinitrc

If you install any other desktop besides Xfce, you will need to use another command and probably another login manager. Below, you will find the xinitrc command and the command to install the desktop:

GNOME:

"exec gnome-session"
sudo pacman -S gnome

Cinnamon:

"exec cinnamon-session"
sudo pacman -S cinnamon

Mate:

"exec mate-session"
sudo pacman -S mate

Unity:

Unity installation is tricky – see the Arch Linux Wiki.

"exec unity"

Budgie:

"export XDG_CURRENT_DESKTOP=Budgie:GNOME"
"exec budgie-desktop"
sudo pacman -S budgie-desktop

Openbox:

"exec openbox-session"
sudo pacman -S openbox

i3:

"exec i3"
sudo pacman -S i

Awesome:

"exec awesome"
sudo pacman -S awesome

Deepin:

"exec startdde"
sudo pacman -S deepin

LXDE

"exec startlxde"
sudo pacman -S lxde

After that, enable the login manager:

systemctl enable lightdm

I would like to point out that I have not tested all these desktops. Some users reported that Plasma 5, for example, doesn’t start with lightDM. So, you need to use SDDM with Plasma 5. For the full list of Login Managers look at Arch Linux Wiki.

Start GUI

To test whether your graphical environment works, run:

startX

The system must launch the graphical interface.

Arch Linux with the default Xfce desktop

The default Xfce desktop

This is a very minimal installation. There are almost no packages installed. From this point, you can install what you want and configure your Arch Linux as you want.

To further check that everything works fine, shut down the system and start it again. Hopefully, it will boot again and you will be able to log in.

Arch Linux installation is done!

Step by step Arch Linux installation guide is over. As you can see, the Arch Linux installation process is little complicated but manageable. This system is still not complete and you will need to install many more packages and configure it. Nevertheless, the most difficult part is done and you have a good starting point.

Do you want to share your experience or have any questions about how to install Arch Linux? Leave your comment below.

It's only fair to share...Share on Facebook
Facebook
Share on Google+
Google+
Tweet about this on Twitter
Twitter
Share on Reddit
Reddit
Email this to someone
email

4 thoughts on “A step by step Arch Linux installation guide

  1. Mario

    Before typing reboot, the user doing a Legacy installation have to type exit. The tutorial doesn’t say that.
    It was a great tutorial. Thank you.
    Greetings from Peru.

    Reply

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.