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:
[email protected] ~ # lsblk [email protected] ~ # 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:
[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
Now it’s time to 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 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:
[email protected] ~ # 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
[email protected] ~ # genfstab -U /mnt >> /mnt/etc/fstab [email protected] ~ # 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
[email protected] ~ # 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
[email protected] ~ # ln -sf /usr/share/zoneinfo/Asia/Kolkata /etc/localtime
To see all the time zones, type
[email protected] ~ # ls /usr/share/zoneinfo
To configure the hardware clock, type:
[email protected] ~ # 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,
[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 Hostname and Install bootloader
Here am using Linuxbuzz as a hostname:
[email protected] ~ # echo linuxbuzz > /etc/hostname
or
[email protected] ~ # hostnamectl set-hostname "linuxbuzz" [email protected] ~ # exec bash
Now add it to the host file found in /etc/hosts
Now Install Boot loader using the below 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 & create a new user
To Set the root password run the below command,
[email protected] ~ # passwd root
To create a new user, type in:
[email protected] ~ # useradd -m -G wheel,users -s /bin/bash pkumar
Now create your own password, type to provide your desired password.
[email protected] ~ # 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,
[email protected] ~ # 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.
[email protected] ~ # pacman -S gnome gnome-extra [email protected] ~ # pacman -S gnome gnome-extra
Once the Gnome package are installed then start and enable GDM service using the beneath command
[email protected] ~ # systemctl start gdm [email protected] ~ # 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 🙂