[HowTo] Install Arch Linux

Hello everybody. In this new post, I will explain the basic setup to install an Arch Linux 2016. As mentioned on the official website of Arch (www.archlinux.org), this distribution has the main objectives to be lightweight and flexible. Arch Linux has its official and optimized  packages for i686 and x64_86 architectures. These officials packages are available directly through the pacman utility. Additionally, the Arch User Repository, named AUR, completes the official packages. These community packages can be easily installed with yaourt tool.

First, simply download the latest version of Arch from its website. The version used in this document is the 2016.02.01 64 bits. For this tutorial, the system is installed as a virtual machine running on VMware Fusion. The first step is to boot on the ISO. You should see this first screen.

Select the first option. After few seconds, you are logged in root in the live system. Zsh is the current shell in use. The first step to do is to configure the keyboard layout. This can be done using the loadkeys command. For example, in my case, I want the French Switzerland layout.

root@archiso# loadkeys fr_CH

All available keymap files can be found in /usr/share/kbd/keymaps.

Now, it is time to partition the disks. To find the current name of your installed disk, you can run the following command:

root@archiso# fdisk -l
Disk /dev/sda: 30 GiB, 32212254720 bytes, 62914560 sectors

Of course, the output differs in function of your configuration. Just remember the path to your disk where you want to install the system. Now we can partition the disk using cfdisk tool. Select dos as label type. In this example, to be simpler as possible, only one partition is used. Of course, this is not the best practice recommended for security reasons. Be sure to enable “boot” flag on the partition.

Do not forget to write your changes before quitting the tool. After that, it is necessary to format the partition. In this example, I use ext4 filesystem. Then we can mount the partition in /mnt

root@archiso# mkfs.ext4 /dev/sda1
root@archiso# mount /dev/sda1 /mnt

Now we can install the base system on this folder. Simply use this command:

root@archiso# pacstrap /mnt base base-devel

It takes some minutes to download all necessary packages depending of your connection speed. Once done, all base files of Arch are present in /mnt. Now, it is necessary to make a special chroot on it.

root@archiso# arch-chroot /mnt

You can note by trying the ls  / command that the current root directly is now the content of /mnt. The first thing to do is to set a password for the root user of your freshly new system.

sh# passwd

Then, edit /etc/locale.gen and remove the dash (#) in front of your desired locales. In my case I enabled fr_CH.  Then generate all related files to your locales.

sh# locale-gen

It is necessary to create a symbolic link like this to set correctly the time zone

sh# ln -s /usr/share/zoneinfo/Europe/Zurich /etc/localtime

Of course, we need to adapt the path to your current locales. We can set a hostname, for example Archilinux.

sh# echo archilinux > /etc/hostname

After that, we can install the bootloader. In the case of my configuration, I have a BIOS instead of UEFI. Please note that the installation can differ a little with UEFI based system.

sh# echo cd /
sh# pacman -S grub-bios
sh# grub-install /dev/sda

Now if this operation is a success, we can generate the initial RAM disk and the base configuration for linux and grub.

sh# mkinitcpio -p linux
sh# grub-mkconfig -o /boot/grub/grub.cfg
sh# exit

Now, we can generate the fstab to be able to automaticaly mount the file system on boot.

root@archiso# genfstab /mnt >> /mnt/etc/fstab
root@archiso# umount /mnt && reboot

Once done, your system reboot and all is correct, you should see the grub screen.

Select the first option and your system starts. Future [How-to] will explain how to install graphical interface and so on… 🙂

Bookmark the permalink.

One Comment

  1. Ricardo Goncalves Dominguez


    J’ai vue une information de ta part dans un forum, sur ce que je cherchais dans google, ta un moyen de contact? des questions pour la formation que ta fait. Merci

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.