How to install VirtualBox on Linux and create your first virtual machine

Setting up a virtual machine can be a great way to test software or alternative operating systems on your computer without changing or compromising your current system.

Follow to install VirtualBox on Linux and create your very first virtual machine.

What is a virtual machine?

A virtual machine is a virtualized or emulated replacement for a real computer that provides the functionality necessary to run an entire operating system. In other words, a virtual machine allows you to run a second computer (usually called a guest system) within your existing computing environment (usually called a host system).

In most cases, the guest system is completely isolated from the host and runs independently. This creates a perfect platform to test new operating systems or to experiment with unknown or untrustworthy software without endangering the host system.

There are several ways to set up a virtual machine on your Linux system, but one of the easiest is to use it VirtualBox of oracle. It can be used free of charge for non-commercial use and enables you to set up a virtual system with practically any operating system installation medium in just a few steps.

Download and install VirtualBox under Linux

Before you begin you need to install VirtualBox on your system. You can either download it directly from Oracle or, in some cases, install it using your distribution’s package manager.

installation VirtualBox Via your system package manager

if VirtualBox is available in the software repositories of your distribution, the installation via your package manager is the fastest, easiest and safest way. A pre-built version is likely to integrate better with your specific operating system and perform better.

See if VirtualBox is available directly through your distribution, open a terminal and enter the appropriate command, depending on which Linux distribution you are currently using.

For Debian-based systems like Ubuntu and Linux Mint:

sudo apt install virtualbox

For RHEL-based systems like CentOS and Fedora:

sudo dnf install virtualbox

On Arch Linux and its derivatives:

sudo pacman -S virtualbox

if VirtualBox is available, answer Yes sir to all installation prompts and everything should be installed in a matter of moments. When the installation is complete, you will need to restart your system. You can then skip the next section and jump straight to the instructions on setting up your first virtual machine.

If you get an error message that says this VirtualBox is not found, continue below to download and install it from the official website.

Download and install VirtualBox From Oracle

Download VirtualBox from Oracle and install it, you need to go to VirtualBox Linux download page. There, select the installation package that best suits your operating system.

Download: VirtualBox

After you’ve downloaded the installation package, open a terminal and change to the directory where you saved the file. Enter the appropriate command below to start the installation process (replace the filename with the exact name of the downloaded file).

For Debian-based systems like Ubuntu and Linux Mint:

sudo dpkg -i VirtualBox-Version.X.X.deb

For RHEL-based systems like CentOS and Fedora:

sudo rpm -i VirtualBox-Version.X.X.rpm

Your system may download required support packages before the installation begins. Once the installation is complete, you will need to reboot your system before starting VirtualBox.

Create a virtual machine with VirtualBox

As soon as you have VirtualBox installed, setting up your first virtual machine is relatively easy. When you start VirtualBox for the first time you will be presented with a short menu. Just click on the there New Button.

VirtualBox prompts you to give your new virtual machine a name. Select the location for the virtual machine files and the operating system that you want to install.

VirtualBox has built-in support for almost all major operating systems including Windows, Linux, macOS, and even BSD and Solaris.

After you have selected the operating system, VirtualBox prompts you to choose how much RAM to allocate to the virtual machine while it is running. It is generally recommended that you provide at least 4 GB of RAM to your guest operating system.

If you have a lot of RAM, you can improve performance by increasing the amount allocated to your guest system. However, you should not allocate more than half of the physical memory of your system to the virtual machine.

VirtualBox then asks if you want to create a virtual hard disk for your new virtual machine. Since this will be your first virtual machine, you’ll want to choose Now create a virtual hard disk. When asked what type of hard drive you want to create, just leave this setting at its default. VDI or VirtualBox Disk image.

Next, VirtualBox asks you whether you want to dynamically allocate the disk or set it to a fixed size.

If you set the disk to dynamically allocated, VirtualBox the machine starts with a relatively small virtual hard disk, which grows with increasing storage space requirements (up to the maximum you set). Fixed-size virtual disks generally perform better, but the only really noticeable difference is when you create a large drive.

On the next screen, set the maximum hard drive size for your virtual machine. For many systems, VirtualBox is set to 8 GB by default. Although this might work with minimal installations of some operating systems, you should set the maximum hard drive limit a little higher to at least 15 or 20 GB if you don’t want to use your new virtual machine just for the occasional experimentation.

With the configuration set, VirtualBox will return to the main menu and you should see an entry for your new virtual machine on the left side of the VirtualBox Window. Click on your virtual machine and you will see a button labeled begin top right.

Click on begin to start up your virtual machine. VirtualBox opens a dialog box asking you to select the startup disk. Your startup disk is the installation disk for the operating system you want to install.

Just click the folder icon and select the image you want. Press the Add to top left and navigate to the directory where you saved your installation media.

Select the hard drive you want to use. Then click on Choose keep going.

Back at the startup disk selection screen, you should now see the installation image you selected. Press begin and your new virtual machine should start up and load the installation media.

From there, all you have to do is follow the on-screen instructions for the operating system you are installing. When the installation is complete, restart your virtual machine and it should load into the new guest operating system, ready for use.

From this point on, all you have to do is load it up if you are ready to use your new virtual machine VirtualBox and click begin.

Working with virtual machines on Linux

Congratulations! You are currently setting up your first virtual machine! But why stop here? You can set up as many VMs as you can, and there are lots of interesting and exciting things to do with them.

Related Posts