Getting older, not necessarily wiser!
This is the third in a series of posts about installing Arch Linux on a VirtualBox virtual Machine (VM). In this post we will set up our drive and perform the actual Arch Linux install.
In the previous post we booted our VM/computer from the Arch install ISO, which set up a Live version of Arch running in RAM. We then configured then live environment for our needs. Our next step is to get Arch Linux installed on our drive, as our live instance will disappear when we restart our VM.
The first item we need to address is partitioning our drives. Since this is a UEFI system we will need at least two partitions, one UEFI and one system partition. I am going to be setting up three partitions, with the additional partition being used as swap space. We probably don’t really need swap space in this install, but I wanted to cover it.
This is Linux, so there are multiple ways of achieving our objective, to partition the drive. For this example, I will use an old reliable method, specifically fdisk. Feel free to chose another method or just follow along with what I am doing.
Our first task is to list all drives with the following command.
This will show all drives and partitions. If you know what is in your system, the size of the drive will indicate then correct one. My drive is listed as /dev/sda. Yours might have a different designation. Also, since the VM is new, there should be no existing partitions. If this is an actual computer, then there may be pre-existing partitions that you can easily delete them with fdisk.
To access the drive with fdisk, we run the command with the full path to the drive. The command you use may be different. For example, if you are using a M2 drive, you might have an nvme designation instead of an sd designation. For my installs it was;
Once launched, press the “m” key to see all the options. I will be using “g” to create an empty GPT partition table (UEFI), “n” to create partitions, “t” to set partition type, “p” to print out existing partitions, and “w” to write changes to the drive. You may need to use “d” if you need to delete existing partitions.
The partitions you create will depend on your need. Please review this post for information about partitions. My drive will be be setup with the following partitions.
This is the basic order in which I create the partitions.
The next step is to format the partitions we just setup. EFI needs to be FAT32. I chose to use EXT4 for my main install partition. I will use the following commands to set my partitions up. You may have some variation on this.
mkfs.fat -F32 /dev/sda1
The root partition needs to be mounted to /mnt for the packstrap program to correctly install the Arch system. To do this use the following command.
mount /dev/sda3 /mnt
Next we need to activate the swap partition with the following command.
Note there are several options for mounting the EFI partition. Many Arch install tutorials suggest mounting it at this point to /mnt/boot. While this does work, I am not a fan. This will install a Kernel image and RAM disk image on the EFI partition. If we chose to multi-boot, I don’t want the Kernel and RAM disk image on the EFI partition visible to the other Operating System. In this instance I will be installing the Arch system and configuring the fstab file before mounting the EFI partition to /boot/EFI, and then installing grub.
Don’t worry to much about the above. I just wanted to explain why this install may differ from others you may have read.
Depending on your location, and internet access, you may want to find the fastest mirror to use with the pacstrap/pacman programs. To do this we will use a program called reflector. Install reflector with the following command (not this is on the RAM instance of Arch Linux, you may want to do this again after you finish the install.
pacman -S reflector
If you are doing this in the actual Arch install, make a backup of mirror list (just in case). No real reason to do it in the temporary RAM instance.
cp /etc/pacman.d/mirrorlist /etc/pacman.d/mirrorlist.bak
Now, get the good mirror list with reflector and save it (note command is one line).
reflector –-latest 10 –-sort rate –-download-timeout 10 --save /etc/pacman.d/mirrorlist
Because I am behind CGNAT, I use the following options; –latest 10 will set the list to 10 most recently updated sites, –sort rate sorts by speed of download, –download-timeout set to 10 seconds (needs to be higher than the default 5 seconds), and –save outputs to the mirror list for use.
We will use a special version of the pacman (package manager) command called pacstrap. It will install our files to a specif mount point, rather than on the RAM instance we are running.
pacstrap /mnt base linux vi networkmanager
The base package installs the basic Arch system, and the linux package installs the current Linux kernel. Because Arch is a rolling release, the Kernel will get updated fairly often. If you want a more stable kernel then you can instead install the linux-lts (Long Term Support) kernel.
In addition, we need to install a text editor, and some form of network management (neither of which is in base). The vi package is my text editor of choice. However feel free to install a different one, like nano for example. The networkmanager package works automatically once activated. There are other choices, but some need additional installation, packages, or setup.
Once started , this may take some time to install, depending on your internet speed. So relax until the install is finished.
We are almost there. The basic install is done, but it is not bootable. So do not restart yet.
There are also a few other configuration issues to work out as well. We will tackle these in the next post. By the end of part 4 in this series, we will have a basic functional Arch install completed.
Crossing the Arch (Linux) Part 3 Install