In the Gnu / Linux world, the most common topic is testing various distributions. A task that has become more viral thanks to virtual machines and virtualization software. This is because these machines allow us to install as many operating systems as we want without erasing our computer or having to partition our hard drive.
Next we will talk about VirtualBox, a virtualization software, how to get and install this software and how to create a virtual machine.
Table of Contents
What is VirtualBox?
Virtualization or emulation of certain platforms is something that can be achieved on any operating system, including Gnu / Linux distributions. It could be the case that we want to choose to use emulation for a single program, in which case we will use Wine or we can choose to emulate or virtualize an entire operating system.
This can be achieved as long as the operating system we want to virtualize consumes fewer resources than the hardware we have. This is something very important to take into account because trying to virtualize something more powerful than our hardware or our computer would completely disable the equipment, stopping responding for a while or suspending the activity of the software for security reasons. This virtualization is usually done in containers called virtual machines.. These are usually managed by virtualization programs.
One of the most powerful softwares to virtualize operating systems corresponds to the VMWare company, but fortunately there is an equally good, powerful and open source software that we can install on any Gnu / Linux distribution. This software is called VirtualBox.
The program VirtualBox is open source and cross-platform, so we can create virtual machines in Windows and then transfer them to our computer with Linux for its operation.
VirtualBox is one of the few virtualization programs that allows us to create a virtual hard disk in parts, that is, it increases or uses it depending on how we use it. Another feature of VirtualBox is the creation of virtual machines in a novel way that helps us transport them as if they were text documents or images from a camera.
Another of the benefits of VirtualBox is that this program supports the most famous and popular operating systems that currently exist, not only various Gnu / Linux distributions but also Windows, macOS, Solaris and BSD versions.
The latter is interesting because there is a version for servers that will allow us to create several machines and manage them all from a single server, resulting in having several virtual machines but only a single computer.
How to get VirtualBox?
As with the rest of the Gnu / Linux Software, there are three methods to get VirtualBox. The first of these methods is through the official repositories of the distribution. This means that we have a stable and functional version of VirtualBox but not the latest version of the program and with this we will not have the news of the latest version either. At the moment Virtualbox is in the repositories of the main Gnu / Linux distributions.
The other option is to get the installation package through the official website of the program. This option allows us to have the latest version of VirtualBox but it is also true that it is not tested with the distribution and could hinder the operation of the distribution or not work properly due to the lack of a library.
The third method to get VirtualBox is through the source code. This process is the least troublesome but has the downside of requiring advanced knowledge to compile the code and create the installation package. Not recommended if we want to have VirtualBox on our computer quickly.
How to install VirtualBox?
Installing VirtualBox is very simple. If we use the official repository, we can look for the virtual machine program in the official software manager or open a terminal and run the following code:
sudo apt-get install virtualbox
If we have Ubuntu, Debian or any distribution derived from these. If we have Arch Linux or any distribution derived from it, we have to execute the following code:
sudo pacman -S virtualbox
If we don't have any of those distributions, we have Fedora, Red Hat, or a distribution based on one of these distributions, then we have to execute the following code:
sudo dnf install virtualbox
If we have SUSE Linux, OpenSUSE or any distribution based on them, then we have to execute the following code:
sudo zypper install virtualbox
When executing any of these commands or commands, the virtual machines program will be installed as well as all the necessary dependencies for the program to work. If we opt for the installation from a package obtained through the official website, then we have to execute the following command:
sudo dpkg -i NOMBRE-DEL-PAQUETE.deb
Or we execute the following if the package is in rpm format:
sudo rpm -i NOMBRE-DEL-PAQUETE.rpm
The configuration of VirtualBox is very simple, the same does not happen with the configuration of the virtual machine. Once we have VirtualBox installed, we execute it and a window like the following one will appear:
If we already have a virtual machine from another installation, then it will appear in the left column under the New and Settings buttons. Usually it is not necessary to make many changes but if we want it to work perfectly then we have to go to File and Preferences. In Preferences a window like the following one will appear:
In it we find various common aspects that our virtual machines will have, among them the input of information, usually mouse and keyboard; the standard size of the screen and its resolution; the language of the application; the network connection that the virtual machines will have; the possible extensions that we can add and if we want to configure a proxy. Personally, the only thing I usually change is the General tab the address of my hard disk where the virtual machines that are created will be saved.
Both in the Machine and Group menus we have various actions with virtual machines: from creating a new virtual machine, to moving it from place to cloning. There are shortcuts to these actions but cloning is not, it is only found in the Machine menu and it is used to clone virtual machines, something very useful even if you do not believe it.
How to create a virtual machine with Virtualbox
Having an idea of how VirtualBox works, let's see how to create a virtual machine to install a Gnu / Linux distribution. First we have to open the program and press the New button. A window like the following will appear:
We have to add the name of the virtual machine, it is best to call it by the operating system. Then select the type of operating system that we will install, in this case it will be Linux and then select the distribution that we will install, in this case Ubuntu. We press next and the ram memory screen will appear.
This is very important: NEVER have to put more ram memory than half we have. That is, if we have 4 Gb never add more than 2 Gb to the machine, if we have 2 Gb we will not be able to add more than 1 Gb. This is important because if we do not comply, neither the virtual machine nor our computer will work well.
Click next and the hard disk window will appear. We select the option "Create a virtual hard disk" and press the create button.
On the next screen we leave it as marked, that is, create a VirtualBox hard drive and click next. On the next screen we mark the option "Dynamically reserved"This will tell the program not to reserve the gigabytes of the hard disk but to take them according to the needs of the virtual machine, always not exceeding the limit indicated below.
Now we have to indicate which is the maximum size of the hard disk of our virtual machine. When choosing the operating system, VirtualBox already leaves us marked the minimum amount necessary. After establishing it, we press the create button and we will have our virtual machine. Now we just have to mark the virtual machine and press the "Start" button for the virtual machine to run.
We can see that after several seconds, the virtual machine goes black with a white dash. This is because no operating system is installed, we have to add that. To do this, we get an ISO image of Ubuntu and after that we go to VirtualBox configuration. And in Storage, on the disk with the + sign, we indicate the ISO image. We press the accept button and then after restarting the machine, the ISO Image will be executed and the distribution installation will proceed.
So now what?
You may not find it very useful to create a virtual machine, but after using several virtual machines, you will understand the usefulness of this software within a Gnu / Linux distribution: from being able to try a new version to installing a version of Windows. Thus solving many problems that Linux users face on a daily basis.