Install Arch Linux in VMware Workstation

Arch Linux is a powerful and customizable operating system with a minimal base install. If you are a newer Linux user then you may be interested in installing Arch Linux, but have been reluctant to do so because of the learning curve that is sometimes associated with the process. If that is the case then it is a great idea to first install Arch Linux as a virtual machine and take it for a test drive. This tutorial will guide you through the steps of installing Arch Linux as a guest machine in VMware Workstation. Following this guide will leave you with a very minimal base Arch install which you can choose to customize however you would like.

If these steps seem like a lot of work just to get a virtual machine up and running, but you want to set up an Arch Linux based virtual machine then you may wan to consider installing Manjaro in VirtualBox instead. If you are not familiar with the relationship between the two distributions then I would recommend that you learn how Arch and Manjaro compare to each other before deciding.

This tutorial assumes that you have a working copy of VMware Workstation installed. If that is not the case then before continuing you you can learn How to install VMware Workstation on Ubuntu 20.04 Focal Fossa Linux or How to install VMware Workstation on Ubuntu 18.04 Bionic Beaver Linux.

In this tutorial you will learn:

  • How to install Arch Linux in VMware Workstation
Install Arch Linux in VMware Workstation

Install Arch Linux in VMware Workstation

Software requirements and conventions used

Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Host System: Distribution-independent, Guest System: Arch Linux
Software VMware Workstation
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

Creating and Configuring the Virtual Machine

First, download the Arch Linux ISO.

Next, open VMware Workstation and then click on File and then New Virtual Machine.

Under Virtual Machine configuration, click Typical, then click Next

htop after running the command

Configuring the virtual machine

Under Install Operating System from, click Use ISO image, click browse and navigate to where you saved the arch Linux ISO then click next.

htop after running the command

Configuring the virtual machine

Click Linux under Guest Operating System.
Under Type, select Other Linux 5.x and later kernel 64-bit, click next.

htop after running the command

Configuring the virtual machine

Leave the default location unless you want to change it, click Next.

htop after running the command

Configuring the virtual machine

Under Disk Size, I recommend increasing the size to at least 20GB if you plan to do anything substantial with this virtual machine(we are going to use 20GB as the total disk size in this tutorial). Click Next to move forward.

htop after running the command

Configuring the virtual machine

Click customize hardware. In this section, I recommend increasing the memory and number of processors to whatever you can spare, but for the purposes of this tutorial the defaults will work just fine. Click close in the bottom right hand corner. Now click Finish.

htop after running the command

Configuring the virtual machine
htop after running the command

Configuring the virtual machine

If the virtual machine auto boots after this step then power it off because we need to change one more setting.
Right click on your virtual machine under Library and click settings. Click the Options tab at the top. Under advanced, change the firmware type to UEFI and click Save.

Now, go ahead and start up the virtual machine. It should boot the Arch Linux installer from the ISO. Give it a minute or so to boot and you should see the command line Arch Linux installation environment.

htop after running the command

Configuring the virtual machine

If you find the default tty console font difficult to read then you can change it to any font in the /usr/share/kbd/consolefonts directory using the setfont command like so.

# setfont /usr/share/kbd/consolefonts/ter-g32n.psf.gz

Installing Arch Linux inside the Virtual Machine

Verify that you are in UEFI mode. If you are then the following command will generate a list of files.

# ls /sys/firmware/efi/efivars

Since we left the default network configuration in place and the Arch installation environment has started network services for us, internet connections should be working out of the box at the moment. To verify this enter the following command and verify that it is able to connect to the server without any packet loss.

# ping -c 4 www.linuxconfig.org

Next, update the system clock

# timedatectl set-ntp true

Next, we need to partition the disk for our Arch install. In order to see the current disk layout enter the following.

# lsblk

You will see the installation ISO sr0, the loop0 device and a drive corresponding to the capacity that you chose earlier (in this tutorial we opted for 20GB). This disk will likely be sda.

For the next step, we must create the partitions that we will use for this install. You may use any command line or TUI partitioning tool you are comfortable with for this step, but for the purpose of this tutorial we will use cfdisk due to it’s user-friendliness. Since our system disk is sda, we will enter the following.

# cfdisk /dev/sda

Select gpt for the label type and press enter. You will now see that there is 20G of free space on the device that we may use to create our partitions. We will be creating three partitions, a FAT32 EFI partition, an ext4 root(/) partition and a swap partition.

Press enter to select New, then type 500M and press enter to create the EFI partition(sda1). Press the right arrow to select Type and change the partition type to EFI System.
Press down to select Free space, then press enter on New to create the root partition(sda2), enter 18.5G for Partition size and press enter.
Press down to select Free space again and press enter on New to create the swap partition(sda3). Enter 1G for Partition size and press enter. Press the right arrow and press enter to select Type then select Linux swap for the partition type.
Use the arrow keys to select Write and press enter. Type yes and press enter to confirm that you want to write the partition table to the disk. Now select Quit and press enter to exit cfdisk.

If you followed along then you should now have 3 partitions created; sda1, sda2, and sda3. To verify that this is the case enter lsblk again.
Now that we have our three partitions, we need to create the appropriate file systems on them.
First, create the swap file system and activate it with the following commands.

# mkswap /dev/sda3
# swapon /dev/sda3

Next, create the root file system.

# mkfs.ext4 /dev/sda2

Now you can create the EFI file system with the following command.

mkfs.fat -F32 /dev/sda1

Now that we created the file systems, we need to mount them in order to proceed with the install.
First, mount the root partition.

# mount /dev/sda2 /mnt

Next create a boot directory on it where we will mount the EFI partition.

# mkdir /mnt/boot

Finally, mount the EFI partition to that directory.

# mount /dev/sda1 /mnt/boot

Now it is time to install the essential packages that make up the base Arch Linux system. To do so enter the following command.

# pacstrap /mnt base linux linux-firmware

The previous command should complete after a few minutes. Now we can generate an fstab file so that when the system boots it knows where to mount the partitions.

# genfstab -U /mnt >> /mnt/etc/fstab

Now that we have the base of our system installed, we need to chroot into it. In order to do that enter the following command.

# arch-chroot /mnt

Now we need to customize the timezone, localization and hostname of our system.

Using whatever region is appropriate for you enter

# ln -sf /usr/share/zoneinfo/Region/City /etc/localtime

You may need to explore the zoneinfo directory and subdirectories to find your time zone. For example, if you live in the Eastern United States you could enter.

ln -sf /usr/share/zoneinfo/US/Eastern /etc/localtime

For the next step you should install the text editor of your choice using pacman as demonstrated below. We will be using vim

$ pacman -S vim

Now you should edit the /etc/locale.gen file and uncomment any locale that you need to use by removing the # before it. In my case, I will be uncommenting en_US.UTF-8 UTF-8, but you may need to uncomment others that correspond with your country.
After performing the above step, enter the following command to generate the locales.

# locale-gen

Next, create the locale.conf file and set your language up using your preferred text editor.

For example, enter:

# vim /etc/locale.conf

and add LANG=en_US.UTF-8 to the file.

Next, edit /etc/hostname and add your chosen hostname, in our case archvm to the file and save it.

Next, edit the /etc/hosts file with your chosen hostname. Since we use archvm for ours, our entries would look like this.

127.0.0.1   localhost
::1         localhost
127.0.1.1   archvm.localdomain  archvm

Next, we need to configure networking for our Arch virtual machine. Right now, networking is working normally because the Arch installation environment automatically started preconfigured systemd networking services. In order to have networking continue to work after we reboot into our fresh install we now must enable and configure those services. To do so enter the following commands.

# systemctl enable systemd-networkd
# systemctl enable systemd-resolved

Next, determine your network interface name by entering

# ip addr

Aside from the lo interface, you should see an additional one, in our case, ens33. Use this value for the Name variable in the next step.

Edit /etc/systemd/network/20-wired.network and enter the following.

[Match]
Name=ens33

[Network]
DHCP=yes

Next, set the password for your root user.

# passwd

If you are using an Intel processor then you should install Intel microcode.

# pacman -S intel-ucode

The final step to completing a full base Arch Linux install in VMware Workstation is installing the bootloader. There are a number to choose from, but for the sake of this tutorial, we will use grub.

First, install the grub and efibootmgr packages to allow us to use grub as the bootloader.

# pacman -S grub efibootmgr

Next, install the grub bootloader to the EFI partition with the following command.

# grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=GRUB

After installing the grub bootloader, we just need to generate the main grub configuration file. To do so, enter the following command.

# grub-mkconfig -o /boot/grub/grub.cfg

The base Arch Linux virtual machine installation is complete. Now you can unmount the partitions and reboot your system.

# exit
# umount -R /mnt
# reboot

Once the system has rebooted you will be able to login to the Arch VM with the root account using the password you created earlier. Now that you have a freshly installed Arch Linux virtual machine in VMware Workstation. You can customize it to your heart’s content. The Arch Wiki Has a list of general recommendations for customizing a fresh install. You may also find their list of applications page useful.

NOTE
If you chose to use the ter-g32n console font recommended above or any other font beginning with ter then you must install the terminus-font package. To do so follow the directions below. If you opted to continue using the default console font then you can ignore this section.
# pacman -S terminus-font

If you would like to make this font your default console font permanently then edit /etc/vconsole.conf and add the following to it.

FONT=ter-g32n

The next time that you reboot your virtual machine the system will use your chosen console font.

Conclusion

In this article we saw how to configure an Arch Linux guest virtual machine on VMware Workstation and complete a base Arch Linux install on it. This virtual machine should serve as a foundation for whatever you want to use the guest operating system for.

After going through this process, you should also be more comfortable with the Arch Linux installation process in general. As a result, you may opt to install Arch Linux on bare metal next. For a great example and guide of what that process could look like, take a look at Installing ARCH Linux on ThinkPad X1 Carbon Gen 7 with encrypted filesystem and UEFI.



Comments and Discussions
Linux Forum