This is the first of three tutorials covering the installation and configuration of Arch Linux. Throughout the series, we will install, and configure Arch Linux.
Linux users at some point would have heard of Arch Linux. Some may have used it, some may never have used it. Some swear by it, while others may have been overwhelmed by it. Arch Linux is aimed targeted towards experienced Linux users, so it is most definitely not for beginners. Installation is manually done step by step. That is, you must create the partitions yourself, copy files over yourself, etc. because there is no installer. Everything is done manually. The biggest advantage of this method is that you have more control over the installation process.
Once you have obtained the ISO file, you can then burn the image to a CD or USB flash drive. The ISO image is only 586MB, small enough to burn on a CD. For virtual machines, the ISO is used directly by the VM software. The ISO contains a functional Arch system. You will use this to install and configure the operating system. Troubleshooting problems with installation can also be done using the live environment.
Boot up your machine and ensure that the system will attempt to boot from the CD/USB first. Once successful, you should see the Arch Linux boot menu. Select “Boot Arch Linux (x86_64)”.The system will then load. If successful, you will be logged in as root. In the current directory, there will be a file called ‘install.txt’. This document is essential because it contains all of the instructions to install and configure Arch properly. Use ‘less’ to view it.
Remember, there is no installation program. You must do everything yourself. Once you have the file open, switch to the second terminal and log in as root. There is no password. Now we can begin the steps. We want to make sure that the keyboard settings are correct. The default for me is the US. If you would like a different keyboard layout, follow the guide for listing all of the possible choices. Use ‘loadkeys
Next, we want to see if UEFI support exists on the target system. If so, this directory, ‘/sys/firmware/efi/efivars’ should exist. In my case, because I was using a virtual machine without EFI support enabled, it was a BIOS system. Therefore the directory will not exist.
Next step is to make sure the system clock is correct. We do this by syncing it with a network time protocol (NTP) server. The ‘timedatectl’ command is the tool used to do this. When run without arguments, it will show the current time settings. Running this command will ensure that the clock is correct.
Note that this requires an Internet connection. Test this using ‘ping’.
We will discuss duplicate packets in the next guide.
Next, we need to set up the partitions required. We will create four of them. One for the BIOS boot, one for the ‘/boot’ directory, a swap space, and the main partition where the system will be installed. You can have another partition for directories like ‘/home’ or ‘/usr’ etc, but to keep it simple, let’s use ‘fdisk’ to create the partition.First, find the target drive using ‘fdisk -l’. For my VM installation, it was ‘/dev/sda’ because it was the only one there, apart from the loop device.
Once the drive has been identified, open ‘fdisk’ using the drive as the parameter.
If this is a brand new drive or image, it will create a DOS disklabel automatically. This was on my VM installation. If this occurs and you want to use GPT as your partition table, it is easy to change. Simply enter ‘g’ to replace the DOS table with GPT. WARNING, this will get rid of any partitions that were already there. Now we shall create 4 partitions (using the ‘n’ command in ‘fdisk’).Let’s create the BIOS boot section, which will take up about 128MB.Next, create the ‘/boot’ partition with a size of 128MB.Then make a swap partition 1GB in size.Finally, create the main partition that will occupy the rest of the drive.
As you will notice, each partition is marked as of the type ‘Linux filesystem’ (code 20). For the first partition, we should change the partition type to be ‘BIOS boot’ (4) (running ‘t’). Use ‘L’ to list the codes to enter for each type. Finally, for the third, we want to change it to be ‘Linux swap’ (19).The other two should remain ‘Linux filesystem’. Once the partitioning is complete, we must enter ‘w’ into fdisk to apply the partitions to the target drive.
Now we can begin formatting the partitions. We don’t need to do anything else with the first partition, just the three others. We will use ‘mkfs’ to format the partitions. First, format the ‘/boot’ partition.
It only needs to be an ‘ext2’ filesystem. Next, we need to create and activate the swap space.
Then finally, create the root partition.
Partitions are formatted. Now, the next thing to do is to install the base system. Let’s mount the partitions. First, we will mount the root partition, then create the boot directory, and mount the boot partition to it.
Next step is to run the ‘pacstrap’ script to download and install the components on the installation partition.
Then we need to generate the ‘fstab’ file (filesystem table) with ‘genfstab’. We will stick with using UUIDs to define volumes (‘-U’).
There are more tasks to do that require changing the root directory. The tool to do this is ‘arch-chroot’, which will change the live system root to the root of our new Arch installation.
Following the guide, proceed to configure your time and date information. Set the correct timezone for your area, then create ‘/etc/adjtime’ using ‘hwclock’.
Next, the locale settings need to be established. Open ‘/etc/local.gen’ using either ‘vim’ or ‘nano’ and you will see a list of locales. Uncomment the ones you wish to use (remove the ‘#’ at the start of each one), then run ‘locale-gen’ to generate them.Next, you need to set the ‘LANG’ variable in the file ‘/etc/locale.conf’ like this for example (check ‘/etc/locale.gen’ for more options):
Next thing to do is to set the hostname. Simply run this command:
Then, the ‘/etc/hosts’ file should be edited to include the hostname according to the installation guide.
We need to create the initramfs file so that Linux can boot. Running ‘mkinitcpio’ will create the file.
$ mkinitcpio -p linux
After generating the initramfs file, the next thing you must do is create symlinks of both the kernel and the initramfs. These are located in the /boot directory of the Arch system you installed.
Next, we need to set the root password in the chrooted environment using ‘passwd’. Otherwise, we can’t do anything with the system after reboot.
The other crucial step we need to perform before rebooting is installing the boot loader. GRUB is what we will need to install using ‘pacman’.
Next we need to install it to the drive we installed Arch on using ‘grub-install /dev/sdX’. Then finally, create the configuration file using ‘grub-mkconfig > /boot/grub/grub.cfg’.Next, we should install dhcp using ‘pacman -S dhcp’. In the next guide, we will go through how to configure it so the system can have Internet access.
At this point the installation is complete. You may now exit the chroot environment by running ‘exit’ and then reboot your machine. If there are any errors booting up the system, you will have to run the install disc again to diagnose the problems. There is plenty of information out there for those who need it.
In the next guide, we will look at configuring the system for Internet access, and software installation.
Let’s create the BIOS boot section, which will take up about 128MB.Next, create the ‘/boot’ partition with a size of 128MB.Then make a swap partition 1GB in size.Finally, create the main partition that will occupy the rest of the drive.