The best way to Set up VirtualBox on Linux and Create Your First Digital 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 the instructions 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 enables 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 Oracle's VirtualBox. 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.

MAKEUSEO VIDEO OF THE DAY

Download and install VirtualBox on 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.

Install VirtualBox through your system package manager

If VirtualBox is available in your distribution's software repositories, installing it through your package manager is the fastest, easiest, and most secure way. A pre-built version is likely to integrate better with your specific operating system and perform better.

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

For Debian-based systems like Ubuntu and Linux Mint:

sudo apt install virtualbox

For RHEL-based systems like CentOS and Fedora:

install sudo dnf virtualbox

On Arch Linux and its derivatives:

sudo pacman -S virtualbox

If VirtualBox is available, respond 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 saying that VirtualBox cannot be found, continue below to download and install it from the official website.

Download and install VirtualBox from Oracle

To download and install VirtualBox from Oracle, you need to go to the 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

Once you've installed VirtualBox, setting up your first virtual machine is relatively easy. The first time you start VirtualBox you will be presented with a short menu. Just click on that there New Button.

VirtualBox asks 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 choosing the operating system, VirtualBox will prompt 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.

Related: Top Linux Operating Systems That You Should Try in a Virtual Machine VirtualBox will then ask you if you want to create a virtual hard drive 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 whether the hard drive should be dynamically allocated or set to a fixed size.

If you set the hard disk to dynamically allocated, VirtualBox starts the computer with a relatively small virtual hard disk that grows as it needs more space (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. VirtualBox uses 8 GB by default on many systems. 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.

When the configuration is 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 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 that point on, all you have to do is load VirtualBox and click when you're ready to use your new virtual machine 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.

7 practical reasons to use a virtual machine

What are virtual machines used for? Here are some handy virtual machine benefits and uses that you can try right now.

Continue reading

About the author

JT McGinty
(8 published articles)

JT is a technology industry veteran with over 25 years of experience. From technical support and programming to system administration, he did everything. He especially enjoys teaching new users the freedom and power of Linux.

More
By JT McGinty

Subscribe to our newsletter

Subscribe to our newsletter for tech tips, reviews, free e-books, and exclusive deals!

Click here to subscribe

Leave a Reply

Your email address will not be published. Required fields are marked *