These days, more and more people are using virtual machines (VMs) for a variety of tasks. VMs allow you to run multiple operating systems on a single computer, which can be very useful for development, testing, and even production environments. Ubuntu in VirtualBox is the way.
One of the most popular VM platforms is VirtualBox, which is free and open source. In this article, we’ll show you how to install Ubuntu in VirtualBox.
VirtualBox is available for a variety of platforms, including Windows, macOS, and Linux. You can download it from the VirtualBox website.
Once you’ve downloaded the installer, run it and follow the prompts. On Windows, you’ll need to agree to the terms and conditions and then choose whether you want to install for all users or just the current user. But hey, we’re not using Windows here… And as linux users we simply can run something like:
sudo apt install virtualbox
Once the installation is complete, launch VirtualBox from the system menu or command line.
Setting up a VM
Now that VirtualBox is installed, you’ll need to create a VM. This is where you’ll install Ubuntu.
To create a new VM, click the “New” button in the VirtualBox manager window. You’ll be asked to choose a name and operating system for your VM. For the name, you can enter anything you like. For the operating system, choose “Linux” and then “Ubuntu 64-bit” from the drop-down menu.
Click “Continue” and you’ll be asked to set up how much memory to allocate to your VM. The default is 512 MB, but you should increase this if you have enough RAM.
Click “Continue” and you’ll be asked to choose whether to create a new virtual hard disk or use an existing one. Choose “Create a new virtual hard disk” and click “Create”.
You’ll now be asked to choose the type of virtual hard disk. Choose “VDI (VirtualBox Disk Image)” and click “Continue”.
You’ll now be asked to choose the storage type for your virtual hard disk. Choose “Dynamically allocated” and click “Continue”.
Now you have to specify the size of your virtual hard disk. The default is 8 GB, but you can increase this if you have enough space on your physical hard disk.
Click “Create” and your VM will be created.
Installing Ubuntu in VirtualBox VM
Your VM is set up, it’s time to install Ubuntu in VirtualBox. To do this, you’ll need to download the Ubuntu ISO from the Ubuntu website.
Once the ISO is downloaded, mount it to virtual machine in it’s properties.
Click the “Start” button in VirtualBox and your VM will boot from the ISO. You’ll be asked to choose your language and then you’ll see the Ubuntu installer. Click “Install Ubuntu” and you’ll be asked whether you want to install third-party software. Choose “No” or “Yes” accordingly to your needs and click “Continue”.
You’ll now be asked how you want to install Ubuntu. Choose “Erase disk and install Ubuntu” and click “Continue”.
Now you have to confirm your choices. Click “Install Now” and your installation will begin. Follow the prompts and enter your personal information when asked. Once the installation is complete, click “Restart Now”. Your VM will reboot and you’ll be asked to remove the ISO. Remove the ISO and click “Continue”.
After restart, you’ll boot in to your new Ubuntu VM (you can use this tutorial also for Debian).
HW Acceleration – GPU
If you want to use hardware acceleration for your VM, you’ll need to install the VirtualBox Guest Additions. To do this, click “Devices” and then “Insert Guest Additions CD image”. A popup window will appear. Choose “Run” and then “Run”. Enter your password and click “Authenticate”. The installer will run and you’ll be asked to reboot your VM. Once your VM has rebooted, hardware acceleration will be enabled.
Usage Cases of Ubuntu in VirtualBox
Now that you know how to install Ubuntu in VirtualBox, you might be wondering what you can do with it.
Here are some ideas:
- Development environments: You can use a VM for your development environment and keep your host operating system clean and safe, without security risks. This is especially useful if you need to develop for multiple operating systems.
- Testing: VMs are perfect for testing because you can easily snapshot your VM and roll back if something goes wrong.
- Production environments: VMs are often used for production environments because they can be easily backed up and migrated.
- Gaming: You can use a VM to play games that are not available on your host operating system.