Adarsh Inaganti · Follow
9 min read · Mar 16, 2021
In this article, I am going to show you how to install Arch Linux on your laptop/computer, and after that, I will be showing you how to set up a graphical desktop environment. So, let’s jump right in.
- This installation is not for beginners or people who are starting out with Linux. If you are a Linux newcomer, try something like Ubuntu or Pop!_OS.
- This installation guide will wipe out ALL existing data on your Hard Drive/SSD. So please back up any important data before proceeding.
- This installation requires a working internet connection to follow, as we will be downloading gigabytes of data.
- 512MB RAM (2GB Recommended)
- x86_64 (64-bit) system
- 20GB of disk space
- USB Stick (2GB or more)
- A decent internet connection
- A bit of familiarity using the command line
- A LOT of time, installing Arch is a long process, especially if you have a slow internet connection
- Grabbing the ISO
- Burning the ISO to a USB stick
- Booting from the live USB
- Disk partitioning
- Creating filesystem
- Connecting to Internet
- Selecting a good mirror
- Installing to disk
- Configuring the system
- Installing a bootloader
- Adding a user
- Installing a desktop environment
- Configuring network postinstall
Grabbing the ISO
Head over here and download the latest ISO, either directly or over torrent. The file is going to have a .iso extension and should be about 700MB in size.
Burning the ISO to a USB Stick
To boot into Arch Linux, you need to burn the .iso file to a USB Stick, with a minimum size of 2GB. (Optional: use a USB 3.0 flash drive for faster write speeds and better experience.)
Follow these steps in order:
- Download balenaEtcher for your platform (Windows, macOS, Linux)
- Install and open it
- Choose the ISO file you just downloaded
- Plug in your USB Stick (Etcher should detect your USB automatically, if not then you can choose it manually).
- Note: double-check before choosing the USB stick and I recommend to remove any other flash drives, so that there is no confusion.
- Click on “Flash!” and wait for it to finish. (Note: All existing data on the USB stick will be lost).
- You now have a bootable Arch Linux USB stick.
Alternative method: Using Android
If you are not able to use a computer for some reason, then do not worry, you can also use an Android phone. Do note that you need to have an adapter to connect your phone to a USB.
Follow these steps on an Android:
- Download the app named EtchDroid
- Open the app and choose the first option — “Write a raw image or ISO”
- Choose the ISO file.
- Select your USB drive.
- Click on the flash button.
- You now have a bootable Arch USB.
Booting from the Live USB
- Shut down your computer and plug in your USB.
- Boot up your system again. While booting keep pressing F2, F10 or F12 depending on your motherboard.
- Note: in some cases the boot is unable to occur because of secure boot. If this is the case for you, you need to disable secure boot in your BIOS.
- You should see something like this.
- Choose the first option — “Boot Arch Linux (x86_64) and wait for it to boot.
- The steps following this step are all command-line based and are very crucial for your install. Read these steps carefully.
Disk Partitioning
We are going to use a utility called fdisk which allows us to partition the hard drive. Follow these commands step by step:
List the disks
fdisk -l
Note: Your disk might be labeled as /dev/sda or /dev/nvme0n1. Follow these steps very carefully and replace /dev/sda with /dev/nvme0n1 if required.
Select the disk which we will install Arch on:
fdisk /dev/sda
Creating an EFI Partition (only for UEFI)
Enter ’n’ in fdisk and choose the disk number as 1. Press enter on First Sector and type +512M on Last Sector.
Press ‘t’ to change type. Press ‘L’ to see all partition types and choose “EFI System” by its corresponding number.
Creating the root partition
While you are in fdisk, press ’n’ to create a new partition. It is automatically going to give it partition number 2. Keep pressing enter for the default options and the remaining space will automatically be allocated to the root partition.
Enter ‘w’ to write the changes to disk. Note: your disk is now blank and all your data has been erased.
Creating filesystem
Like the default filesystem for Windows is NTFS, the default for macOS is APFS, similarly for Linux it is ext4.
For UEFI Systems: Creating two partitions, for EFI and for Root.
Create a FAT32 filesystem for the EFI Partition:
mkfs.fat -F32 /dev/sda1
Create an ext4 filesystem for the root partition: (This may take some time depending upon the size of your partition)
mkfs.ext4 /dev/sda2
For Legacy (BIOS) Systems: Creating only 1 Root Partition:
Create an ext4 filesystem for the root partition:
mkfs.ext4 /dev/sda1
Connecting to Internet
All the steps before this did not require internet access. But the upcoming steps do.
Ethernet
Ethernet users do not need to worry, as they are already connected and Arch has recognized their card.
WiFi
For WiFi, enter the command:
wifi-menu
You should see the connections in range and should be able to connect using a password.
Verify your connecting by:
ping google.com
If you get an output saying that it is sending bytes to google, you are successfully connected to WiFi.
Alternative method
Some WiFi cards are not recognized by Arch because they are proprietary. In that case, you can connect an Android to your computer via USB and choose USB tethering on your phone, and Arch should recognize it as an Ethernet connection. Verification:
ping google.com
Selecting a good mirror
Mirrors are different servers throughout the world from which packages are downloaded. Usually the automatic mirror selection is not very fast, and hence your download speed might be in bytes.
Thankfully, there is a fix for that.
First, update the pacman repositories:
pacman -Syy
Install reflector:
pacman -S reflector
Make a backup of your existing mirrorlist (just in case):
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
Get a good mirrorlist with reflector and save it:
reflector -c "US" -f 12 -l 10 -n 12 --save /etc/pacman.d/mirrorlist
(Note: Replace “US” with your country.)
Good to go.
Installing to disk
Everything is ready, and therefore, we are ready to finally install Arch on disk.
Mount the root partition:
mount /dev/sda2 /mnt
(Note: Replace /dev/sda2 with /dev/sda1 for Legacy systems.)
With the root partition mounted, its time to use a pacstrap script to install all the packages:
pacstrap /mnt base linux linux-firmware nano# base: the packages in every linux distro, which are essential
# linux: the Linux kernel
# linux-firmware: the firmware (drivers, etc.) for the kernel
# nano: a useful text editor for later
Configuring the system
Generating an fstab file:
genfstab -U /mnt >> /mnt/etc/fstab
Using arch-chroot to enter the mounted disk as root:
arch-chroot /mnt
Setting timezone:
timedatectl list-timezones # lists the timezones
timedatectl set-timezone Region/City
# Replace Region with your continent
# Replace City with your city
Setting locale:
locale-gen
echo LANG=en_US.UTF-8 > /etc/locale.conf
export LANG = en_US.UTF-8
# Replace en_US with your preferred locale, eg. en_GB
(Note: these can be changed later as well.)
Network configuration:
Setting a hostname (i.e. computer name):
echo arch-pc > /etc/hostname
# Replace arch-pc with your desired hostname
touch /etc/hosts
nano /etc/hosts
# Add this and replace arch-pc with your hostname
127.0.0.1 localhost
::1 localhost
127.0.1.1 arch-pc
Setting up a password for the root account:
passwd
Installing a bootloader
A bootloader is essential for making your Arch system bootable. In this case, we will be using grub, which is a very popular bootloader.
(Note: Make sure you are still using arch-chroot)
For UEFI Systems:
pacman -S grub efibootmgr
mkdir /boot/efi
mount /dev/sda1 /boot/efi
grub-install --target=x86_64-efi --bootloader-id=GRUB --efi-directory=/boot/efi
grub-mkconfig -o /boot/grub/grub.cfg
For Legacy (BIOS) Systems:
pacman -S grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
Adding a user
You need to have a user, as using the computer as root is not ideal and it is not safe. To add a user with administrative priveleges, execute the command:
pacman -S sudo
useradd -G wheel -m username
(Replace username with the name of your user).
Put a password for your account:
passwd username # Replace username with your username
Put a password for the root account:
passwd
Then, use nano or any other text editor, I will use nano in this case.
EDITOR=nano visudo
Scroll down and look for this line:
## %wheel ALL=(ALL) ALL
Remove the two hashtags in the front to uncomment the line. Save the file by pressing Ctrl + X
.
Installing a desktop environment
Technically, Arch is installed and configured. But, this guide also includes how to set up a graphical user interface as we are still on the command line. There are a lot of officially supported desktop environments by Arch:
- Budgie — Modern and lightweight
- Cinnamon — Windows style and modern
- Deepin — Modern and eye-candy
- Enlightenment — Lightweight on system resources
- GNOME — Modern but heavy
- GNOME Flashback — Older version of GNOME
- KDE Plasma — Modern, customizable and moderate on resources
- LXDE — Lightweight and fast
- LXQt — Qt port of LXDE
- MATE — Intuitive and attractive
- Sugar — Learning and educational
- UKUI — Lightweight and default of Ubuntu Kylin
- Xfce — Lightweight, modern and reusable
Depending on these characteristics, you should have chosen which one to install. Although you can install multiple desktops, it is not recommended.
Installing a display server (X Display Server or xorg):
pacman -S xorg
Installing the desktop environment (use any one command for your choice):
pacman -S budgie-desktop # For Budgie
pacman -S cinnamon # For Cinnamon
pacman -S deepin # For Deepin
pacman -S enlightenment # For Enlightenment
pacman -S gnome # For GNOME
pacman -S gnome-flashback # For GNOME Flashback
pacman -S plasma # For Plasma
pacman -S lxde-gtk3 # For LXDE
pacman -S lxqt # For LXQt
pacman -S mate # For MATE
pacman -S sugar sugar-fructose # For Sugar
pacman -S ukui # For UKUI
pacman -S xfce4 # For Xfce
Installing a display manager (login screen):
In this case, we will use GNOME Display Manager (gdm)
pacman -S gdm
systemctl start gdm.service
systemctl enable gdm.service
systemctl enable NetworkManager.service
Configuring network postinstall
Enter this command to install some of the common network tools:
pacman -Syu iwd netctl dialog dhcpcd wpa_supplicant ifplugd
exit
reboot
After booting back up, select Arch Linux in the GRUB menu and press enter. Enter your username and password and hit enter.
Enter these commands for the setup:
sudo su
systemctl enable iwd.service
systemctl start iwd.service
systemctl enable systemd-resolved.service
systemctl start systemd-resolved.service
And set up WiFi.
Shutdown:
shutdown now
And that’s it.
Congratulations, you have now installed Arch Linux and successfully set up a desktop for daily use. Now you can tell people “I use arch btw”.
Thank you for reading this article and if you liked it, follow me for more articles like this.
Credits:
- ArchWiki for the install guide
- This article by It’s FOSS for the images