Creating a Virtual Machine in VirtualBox 6: Step-by-Step Guide

This article describes creating a virtual machine in VirtualBox 6. If you are interested in VirtualBox 7, please see section 1 of this article instead.

First, you need to install the Oracle VirtualBox.

On macOS Big Sur I’ve installed version 6.1.16. Still, on macOS Catalina and Windows 10, I installed version 6.1.2 which was available from the older builds on the VirtualBox official site. Because I had some performance problems with version 6.1.12 (version 6.1.12 was the latest version at the time of this article’s initial writing).

The installation of Oracle VirtualBox is pretty straightforward. You will have an exe-file for Windows or a dmg-file for macOS. Just run the installer and follow the instructions.

When the VirtualBox software has been installed, you’ll need to create a new virtual machine. It’s a little bit less evident. So let’s consider it.

I’ll show it for a Mac computer. But for Windows, it is the same.

1. To create a virtual machine, run the Oracle VirtualBox and click the button VirtualBox Button New New:

Create a Virtual Machine (macOS)
Create a Virtual Machine

2. In a window that opens, enter the virtual machine name, select the operating system, and click Continue:

Enter the Virtual Machine Name (macOS)
Enter the Virtual Machine Name

In this example, we are considering creating a new VM for Ubuntu. If you are creating a virtual machine for a different operating system, choose a different Type and Version.

3. On the next screen, set the RAM for the virtual machine. The default is 1 GB. I usually set it to 4 GB. It depends on how much memory you have on the host machine and how much you are willing to spare. In any case, you’ll be able to increase or decrease the virtual machine’s RAM after it has been created.

Set RAM for Virtual Machine (macOS)
Set RAM for Virtual Machine

4. Then you’ll need to choose the Create the virtual hard disk now option, which is the default:

Virtual Hard Disk (macOS)
Virtual Hard Disk

5. Next, you’ll be asked to choose the virtual disk file type. I keep it at the default setting, which is VDI:

Choose Hard Disk File Type (macOS)
Choose Hard Disk File Type

6. Next, I always choose to make the hard disk Dynamically allocated. This allows me to set the disk size to a larger value, for example, 100 GB. But initially, the disk will be small — the virtual machine won’t take up much space on the host machine’s hard disk. And additional space will be allocated as needed.

Choose Dynamically Allocated Disk (macOS)
Choose Dynamically Allocated Disk

7. Finally, set the virtual hard disk file size. I usually set it to a larger value, like 100 GB, since I always use a dynamically allocated disk (which means it will start small and grow as needed). You never know how much additional space you’ll need. So I find it convenient to set the disk size large enough.

Set the Virtual Hard Disk File Size (macOS)
Set the Virtual Hard Disk File Size

8. Now we need to install the Ubuntu operating system. First, download the Ubuntu 22.04 Server .iso image. You can do this here (or just Google for “Ubuntu Server download”).

After downloading the .iso image, select your newly created virtual machine in the left panel and click the Settings button VirtualBox Settings Button:

Select Your VM and Click the Button Settings (macOS)
Select Your VM and Click the Button Settings

In the window that opens, select the Storage tab. Then, add the .iso file to the virtual machine’s optical drive:

Add iso File to VM Optical Drive (macOS)
Add iso File to VM Optical Drive

Also, make sure the virtual machine is set to boot from the CD-ROM first. This is done on the System tab of the same Settings window, and it is the default boot sequence.

9. Now, when you VirtualBox Button Start start your virtual machine, the Ubuntu 22.04 installation from the virtual CD-ROM will begin.

Conclusion

Thank you for reading this article.

This was originally a part of the article “[VirtualBox] Configure an Ubuntu 22.04 / 20.04 Virtual Machine for Web Development (Complete Guide).” But after I’ve updated section 1 of the article with information relevant to VirtualBox 7, I moved the steps for creating a virtual machine in VirtualBox 6 to a separate post. In case it might still be of interest to anyone.

If you are on VirtualBox 7, please see the updated material.

If you have any comments, please post them below. I am always happy to hear from you!

Sergei Korolev
Sergei Korolev
Web developer and the author of all articles on this site. With over 26 years of programming experience, he has specialized in web programming for more than 20 years. He is a Zend Certified Engineer in PHP 5.3 and holds several additional certifications in programming, SEO, web design, UX design, digital marketing, copywriting. You can see his resume here. He is available for remote projects at a rate of $60 USD per hour. You can contact him via this contact form. He currently lives in Belgrade, Serbia.

Leave a Reply

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