How To Install Arch Linux Easily - Step By Step Guide

Sohail
Sohail

Table of Contents

The command line setup makes Arch Linux one of the most complicated Linux distros to install. Installing Arch Linux has always been a headache for Linux beginners. In this article, I will teach you how to install Arch Linux – step by step.

How to install Arch Linux?

First, you must select your installation source, in this tutorial, I use a live USB:​​​

Install Arch Linux from USB

  1. Download the arch Linux iso from its website
  2. Make your USB Live bootable using the following command
dd if=archlinux.iso of=/dev/sdx

sdx is your USB key. If you want to see the devices connected to your computer, you can type the following command:​

fdisk -l

If you have another OS installed on your computer you can use the following GUI USB bootable maker:

  • Unetbootin
  • Universal USB Installer

If you have your USB key ready then you can start the installation process. ​

install arch linux menu

1. Start your computer

2. Configure the keyboard layout:

a. First, you must find your keyboard layout typing:

ls /usr/share/kbd/keymaps/**/*.map.gz

b. Set your keyboard layout with the command ‘loadkeys’

Also Read – How To Setup Wifi In Arch Linux (CLI)?

3.  Verify the boot mode

a. You must verify if your computer supports UEFI, you can type:

ls /sys/firmware/efi/efivars

b. If the directory doesn’t exist, the system is booted in BIOS.

c. For UEFI support you must read the following documentation:

4. Check your internet connection typing:

ping -c 3 www.google.com

The output must look like this:

arch linux check internet connection

c. If your wired connection fails you can stop the dhcpcd service with: systemctl stop dhcpcd@<tab> and then you must see the following documentation –

d. If your computer has a wifi device,  you can use netctl –

wifi-menu -o

5. Update the system clock –

timedatectl set-ntp true

6. Partition the disks:

a. First you must identify your hard drive, you can see the storage devices with the command fdisk -l. The first hard drive generally is /dev/sda.

scan the hard drive arch linux

b. Partition scheme

/boot200M
/15G – 20G
swapVariable
/homeThe rest of the disk
RAMRecommended swap
1G1G
2G – 4GHalf of RAM
+4G2G

c. Make the partitions with cfdisk (DOS partition tables) or cgdisk (GPT partition tables)

i. If your computer has UEFI support you should use GPT, and you must create a partition with partition type EFI system (EF00). Finally, you must mount the EFI partition at ‘/boot’. You don’t need to create a boot partition anymore.

ii. If you have a BIOS-GPT system, you must create a mebibyte partition with partition type BIOS boot (ef02), then you can create the other partitions like boot, root, and home.

iii. If you choose an MBR (DOS) partition table, you can create the system partitions only, like boot, root,  and home.

​iv.

Partitions types
Partition typeCode
Linux Filesystem83 (cfdisk),  8300 (cgdisk)
Linux Swap82 (cfdisk), 8200 (cgdisk)
BIOSef02 (cgdisk)
UEFI​EF00 (cgdisk)

v. MBR Examples

MBR examples

vi. GPT example

arch linux gpt examples

d. Formatting the partitions

i. You must format the partitions before installing the system.
ii. Use the command:

mkfs.filsystem_type /dev/sdax

iii. filesystem_type can be ext2, ext4, jfs, etc.

iv. sdaxis the partition number

v. 

PartitionPartition TypeCommand to format
/bootLinux Filesystemmkfs.ext2 /dev/sdax
/Linux Filesystemmkfs.ext4 /dev/sdax
swapLinux swapmkswap /dev/sdax
/homeLinux Filesystemmkfs.ext4 /dev/sdax
EFIEFImfks.fat -F32 /dev/sdax

vi. If you created a BIOS partition, you don’t need format it.

vii. Format the swap partition with mkswap and after you must enable the swap with the command swapon /dev/sdax

format partition mkswap

viii. Examples

arch linux installation

7. Mounting the partitions

i. Mount the root partition at /mnt

ii. Make the boot subdirectory in /mnt

iii. Make the home subdirectory in /mnt

iv. Mount the boot partition at /mnt/boot, if you created an EFI partition you must mount it at /mnt/boot

v. Mount the home partition at /mnt/home

vi. Example

arch linux mount home partition

8. Install the base packages

i.

pacstrap /mnt base

ii. For the bootloader you must install grub –

pacstrap /mnt grub

iii. For network management you must install networkmanager:

pacstrap /mnt networkmanager

iv. Example

arch linux network management
arch linux update size

9. Fstab

i. ​ Generate afstabfile (use-Uor-Lto define byUUIDor labels, respectively):

generate an fstab

10. Configure your new system – chroot

a. Change root into the new system:

arch-chroot /mnt/bin/bash

b. Set the timezone

i. List the regions

arch linux list the regions

ii. List the Cities of your region

list the cities of your region

c. ​​

ln -s /usr/share/zoneinfo/Region/City /etc/localtime

d. hwclock --systohc

iii. Uncomment your localization in /etc/locale.gen using nano

a.  nano /etc/locale.gen

arch linux set timezone

b. ​​‘locale-gen’

linux locale-gen

iv. ​​Set the LANG variable in /etc/locale.conf

​​For example:

echo LANG=en_US.UTF-8 > /etc/locale.conf

v. ​If you set the keyboard layout, make the changes persistent in vconsole.conf

echo KEYMAP=la-latin1 > /etc/vconsole.conf

vi. ​Set the hostname

echo my_hostname > /etc/hostname
arch linux set hostname

vii. Initramfs

​​Creating a new initramfs is usually not required, because mkinitcpio was run on installation of the linux package with pacstrap.

initramfs

viii. ​Set the root password

Use the passwd command

set root password in arch linux

viii. Install Grub – Boot loader

i. If you have an Intel CPU, install the intel-ucode package in addition, and enable microcode updates.

ii. Run the grub installation:

grub-install /dev/sda
run grub configuration

iii. Run the grub configuration –

grub-mkconfig -o /boot/grub/grub.cfg
run grub configuration

ix. Exit from the chroot environment typing ‘exit’

x. Unmount the partitions

umount /mnt/{boot,home,}
unmount partitions arch linux

11. Reboot the system typing ‘reboot’ and remove the installation USB key.

run arch linux in virtualbox

12. In the first boot you must login with the root account, then start and enable the NetworkManager service with systemctl start NetworkManager.service and systemctl enable NetworkManager.

a. If you have a wireless connection you can use the following command –

nmcli dev wifi connect "SSID" password "pass"’

13. Finally, you can create a new user with the following command –

useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power,scanner -s /bin/bash user

Conclusion

So that was it. I hope you know how to install Arch Linux. It was a little long tutorial and that’s why installing Arch Linux is tedious. Once you install it, you’ll enjoy it. Arch Linux is customizable the way he/she wants. After the install, you’ll need more help so I suggest the following documentation to enhance your knowledge of Arch Linux.

Please leave a comment below this article if you do not understand any part of it.

More Information at:

​Boot loadershttps://wiki.archlinux.org/index.php/Category:Boot_loaders
Network Managerhttps://wiki.archlinux.org/index.php/NetworkManager
Post Installationhttps://wiki.archlinux.org/index.php/General_recommendations

10 Steps To Secure Linux Server + {Bonus Tips}

Linux servers are already extremely secure by default; that’s why 100% of supercomputers, most of the top 1 million servers, and top 25% of websites on the internet run on Linux. Besides having security tools in place, users should follow a few steps to further secure Linux servers.

Arch LinuxLinux TutorialsUncategorizedhow-to