Arch Linux is a Linux distribution that has been placed under the best top 10 linux distros. It is lightweight and the main objective of Arch Linux is to keep things simple and that is the reason it comes with a rolling release model, where each and every release comes attached with new packages. But it is a distro definitely not for beginners as it involves a command line based setup. In this article, we are going to see the step by step guide to install Arch Linux in your system:
Prerequisites to Install Arch Linux
- A 64bit system
- 512 MB RAM
- Free disk space of 1GB
- Active internet connection
- USB/DVD drive
- Knowledge of Linux command line utilities
Step-by-Step Guide to Install Arch Linux
Step 1) Download Arch Linux latest edition
First step is to ensure you’ve the latest version of Arch linux downloaded in your system. If you haven’t downloaded it yet, please click here to download.
Step 2) Create a Bootable Disk
Second step is to create a bootable disk to install Arch Linux in your system. To create a bootable usb disk on linux desktop you can use the tools like unetbootin or you can also use dd command, example is shown below
# dd if=archlinux-2018.07.01-x86_64.iso of=/dev/sdb bs=4M
Step 3) Boot from the USB
Now make sure to change the boot sequence to boot from the USB and restart the system
Step 4) Install Arch Linux
Now when your system boots from the USB, you’ll be shown with the installation welcome screen with 6 options including
- Boot Arch linux (x86_64)
- Boot existing OS
- Run Memtest 86+ (Mem test)
- Hardware information (HDT)
- Reboot
- Power off
Select “Boot Arch linux (x86_64)” and hit enter, it will load the temporary os and you will get prompt after automatically root login
Step 5) Prepare Your Own customize Partitions
Next step is to prepare your partitions as the installation requires a mounted partition on the root directory, a swap file along with a home, var and tmp file system. In my case I have around 40 GB hard disk and will create following partitions on it.
- / – 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, type the following command:
root@archiso ~ # lsblk root@archiso ~ # fdisk dev/sda
Now type “n” in the command line for a new partition and after that type in “p” for a primary partition. And by default the first sector will be allocated automatically, so just press enter to continue. Only for the last sector you need to specify the partition size (10GB for /root)
Similarly create partitions for home, var of 12 GB and 10 GB as primary partition.
Similarly, create /tmp and Swap partition of 5GB and 2 GB respectively as logical partitions.
Press ‘t’ , select the 6th partition and set “82” as toggle id. (82 id is used for swap partition)
Step 6) Format the Partitions
Now we have created all the 5 partitions, time to format them using mkfs command and swap partition will be formatted with mkswap command. To create a filesystem, type in the following commands:
root@archiso ~ # mkfs.ext4 /dev/sda1 root@archiso ~ # mkfs.ext4 /dev/sda2 root@archiso ~ # mkfs.ext4 /dev/sda3 root@archiso ~ # mkfs.ext4 /dev/sda5 root@archiso ~ # mkfswap /dev/sda6 root@archiso ~ # swapon /dev/sda6
Now it’s time to mount these partitions:
root@archiso ~ # mount /dev/sda1 /mnt root@archiso ~ # mkdir /mnt/home root@archiso ~ # mkdir /mnt/var root@archiso ~ # mkdir /mnt/tmp root@archiso ~ # mount /dev/sda2 /mnt/home root@archiso ~ # mount /dev/sda3 /mnt/var root@archiso ~ # mount /dev/sda5 /mnt/tmp
Step 7) Install Arch Linux Base Packages
As of now we have created partitions and , let’s install base OS packages.
The Arch linux base package contains everything to run your system. Some of the things contained in the base package are USB utilities, vi editor, file system tools, libraries, C library etc.
To install the base package, type in the following command:
root@archiso ~ # pacstrap /mnt/base base-deve1
Once the above command is executed successfully, we will get output something like below:
Step 8) Generate the fstab file
Once the base packages are installed, generate the fstab file using the genfstab command
root@archiso ~ # genfstab -U /mnt >> /mnt/etc/fstab root@archiso ~ # cat /mnt/etc/fstab
Now change root to the new system that has been installed which means you need to change the root for the process running right now and also for all the child processes running. Execute the beneath command
root@archiso ~ # arch-chroot /mnt /bin/bash
Step 9) Set the Proper Timezone
To set the timezone, type in the following command:
ln -sf /usr/share/zoneinfo/<Region>/<City> /etc/localtime
root@archiso ~ # ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
To see all the time zones, type
root@archiso ~ # ls /usr/share/zoneinfo
To configure the hardware clock, type:
root@archiso ~ # hwclock --systohc --utc
Step 10) Configure Your Locale Settings
The local settings for your system and the language settings can be found in in the file /etc/locale.gen. All you need to do is open the file with the help of the vi editor and just remove the comment from the language of your preferred choice. I had chosen English (US) here (en_US). Once you uncomment the preferred language then run below command,
root@archiso ~ # locale-gen root@archiso ~ # echo LANG=en_US.UTF-8 > /etc/locale.conf root@archiso ~ # export LANG=en_US.UTF-8
Step 11) Set Hostname and Install bootloader
Here am using Linuxbuzz as a hostname:
root@archiso ~ # echo linuxbuzz > /etc/hostname
or
root@archiso ~ # hostnamectl set-hostname "linuxbuzz" root@archiso ~ # exec bash
Now add it to the host file found in /etc/hosts
Now Install Boot loader using the below pacman command
root@linuxbuzz ~ # pacman -S grub root@linuxbuzz ~ # grub-install /dev/sda root@linuxbuzz ~ # grub-mkconfig -o /boot/grub/grub.cfg
Step 12) Set Root Password & create a new user
To Set the root password run the below command,
root@linuxbuzz ~ # passwd root
To create a new user, type in:
root@linuxbuzz ~ # useradd -m -G wheel,users -s /bin/bash pkumar
Now create your own password, type to provide your desired password.
root@linuxbuzz ~ # passwd pkumar
Now add the new users to the /etc/sudoers/ list by adding the following line:
pkumar ALL=(ALL) ALL
Once you are done with user creation, update your system with below command,
root@linuxbuzz ~ # pacman -Syu
Once the above command is executed successfully, we can say we have successfully install minimal ArchLinux.
Step:13) Install Gnome Desktop
If you are a big fan of Linux Desktop like Gnome, then you can install it using the following commands, make sure your system is connected to internet. In my case , my system is already connected to internet and got the IP from DHCP.
root@linuxbuzz ~ # pacman -S gnome gnome-extra root@linuxbuzz ~ # pacman -S gnome gnome-extra
Once the Gnome package are installed then start and enable GDM service using the beneath command
root@linuxbuzz ~ # systemctl start gdm root@linuxbuzz ~ # systemctl enable gdm
Now reboot your system and after reboot you would get Gnome login screen, use the same user name and password we have created in above step.
That’s conclude the article, Congratulations! You have successfully installed ArchLinux along with Gnome desktop. Now explore it and have fun with it 🙂