Last month, I was bored, so I decided to learn how to install Arch, to see what it’s all about and obviously, so I can say: BTW, I use Arch!
Few clicks here and few clicks there and my laptop was rocking Manjaro BSPWM.
Well, despite the fact that Manjaro is a great OS, the installation process felt too easy, and I was still feeling bored. And thus, it only lasted for a day on my laptop.
Next day, I downloaded “the real deal”. A double d command here, a large cup of coffee there, eyes wide open reading the Arch Wiki and an hour later my machine was rocking Arch.
After my machine was finally blessed with Arch and everything was working as expected, I formatted the hard-disk and installed Arch again. And repeated this process 3 times.
I wanted to make my self familiar with the commands that I had to execute to get Arch up and running.
And when I installed Arch for the 3rd time, I decided to write all the commands that I executed, so I can turn it into a How-To article. And here it is.
How to Install Arch Linux
Step 0: Preparation
Before starting, make sure that you read the Installation Guide on Arch Wiki, just to get your self familiar with what kind of hell you’re putting yourself in.
Decide whether you want to go with GPT or MBR. I went with MBR and nuked my entire hard-disk that contained Windows 10.
Watch a YouTube video on how to install Arch just so you can get an idea about the entire process. The Savage Edition installation of Arch is a great step by step video on How to install Arch by Luke Smith.
Now that you’ve done all the above and you booted into your Arch USB stick and you are looking at the boot menu, let’s start installing Arch.
Step 1: Let’s boot into it
Select the first option: Boot Arch Linux (x86_64).
Connect your laptop to the internet using an Ethernet cable and check if the Internet works by pinging Google:
Stop pinging by pressing CTRL c
Update your system clock:
timedatectl set-ntp true
And check that the time is correct:
Step 2: Formatting the hard disk
Now, we need to format the hard disk using fdisk, but first, we have to know the name of our hard disk and to do that, execute the command:
This will list all the block devices connected to your PC, including the USB stick that you are using to set up Arch.
In my case, the hard disk I want to format is called sda. To enter the hard disk and format it using fdisk type and enter this command:
You should be looking now at a message that says Welcome to fdisk.
Hit m and then press enter for the help menu. Read all the commands to make yourself familiar with them.
Now, let’s nuke some disks.
We need to format the entire hard disk, and to do that you do the following:
Press d and enter. And enter again to confirm which partition.
You might have to do this multiple times depending on how many partitions your hard disk has. And you might be asked if you want to remove a signature, type Y and enter.
If a message appeared that says: No partitions are defined yet, this means that there are no more partitions to delete.
Step 3: Partitioning the hard disk
It’s time to partition out the hard disk. This is how I partitioned my disk:
- Boot partition, +200M
- Swap partition, +20G
- Root partition, +50G
- Last partition is the remainder of your hard disk.
Inside fdisk, start by typing n then enter.
You will be asked to make decisions:
Type P and hit enter for Primary partition. We will pick P for all the partitions that we will create.
Hit enter when you get asked for a Partition number and First sector. We will simply hit enter on these two questions every time we create a new partition.
Now, for the last sector, you type the size that you want just like I wrote above.
Repeat this process based on the number of partitions that you want to create and when you are done, press w and enter.
The disk will be formatted based on your specification and fdisk will quit.
Step 4: Setting the partitions filesystem
Now we need to tell Arch how to store data on these partitions using File Systems. We will choose the ext4 filesystem type which can support volumes with sizes up to 1 exbibyte (EiB) and single files with sizes up to 16 tebibytes (TiB) with the standard 4 KiB block size.
Set ext4 filesystem type on partitions 1, 3 and 4.
As for partition number 2, we need to turn that into a swap partition.
Swap is space on a disk that is reserved for use as virtual memory. When a Linux server runs out of memory, the kernel can move inactive processes into swap space to make room for active processes in the working memory.
To create a swap file, execute these two commands:
Step 4: Mounting the partitions
We need to create folders, each will serve a different purpose. And then, we need to mount them in a specific place in our partitions.
Execute the following command to create a home folder that will contain user-specific configuration files, caches, application data, and media files.
The next command will be for the boot folder which will contains the kernel and ramdisk images as well as the bootloader configuration file and bootloader stages.
Now, execute the following command to mount root, boot, and home:
mount /dev/sda3 /mnt
mount /dev/sda1 /mnt/boot
mount /dev/sda4 /mnt/home
ls /mnt and you should see the lost+found folder and home and boot
Step 5: Installing Arch
Now that our hard disk is formatted, partitioned, with the proper filesystem and all the important folders are mounted in the right places, all we have left to do is download Arch.
To do that, we need to use
pacstrap: an install script that will allow us to install Arch using a valid mirrorlist that is stored in
You have three options to install Arch, the first one being to Install Arch without anything else. And to do that, simply execute the following command:
pacstrap /mnt base
Or, you can install Arch with all the bells and whistles that you will inevitably need. Things like gcc, grep, gzip, make, pacman, sudo and systemd and much more. To install all of these packages automatically, enter the following command instead:
pacstrap /mnt base base-devel
Last but not least, you can enter the name of specific packages to be installed, like:
pacstrap /mnt base base-devel vim
After executing this command, Arch will check the mirrorlist, and start downloading Arch and all the up-to-date packages.
Step 6: fstab & chroot
After Arch is installed, we need to create the fstab file which will define how disk partitions should be mounted into the filesystem.
genfstab -U /mnt >> /mnt/etc/fstab
Now we can chroot to the Arch Linux system that we just installed by executing this command execute this:
Step 7: NetworkManager
Now that we are in our newly installed Arch system, we need to configure few things.
First, we need to connect our machine to the Internet. And to do that, we need to install a network manager using pacman:
pacman -S networkmanager
Now you have to tell systemd to automatically start networkmanager every time the laptop start:
systemctl enable NetworkManager
Step 8: Grub
It’s time to install the bootloader that will allow you to manage all the partitions in your hard disk and manage the operating systems on your machine.
To install GRUB, execute the following command:
pacman -S grub
Now that we installed the GRUB package, we need to run GRUB while specifying our hard disk:
grub-install --target=i386-pc /dev/sda
Finally, create the GRUB configuration file:
grub-mkconfig -o /boot/grub/grub.cfg
Step 9: System configuration
Now that our hard disk is running a bootloader and it’s configured properly, we need to set a few things so that our system can run smoothly.
Things like password, locale, system clock…etc.
To set a password for our root account, type:
Enter your password and hit enter.
Generate the locale file:
Then edit the file
/etc/locale.gen and uncomment the lines that have your language. For English, uncomment the following lines:
#en_US.UTF-8 UTF-8 #en_US ISO-8859-1
To uncomment them, simply remove the #
Save the file and generate the locale:
Create the file
/etc/locale.conf and paste the following inside of it:
To set your timezone, execute this command based on your location. Mine looked like this:
ln -of /usr/share/zoneinfo/Turkey/Istanbul /etc/localtime
Then, we need to run
hwclock to generate
/etc/adjtime for the hardware clock:
In order to identify your Arch machines on a network, you need to set a hostname, to do that, edit the
/etc/hostname file, enter a name and then exit.
Next, add matching entries to
/etc/hosts like the example below.
127.0.0.1 localhost ::1 localhost 127.0.1.1 myhostname.localdomain myhostname
exit and hit enter to exit Arch and then unmount using this command:
umount -R /mnt
Step 10: Setting up the user account
Now, reboot your machine and let it access Arch that we just installed on your machine’s hard disk.
Create a new user using the command below:
useradd -m -g wheel music47ell
Add a password to the new account you just created:
The last thing we need to do is give our newly created account a sudo access so that it can execute root command. And we can do that by editing the sudoers file by doing the following:
Enter the root password
And then edit the file
Search and uncomment the line that says:
#%wheel ALL=(ALL) ALL
Save the file, execute the command exit and you’re good to go.
Congratulation, you just learned how to install Arch in these “few” steps.
Arch is a great OS for people who like to have a fast, reliable, functioning OS that they build and configured on their own. You can rice it however you want and make it look like something that no one else saw before.
Check out this subreddit and see all the crazy rice that people are doing with Arch.