In this guide, I will show you how to install VirtualBox in Arch Linux. Numerous aspects of this guide can also apply to any other Linux distribution. Since Arch Linux is the target platform, we will need to install certain dependencies if they’re not there already.
Chances are you already know what VirtualBox is. If not, it is a program from Oracle that allows you to create virtual machines on your computer. It’s like having a separate computer running on top of your operating system. VirtualBox was originally created by Sun Microsystems.
Head to the VirtualBox Linux download page and select the “All distributions” version. It comes in the form of a self-extracting archive. So you simply execute the file. Download
Install Virtualbox in Arch Linux
Make Virtualbox file executable
The file will need to be given rights to execute it. Use ‘chmod’ to enable the execute (‘x’) flag.
$ chmod +x ./VirtualBox-x.x.x-xxxxxx-Linux_amd64.run # replace 'x' with version
Installation depends on several programs. It requires the headers for your currently running kernel to build the necessary modules. It builds those modules using the GCC compiler. So that will need to be installed if it’s not there. If we tried to run the installation without these prerequisites, we would be informed that the kernel modules for VirtualBox failed to be compiled. This applies if the modules for that version have never been compiled before. A list of programs required will be printed.First, we need to install the GNU GCC compiler, GNU make, and Perl if they’re not installed.
$ pacman -S gcc make perl
Then we need to install the kernel headers.
$ pacman -S linux-headers
Now we can successfully install VirtualBox.
Now you should have a working VirtualBox installation on Arch.
This guide is really distro agnostic, that is, it doesn’t apply only to Arch. Any distro, especially bare-bones distros like Arch, will require the installation of prerequisites. Ensure you have those installed and VirtualBox will install successfully.