Virtualization technology has revolutionized the way we use computers. In the past, if you wanted to run multiple operating systems on a single machine, you had to use a dual-boot system. This meant that you had to choose one operating system at startup and stick with it until you restarted your computer. However, with virtualization, you can run multiple operating systems simultaneously on the same machine without having to restart.
VirtualBox is a powerful, open-source virtualization tool that allows you to run multiple operating systems on a single machine. It’s available for Windows, Linux, and macOS, and it’s completely free. In this article, I’ll walk you through the process of installing VirtualBox and setting up a Linux virtual machine.
What is VirtualBox?
VirtualBox is a virtualization tool that allows you to run multiple operating systems on a single machine. It was developed by Oracle and is available for free under the GPL license. VirtualBox supports a wide range of operating systems, including Windows, Linux, macOS, and Solaris.
VirtualBox works by creating a virtual machine that emulates a complete hardware environment for the guest operating system. This allows you to run multiple operating systems simultaneously on the same machine without interfering with each other. If you want to know more, read this blog post: VirtualBox – Free Virtualization Software For Linux
Minimum System Requirements for Running a Virtual Machine
Before we start, let’s take a look at the minimum system requirements for running a virtual machine. Virtual machines require a significant amount of resources, so it’s important to ensure that your system meets these requirements:
- A 64-bit processor with hardware virtualization support (Intel VT-x or AMD-V)
- At least 4 GB of RAM (8 GB or more recommended)
- At least 10 GB of free disk space
Installing VirtualBox on Linux, Windows, and macOS
To get started with VirtualBox, you’ll first need to download and install it on your system. The process for installing VirtualBox is straightforward, and the steps are similar for Windows, Linux, and macOS.
- Go to the VirtualBox download page (https://www.virtualbox.org/wiki/Downloads) and download the appropriate installer for your operating system.
- Once the installer has been downloaded, run it and follow the on-screen instructions to install VirtualBox.
- After the installation is complete, launch VirtualBox.
If you want to install VirtualBox on your Linux machine, you can follow this installation guide: How To Install VirtualBox In Ubuntu/Linux? – Complete Guide.
How To Create A Linux Virtual Machine in VirtualBox?
Now that we have VirtualBox installed, let’s set up a Linux virtual machine. The process for setting up a virtual machine in VirtualBox is straightforward, and the steps are similar for all operating systems.
Choosing a Linux Distribution and Downloading the ISO
Before we can create a virtual machine in VirtualBox, we need to choose a Linux distribution to install. There are many Linux distributions to choose from, each with its own strengths and weaknesses. For this tutorial, I’ll be using Ubuntu, one of the most popular and user-friendly Linux distributions.
- Go to the Ubuntu download page (https://ubuntu.com/download/desktop) and download the appropriate ISO for your system.
- Once the ISO has been downloaded, launch VirtualBox.
Creating a New Virtual Machine in VirtualBox
Now that we have our Linux ISO, we can create a new virtual machine in VirtualBox.
Click the “New” button in the VirtualBox toolbar.
Enter the name of the Virtual Machine and Select the Ubuntu ISO Image. You can change the VM folder if you want but the default is fine for me. After selecting the ISO Image, you will notice that the Type and Version are automatically selected and grayed out. This is because VirtualBox recognizes the ISO and set the proper Type and Version info.
Now, as you can see I checked the “Skip Unattended Installation” option. This option will allow you to create the User Account and Install the Guest Additions right at the beginning and when you start the VM, it will start installing Ubuntu without the live session. I also wasn’t able to use EFI in Unattended Installation. It is better to Skip Unattended Installation.
Click Next to continue.
For the memory size, allocate at least 2 GB of RAM to the virtual machine. And for the Processor, allocate at least 2 CPU Cores and not more than half of the total Cores available on your system. If you allocate more than half of the CPU Cores, your host OS may not have the proper processing power to operate correctly. It is better to stay within the green lines. If you want to enable EFI then check the Enable EFI option.
Click Next to continue.
Select “Create a virtual hard disk now” and allocate a minimum of 25 GB of storage space. Some Operating System needs more than 25 GB of storage space. But for Ubuntu, 25 GB is enough to successfully install it.
You can Pre-allocate Full Size if you want. This will block the 25 GB of storage space from your Hard Drive or SSD rather than gradually increasing the virtual disk size. Pre-allocating the virtual disk can improve performance but you can skip it if you want more disk space for your host operating system.
Click Next to continue.
Now check if everything is ok. Click Finish to create the Virtual Machine.
Allocating Additional Resources to the Virtual Machine
Before booting into the virtual machine, some additional resources you can add to have a better performance. Click on the Settings button from the VirtualBox toolbar.
Go to System and change the Boot Order as in the image shown below. This will reduce additional boot loading time.
Go to Display and set the Video Memory to the maximum of 128 MB and Enable 3D Acceleration for better graphics performance.
Go to USB and add support for USB 3.0. If USB 2.0 or USB 3.0 is not working then you need to install the VirtualBox Extension Pack. Follow this tutorial to install it. Click OK to save the settings.
Booting the Virtual Machine and Installing Ubuntu
Now that everything is set up, we can start the virtual machine and begin the installation of Linux. Click Start to initialize the virtual machine.
Select Try or Install Ubuntu and press Enter to boot into the Live Session of Ubuntu.
Wait until Ubuntu boots into the Live session. Click Install Ubuntu to initialize the setup process.
Select your Keyboard layout and click Continue.
Now select Normal Installation and check Download updates and Install third-party software. Click Continue to proceed.
Select Erase disk and install Ubuntu and click Install Now.
It will create 2 partitions on the virtual hard disk. Click Continue to proceed.
Select your Time Zone and Continue.
Fill up your User Account Info and click Continue to start the installation process.
Wait for the installation to be complete. It will take around 15 minutes to complete. But it depends on your computer’s hardware and your internet speed.
After finishing the installation process, click on Restart Now to reboot your system.
You don’t need to remove any installation medium. Just press Enter to reboot the system.
How To Install VirtualBox Guest Addition?
VirtualBox Guest Additions is a software package that needs to be installed on a virtual machine running in VirtualBox. It provides additional drivers and utilities that can enhance the performance and usability of the virtual machine.
When you install VirtualBox Guest Additions, it will install device drivers and system applications that enable features such as shared folders, drag and drop, clipboard sharing, improved graphics support, and more. These features can make it easier to work with your virtual machine and make it feel more like a native installation.
To install VirtualBox Guest Additions, you first need to start the VM and login to the guest operating system. Then, go to the VirtualBox menu and choose “Devices” > “Insert Guest Additions CD image.” This will mount the Guest Additions CD image inside the virtual machine.
Open up the CD Drive in the File Manager and right-click the autorun.sh file and select Run as a Program.
It will ask you to enter your password to authenticate. Enter the password and a terminal window will open. Wait for the installation to be complete.
Importing And Exporting Virtual Machines In VirtualBox
One of the key benefits of VirtualBox is its ability to create and manage virtual machines. If you need to transfer a virtual machine to another system or create a backup of an existing machine, you can use VirtualBox’s import/export functionality.
How To Export Virtual Machine In VirtualBox?
To export a virtual machine, click “File” > “Export Appliance” in the VirtualBox Manager or Click the Export button from the Toolbar.
From there, select the virtual machine you want to export. Click Next to continue.
Now select the Export Format and the File location where you want to save the file. The default export format works fine which is “Open Virtualization Format 1.0“. You can also select “Open Virtualization Format 2.0“, a newer version of the export file format. Click the Next button to continue.
Click the Finsh button to start exporting the VM.
The Export File is writing. Wait for the process to be complete. After that you can import the exported file anytime you want on the same machine or on other machine.
How To Import Virtual Machine In VirtualBox?
To export a virtual machine, click “File” > “Import Appliance” in the VirtualBox Manager or Click the Import button from the Toolbar.
Select the OVA or OVF archive file that you have created earlier. Click Next to continue.
Select the Machine Base Folder. This is where you want to save your VM. Click the Finish button to start importing.
The Appliance file is importing. Wait for the process to be complete. After that you will see the virtual machine on left side of the VirtualBox VM list.
Tips and Tricks for Using VirtualBox
Now that you have VirtualBox and a Linux virtual machine set up, here are some tips and tricks to enhance your experience:
- Use snapshots: VirtualBox allows you to take snapshots of your virtual machines, which can be a lifesaver when something goes wrong. Before making any major changes to your VM, take a snapshot so that you can easily revert back to a known working state if needed.
- Install Guest Additions: Guest Additions are additional drivers and software that you can install on your virtual machine to improve performance and functionality. This includes things like better display resolution, mouse integration, and shared folders between the host and guest OS.
- Allocate enough resources: When creating a new virtual machine, make sure to allocate enough resources like RAM and CPU cores to ensure that your VM runs smoothly. Don’t forget to enable virtualization in your computer’s BIOS as well.
- Use bridged networking: By default, VirtualBox sets up a NAT network for your VM, which can limit its connectivity. Instead, use bridged networking to allow your VM to have its own IP address on your local network and access resources outside of the VM.
- Enable clipboard sharing: You can enable clipboard sharing between your host and guest OS by installing Guest Additions and enabling the “Shared Clipboard” option in VirtualBox’s settings. This allows you to easily copy and paste between your host and guest OS.
- Use shared folders: You can also set up shared folders between your host and guest OS by enabling the “Shared Folders” option in VirtualBox’s settings. This allows you to easily share files between your host and guest OS without having to use external storage.
- Use the command line: VirtualBox has a powerful command line interface that allows you to automate tasks and perform advanced configurations. Check out the VirtualBox documentation for more information on using the command line.
VirtualBox provides a flexible and convenient way to experiment with different operating systems, test software compatibility, and create isolated development environments. Whether you’re a developer, an IT professional, or simply an enthusiast, VirtualBox offers a range of possibilities for running multiple operating systems side by side.
Remember to always ensure that your system meets the minimum requirements for running a virtual machine. Allocating sufficient resources to the virtual machine, such as CPU cores and memory, will ensure smooth performance and a seamless user experience.
Once you have VirtualBox installed, you can choose from a wide range of Linux distributions to install on your virtual machine.
Conclusion
VirtualBox is a powerful virtualization tool that empowers users to run multiple operating systems on a single machine. By following the steps outlined in this article and utilizing the various features and settings offered by VirtualBox, you can create and manage Linux virtual machines with ease.
Whether you’re a developer, a tester, or a curious learner, VirtualBox opens up a world of possibilities for exploring different operating systems and expanding your technical expertise. Enjoy the flexibility, convenience, and versatility that VirtualBox brings to your computing environment.