Create Virtual Machine on VirtualBox? Step-by-Step
To create a virtual machine on VirtualBox, you install the free Oracle VirtualBox software, click “New,” name your VM, choose the operating system type and version, allocate memory and a virtual hard disk, then install the guest OS from an ISO file. This guide walks through each step, explains the key settings, and covers common pitfalls so you can get a working VM quickly.
What Is a Virtual Machine and Why Use One?
A virtual machine (VM) is a software emulation of a physical computer. It runs its own operating system (called the guest OS) inside your actual OS (the host). VirtualBox uses a hypervisor to allocate CPU, memory, storage, and other hardware resources from your host to the VM. Common uses include testing new operating systems, running software that only works on Windows or Linux, isolating suspicious files, and creating development or learning environments without affecting your main system.
Prerequisites and Downloads
Before you start, you need:
- A computer with at least 4 GB of RAM (8 GB or more recommended) and enough free disk space (typically 20–50 GB for a modern OS).
- The latest VirtualBox installer from the official Oracle website. Choose the package for your host OS (Windows, macOS, Linux, or Solaris).
- An ISO file of the operating system you want to install. For example, Ubuntu Desktop ISO, Windows 10/11 ISO, or Debian ISO. These are official images from the OS vendor.
- Optional: Enable hardware virtualization (Intel VT-x or AMD-V) in your BIOS/UEFI if it is not already enabled. Most modern computers have it on by default.
Step-by-Step: Creating the Virtual Machine
- Install VirtualBox – Run the installer and follow the prompts. On Windows, you may need to allow installing device drivers. On macOS, allow the installation from System Settings if prompted.
- Open VirtualBox – The main window shows a list of your VMs on the left and details on the right.
- Click “New” – This opens the creation wizard. Give your VM a name (e.g., “Ubuntu Test”). VirtualBox automatically guesses the Type and Version based on the name, but you can correct them manually.
- Set Memory Size – Allocate RAM. The recommended amount appears in the wizard, but you can adjust. For a 64-bit Linux or Windows 10, 2048 MB (2 GB) is a minimum; 4 GB is comfortable. Do not exceed about half of your host RAM.
- Create a Virtual Hard Disk – Choose “Create a virtual hard disk now.” The default VDI (VirtualBox Disk Image) format works fine. Choose “Dynamically allocated” to save space initially – the file grows as you use it. Set a size: 25 GB is a reasonable default for Linux, 50 GB for Windows.
- Finish the wizard – After clicking Finish, your VM appears in the list.
- Attach the ISO – Select your VM, click “Settings” > “Storage.” Under the Storage Devices, click the empty optical drive icon, then the disk icon next to “Optical Drive” and “Choose a disk file.” Select your OS ISO.
- Start the VM – Click “Start.” The VM will boot from the ISO and begin the OS installation process. Follow the on-screen prompts for your chosen OS.
Choosing the Right Settings
Getting the settings right avoids problems later:
- Memory (RAM): Give the guest enough RAM to run smoothly. For a lightweight Linux distro, 2 GB is fine; for Windows 11, you need at least 4 GB. Never allocate more than 50–75% of your total host RAM.
- Processors (CPU): In Settings > System > Processor, allocate 2 cores if you have a quad-core CPU. More cores can speed up the VM, but leaving some for the host is wise.
- Video Memory: In Settings > Display, set at least 128 MB for a modern desktop OS. Enable 3D acceleration if you plan to use graphics-heavy applications.
- Storage: The virtual hard disk file type (VDI, VHD, VMDK) matters only if you plan to use the disk with another hypervisor. VDI is VirtualBox’s native format. The size is a maximum – the file only grows as data is written.
- Network: The default NAT mode gives the VM internet access through your host. Bridged mode makes the VM appear as a separate device on your network, which is useful for server testing.
Installing the Guest Operating System
Once the VM boots from the ISO, you follow the normal installation process for that OS. For Ubuntu, you choose language, keyboard, installation type (usually “Erase disk and install Ubuntu” – this only affects the virtual disk, not your real disk), and create a user account. For Windows, you select edition, accept license terms, and choose “Custom: Install Windows only” to use the unallocated space on the virtual disk. After installation, the VM will reboot and boot from the virtual hard disk. You can then remove the ISO from the virtual optical drive to speed up boot times.
Installing Guest Additions (Important)
Guest Additions is a set of drivers and utilities that improves performance and usability. It provides:
- Better video resolution and mouse integration (no need to press Host key to release the mouse).
- Shared folders between host and guest.
- Clipboard sharing and drag-and-drop.
- Improved disk and network performance.
To install: with the VM running, click Devices > Insert Guest Additions CD image. Then run the installer inside the guest. On Linux, you may need to build kernel modules – the installer script does this automatically if you have build tools installed. After installation, reboot the guest.
Common Problems and How to Fix Them
- VT-x/AMD-V not available: If you see an error about hardware acceleration, enable virtualization in your BIOS/UEFI. Look for “Intel VT-x,” “AMD-V,” or “SVM Mode.”
- VM won’t start (black screen): Often caused by insufficient video memory or incorrect graphics controller. Try increasing video memory or changing the graphics controller in Settings > Display.
- Poor performance: Allocate more RAM and CPU cores, but leave enough for the host. Also, make sure Guest Additions are installed.
- No internet in the VM: Check that the network adapter is enabled and set to NAT. If the host uses a VPN, try Bridged mode.
- Cannot install 64-bit guest: This usually means VT-x/AMD-V is disabled in BIOS or the host CPU doesn’t support it. Enable it in BIOS.
Frequently Asked Questions
How much RAM should I give my VM? At least 2 GB for a modern OS, but 4 GB is more comfortable. Do not exceed half of your host’s total RAM to avoid slowing down your main system.
Can I run Windows on VirtualBox on a Mac? Yes, VirtualBox works on macOS (Intel and Apple Silicon via Rosetta, though performance varies). You need a Windows ISO and a valid license. On Apple Silicon, Windows ARM versions work but may be limited.
How do I share files between host and VM? Install Guest Additions, then in VM settings go to Shared Folders, add a host folder, and set it to Auto-mount. Inside the guest, you’ll find it under /media or a drive letter.
Is VirtualBox free for commercial use? Yes, VirtualBox is free and open-source under GPLv2. There is also an Extension Pack (for USB 3.0, RDP, etc.) that is free for personal use but requires a license for commercial use.
Why is my VM slow even with enough RAM? The virtual disk may be fragmented, or you might not have Guest Additions installed. Also, if the host has an HDD, consider using an SSD for the VM file. Enabling 3D acceleration can help graphics.
Can I convert a VirtualBox VM to VMware or Hyper-V? Yes, you can export the VM as an OVF file (File > Export Appliance) and import it into VMware Workstation or Player. For Hyper-V, you may need to convert the disk using tools like qemu-img.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.