Arch Linux is a Linux distribution that ranks among the top 10 Linux distributions. It is lightweight and the main purpose of Arch Linux is to keep things simple. That’s why it comes with a rolling release model where each release comes with a new package. However, it is not a beginner distribution because it includes a command line based setup. This article provides a step-by-step guide to installing Arch Linux on your system.
Prerequisites for installing Arch Linux
- 64-bit system
- 512 MB RAM
- 1GB free disk space
- Active internet connection
- USB / DVD drive
- Linux command line utility knowledge
Arch Linux installation procedure guide Step 1) Download the latest version of Arch Linux
The first step is to make sure you are using the latest version of Arch linux downloaded to your system. Click here to download if you haven’t already.
Step 2) Create a bootable disc
The second step is to create a bootable disk and install Arch Linux on your system. To create a usb disk bootable on a Linux desktop, you can use a tool such as unetbootin or use the dd command. An example is shown below
# dd if=archlinux-2018.07.01-x86_64.iso of=/dev/sdb bs=4M
Step 3) Boot from USB
Next, change the boot order to boot from USB and restart the system.
Step 4) Install Arch Linux
When the system boots from USB, an installation welcome screen appears with six options:
- Boot Arch Linux (x86_64)
- Boot an existing OS
- Run Memtest 86+ (Mem test)
- Hardware information (HDT)
- power off
If you select “Boot Arch linux (x86_64)” and press Enter, the temporary OS will be loaded and you will be prompted automatically after root login.
Step 5) Prepare your own customized partition
The next step is to prepare the partition because the installation requires a swap file with the partition, home, var, and tmp file systems mounted at the root directory. In my case, I have about 40 GB hard disk and create the following partitions:
- / – 10 GB (ext4 file system)
- / home-12 GB (ext4 file system)
- / var – 10 GB (ext4 file system)
- / tmp – 5 GB (ext4 file system)
- Swap-2GB (ext4 file system)
To start creating a new partition, enter the following command:
[email protected] ~ # lsblk [email protected] ~ # fdisk dev/sda
Now, enter “n” on the command line for the new partition, followed by “p” for the primary partition. By default, the first sector is assigned automatically, so press Enter to continue. Only for the last sector you need to specify the partition size (10GB for / root)
Similarly, create a home partition as the primary partition. var is 12 GB and 10 GB.
Similarly, create 5GB and 2GB / tmp and Swap partitions as logical partitions respectively.
Press “t” to select the sixth partition and set “82” as the toggle ID. (82 IDs are used for swap partitions)
Step 6) Format the partition
Now that we have created all five partitions, format the partition using the mkfs command and format the swap partition using the mkswap command. To create a file system, enter the following command:
[email protected] ~ # mkfs.ext4 /dev/sda1 [email protected] ~ # mkfs.ext4 /dev/sda2 [email protected] ~ # mkfs.ext4 /dev/sda3 [email protected] ~ # mkfs.ext4 /dev/sda5 [email protected] ~ # mkfswap /dev/sda6 [email protected] ~ # swapon /dev/sda6
Next, mount these partitions.
[email protected] ~ # mount /dev/sda1 /mnt [email protected] ~ # mkdir /mnt/home [email protected] ~ # mkdir /mnt/var [email protected] ~ # mkdir /mnt/tmp [email protected] ~ # mount /dev/sda2 /mnt/home [email protected] ~ # mount /dev/sda3 /mnt/var [email protected] ~ # mount /dev/sda5 /mnt/tmp
Step 7) Install Arch Linux base package
You have now created a partition. Let’s install the base OS package.
The Arch linux base package contains everything to run the system. The basic package includes a USB utility, a vi editor, a file system tool, a library, and a C library.
To install the base package, enter the following command:
[email protected] ~ # pacstrap /mnt/base base-deve1
If the above command runs successfully, you should see output similar to the following:
Step 8) Generate fstab file
Once the base package is installed, generate a fstab file using the genfstab command
[email protected] ~ # genfstab -U /mnt >> /mnt/etc/fstab [email protected] ~ # cat /mnt/etc/fstab
Now change the root to the new installed system. This means that the root of the currently running process and all running child processes must be changed. Execute the command below
[email protected] ~ # arch-chroot /mnt /bin/bash
Step 9) Set the appropriate time zone
To set the time zone, enter the following command:
ln -sf / usr / share / zoneinfo /
[email protected] ~ # ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
To display all time zones, enter:
[email protected] ~ # ls /usr/share/zoneinfo
To configure the hardware clock, type:
[email protected] ~ # hwclock --systohc --utc
Step 10) Configure locale settings
System local and language settings are in the file /etc/locale.gen. All you need to do is open the file with the help of the vi editor and remove the comments from your preferred language. Here I chose English (US) (en_US). After uncommenting the preferred language, execute the following command,
[email protected] ~ # locale-gen [email protected] ~ # echo LANG=en_US.UTF-8 > /etc/locale.conf [email protected] ~ # export LANG=en_US.UTF-8
Step 11) Set host name and install boot loader
Here, Linuxbuzz is used as the host name.
[email protected] ~ # echo linuxbuzz > /etc/hostname
[email protected] ~ # hostnamectl set-hostname "linuxbuzz" [email protected] ~ # exec bash
add to host file in / etc / hosts
Next, install the boot loader using the following pacman command
[email protected] ~ # pacman -S grub [email protected] ~ # grub-install /dev/sda [email protected] ~ # grub-mkconfig -o /boot/grub/grub.cfg
Step 12) Set root password and create new user
To set the root password, execute the following command.
[email protected] ~ # passwd root
To create a new user, enter:
[email protected] ~ # useradd -m -G wheel,users -s /bin/bash pkumar
Next, create your own password and enter and enter the desired password.
[email protected] ~ # passwd pkumar
Add the following line to add the new user to the / etc / sudoers / list:
pkumar ALL=(ALL) ALL
After the user creation is completed, update the system with the following command,
[email protected] ~ # pacman -Syu
If the above command is executed successfully, it can be said that the minimum ArchLinux has been successfully installed.
Step: 13) Install Gnome Desktop
If you are a big fan of Linux desktops like Gnome, you can install it using the following command: Make sure your system is connected to the Internet. In my case, my system is already connected to the Internet and gets an IP from DHCP.
[email protected] ~ # pacman -S gnome gnome-extra [email protected] ~ # pacman -S gnome gnome-extra
After installing the Gnome package, start and enable the GDM service using the command below
[email protected] ~ # systemctl start gdm [email protected] ~ # systemctl enable gdm
Restart your system and after rebooting you will see the Gnome login screen. Use the same username and password created in the steps above.
Congratulations! You have successfully installed ArchLinux with the Gnome desktop. Come and explore and have fun!