How to Install Ubuntu on VirtualBox [2 Methods]

LINUX
FUNDAMENTALS
A Complete Guide for Beginners Enroll Course Now

VirtualBox is the world’s most popular open-source virtualization software. It allows you to create and run different virtual machines in your host operating system. Running a virtual machine on your system provides you with a flexible and convenient way of using different operating systems without altering your primary operating system. Whether you’re a newcomer to Linux or an experienced user, creating a virtual Ubuntu environment can be a valuable tool for learning and experimentation.

There are various ways to install Ubuntu:

  1. Replace the current OS with Ubuntu.
  2. Dual-boot installation of Ubuntu.
  3. Install Ubuntu on Virtualbox.
  4. Install Ubuntu on VMware Workstation.
  5. Install Ubuntu on VMware Player.

In this article, I will show you how you can install Ubuntu on VirtualBox.

Requirements to Install Ubuntu on VirtualBox

  • Minimum 4 GB RAM.
  • Minimum 8.6 GB free storage (30 GB+ recommended).
  • At least 2 GHz dual-core processor.
  • Minimum screen resolution of 1024×768.
  • Active internet connection.

Method 1: Install Ubuntu Manually

Installing Ubuntu manually in VirtualBox provides a way to create a customized virtual environment with a hands-on approach. It allows users to fine-tune every aspect of the installation. It is also important for testing and development.

This method is ideal for people who need precise control over software installation and system setup. It ensures a fine-tuned virtual Ubuntu system aligned with an individual’s preference and requirements. This makes it a preferred choice for people who want a personalized experience.

Step 01: Install Virtualbox

First of all, to install Ubuntu in VirtualBox, you need to have VirtualBox installed. To install VirtualBox follow these step by step instructions below:

  1. To begin, open your web browser and visit the official VirtualBox website.
  2. From the side menu select Downloads. Here you will see the latest version of the app. Click on the “Windows hosts” link to initiate the download.download VirtualBox
  3. You need to have the virtualization feature enabled from your BIOS. To enable CPU virtualization, first, reboot your computer. Then, while your PC is rebooting, keep pressing the key specified for opening the BIOS. You can find the key on your manufacturer’s website or it may be displayed on the screen during startup. Now, check for the virtualization technology in the BIOS menu and enable virtualization. After that, save changes, exit from BIOS, and Reboot your PC. Now you will proceed to use VirtualBox in your system.
  4. Change your directory, locate the downloaded installer file, and double-click on it to begin the installation. Click on “Next” in the installation wizard.go to download directory and double click on the installation fileclick next on installation wizard
  5. Now, you will be able to customize the installation from the prompted window. Select the specific components you want to install. You will also be able to change the installation directory from this window.set the specific components you want to install and installation directory
  6. After finalizing your choice, click the Next button.Click “Yes” on the Network Interfaces window
  7. Click “Yes” on the Network Interfaces window and then on the Missing Dependencies window.Click “Yes” on the Missing Dependencies window
  8. Now, click on “Install” to initiate the installation.click on install to initiate the installation installation going on click "Finish" to exit from the installer
  9. After, completing the installation, click “Finish” to exit the installation wizard. Make sure you have the Start VirtualBox checkbox checked. It will automatically open VirtualBox after closing the installer wizard.VirtualBox interface

Step 02: Download Ubuntu Image

You need to download the Ubuntu image first to use it in the VirtualBox. This Ubuntu image will serve as the foundation for your virtual machine, enabling you to explore the Linux world within VirtualBox securely. To download the Ubuntu image:

  1. Visit the official Ubuntu website’s download page.
  2. Select the Ubuntu version that suits your needs. Though in this guide, I am downloading the latest version, I will recommend you choose the latest LTS (Long Term Support) version for stability.
  3. The Ubuntu image will be downloaded to your system. Make sure you have a stable internet connection for a swift download.

Step 03: Create a New Virtual Machine

In this step, we will create a VM, give a name to that VM, set its location and iso image, and allocate hardware to the VM. To create a new VM:

  1. Open VirtualBox, select “Machine” and click “New.”create new virtual machine
  2. Enter a name for your VM, I have used “ubuntu” here.
  3. You can change the location of your virtual machine. The virtual machine will be installed and stored there.
  4. Select the Ubuntu image you downloaded in the previous section. It will automatically detect the type and version of the iso image.
  5. Click on the checkbox to skip unattended installation. (I am using manual installation in this section; I will show unattended installation in Install Ubuntu Using Unattended Installation.)
  6. Click on “Next”.set virtual machine (VM) name and installation location
  7. Select the size of base memory (RAM) you want to allocate and select the number of CPUs you will use as processors for the virtual machine by dragging the slider or typing it in the right box. I recommend using at least 4GB (4096 MB) Base Memory and 2 CPU cores for the processor. You can select more or less according to your primary system availability.  Click on “Next”.set RAM and CPU cores for VM
    Warning: You can allocate more memory and CPU cores for a smoother experience, but make sure to stay in the green region of the slider.
  8. Select “Create a Virtual Hard Disk Now” and change the amount of storage you want to give to your VM. I recommend using 30GB of storage for the Ubuntu virtual machine Hard Disk. You can choose more or less according to your preference. If you want to pre-allocate whole storage then click on the checkbox “Pre-allocate Full Size”. Then the whole assigned store will be separated and will be reserved for the virtual machine’s usage. But if it is unchecked then the storage will be allocated dynamically according to your usage. For casual usage, pre-allocating the full size is not recommended.set Hard Disk size for VM
  9. Now, check all the details from the summary and if everything is as you wanted then hit “Finish”. Otherwise, go back and change those settings. After finishing this, you will be back to the VirtualBox Manager interface.revise the summary of the VM details

Step 04: Start the Newly Created Virtual Machine

Click on “Start”. Make sure the Ubuntu virtual machine is selected. You will be prompted with a message saying “Powering VM up”. It will start the VM that you created.

start the virtual machine (VM)

Step 05: Pre-Installation Setup of Ubuntu

Now, you will select different preferences for Ubuntu installation as following:

  1. Select “Ubuntu (safe graphics)” and press ENTER. Ubuntu graphical installation interface will open after some moments. VirtualBox will prompt 2 messages in the sidebar that it detected your mouse and keyboard.ubuntu graphical installationgraphical installation startingubuntu booting up for installation
  2. Select your preferred language and click on Next.select your preferred language
  3. Click on Install Ubuntu and then click on Next.select install ubuntu
  4. Select your keyboard layout and keyboard variant. You can also try typing with your keyboard to check if it’s working properly. Now, click on Next.select your preferred keyboard layout and variant
  5. Select your preferred connection mode and click on Next.
  6. Select your preferred installation type. Here I am selecting Normal installation. If you are short on storage, you can choose minimal installation as well. You can also select additional options to install additional proprietary software for Wi-Fi drivers, graphics drivers, media drivers, and some extra fonts.  Again, click on Next.select normal installation
  7. Select Erase disk and install Ubuntu. You can also create partitions in the storage by selecting manual partitioning. After that, click on Next.select erase disk and install ubuntu
  8. Click on Install.install ubuntu
  9. Select your location and time zone. Then click on Next.set location and timezone
  10. Add your name, computer name, username and password. It is important to change the default credentials as keeping the default credentials will not give you sudo access. Also create a long and strong password with uppercase, lowercase, number, and special characters in it. After that, click on Next.Add your name, computer name, username and password.
  11. Select your preferred theme and click on Next.Select your preferred theme

Step 06: Installation of Ubuntu

In this step, VirtualBox will start installing Ubuntu in the VM you created.

  1. After pre-installation setups are done the Ubuntu installation in VirtualBox will start. This process will take some time.ubuntu installation going on
  2. After installation is completed, click on Restart now.installation complete, restart ubuntu now

Step 07: Post-Installation Setup of Ubuntu

In this step, you will log in to the Ubuntu system and start using it. The post-installation setups are as follows:

  1. While restarting you will be prompted to remove your installation medium. You can simply move the Ubuntu iso image to another location and then hit ENTER. Or, you can go to Devices> Optical Drives> Remove disk from virtual drive. It will remove the Ubuntu iso image medium. After that hit ENTER.remove installation medium
  2. Now click on the user account that you created and enter your password. Then hit ENTER.ubuntu booting upselect your user accountenter your user password
  3. You can connect your online accounts in this step and then move to the next step. I am skipping this step in this demonstration.add your online account
  4. Click on Next. If you do not want to share information with Canonical then select “No, don’t send system info” and then click on Next.share data with canonical to improve ubuntu
  5. Set Location Services according to your preference and click on Next.set location services
  6. Now, click on Done.install app packageubuntu interface You are ready to go. Explore Ubuntu to your heart’s content. If you face any serious issues, you can simply remove the virtual machine from VirtualBox and recreate the virtual machine again.

Step 08: Update Ubuntu

After you create a new VM, it is recommended to update your system and all packages to their latest stable release to have a smooth and hassle-free user experience. To update your system and system packages follow these step-by-step processes:

  1. Open the terminal and execute the following command:
    sudo apt update && sudo apt upgrade

    update and upgrade all pre installed app packages in ubuntu

  2. Enter your sudo password when prompted.confirm app update
  3. Press Y and then ENTER to update all packages in Ubuntu. All packages will be downloaded and updated to their latest stable releases.

Method 2: Install Ubuntu Using Unattended Installation

Unattended installation is a feature that allows you to install a guest operating system (OS) automatically, without any user interaction. Performing unattended installation of Ubuntu in VirtualBox can save time and simplify the setup process. Currently, the latest VirtualBox stable release version is 7.0.10, the latest Ubuntu release is 23.04 and the latest Ubuntu LTS (Long Term Support) release version is 22.04. As of this version, VirtualBox is not fully optimized for Ubuntu 23.04. So, in this section, I will show how to do the unattended installation for both Ubuntu releases.

For Ubuntu 23.XX

As unattended installation in VirtualBox for Ubuntu 23.04 is fully not optimized yet, instead of installing the full version of Ubuntu it only installs the “Try Ubuntu” version. Here’s the step-by-step process of doing that:

Note: Before starting, first download the Ubuntu Image. To download Ubuntu Image follow Download Ubuntu Image.
  1.   First, select Machine and then click on New.create a new vm
  2. Change the VM name and installation location. Then select the Ubuntu image from the ISO Image option and click on Next.set up vm name and installation location
  3. Add a Username and Password according to your preference. Then click on Next.add username and passwords
  4. Allocate Base memory (RAM) and Processor’s CPU cores for your VM and click on Next.allocate ram and cpu cores to VM
  5. Allocate the hard disk size for your VM. You can also pre-allocate the full size of the hard disk if you want. Now, click on Next.add and allocate hard disk
  6. Revise all the information. If there is any discrepancy in the details then go back and change that. Now, click on Finish.revise all vm details
  7. Now just sit back and relax. VirtualBox will automatically handle the entire installation process. However, instead of installing Ubuntu, VirtualBox will automatically set up “Try Ubuntu” for this version.vm booting upjust waitubuntu booting up
  8. After setup is complete, the Ubuntu interface will be opened. Click on Start Setup.start setup ubuntu
  9. Select your preferred keyboard layout and click on Next.set keyboard layout
  10. Set Location Services according to your preference and click on Next.Set Location Services according to your preference
  11. Set your Time Zone and click on Next.Set your Time Zone
  12. Click on Skip. If you want you can connect your online account and move forward to the next step.add online account
  13. Add your Full Name and Username and click on Next.add your name and username
  14. Set your password and confirm it. Then click on Next.set your password and confirm it
  15. All of the setup is complete. Now click on Start Using Ubuntu.setup complete
  16. Finally, the Ubuntu home screen will be opened now.ubuntu interface

For Ubuntu 22.XX LTS

VirtualBox can automatically install this version of Ubuntu with its unattended installation feature. For unattended installation of Ubuntu in VirtualBox follow these step-by-step processes:

Note: Before starting, first download the Ubuntu Image. To download Ubuntu Image follow Download Ubuntu Image.
  1. You can follow the instructions from Install Ubuntu using the unattended installation for Ubuntu 23.XX for creating a new virtual machine and setting it up for unattended installation. Make sure to select the Ubuntu 22.XX image in the ISO Image.set up vm with ubuntu 22
  2. After finishing the setup, VirtualBox will automatically install Ubuntu VM in your system. The installation process will take some time. So just sit back and relax.vm booting upunattended installation startingubuntu booting upunattended ubuntu installation on virtualbox going onunattended ubuntu installation on virtualbox continued
  3. After installation is completed, the VM will restart and will ask you to log in with the credentials you set during setup. Log in to your account.login in your user account
  4. The first time you log in to your account, you will have to do some additional setup. Click on skip. You can also add your online account and then move to the next page.add your online account
  5. Then you will be asked to set up Livepatch. Livepatch is used to update and patch your Kernel while the system boots up.  You can set this up or you can skip this step for now by clicking on Next.set up livepatch
  6. At this point, you will be asked to share your user data with Canonical. Set that according to your preference and click on Next.share data with canonical to improve ubuntu
  7. Then set your location services settings according to your preference and click on Next.set location services according to your preference
  8. Finally, click on Done.install software and complete setup
  9. Now, you are ready to go. Use and experiment with Ubuntu to your heart’s content.ubuntu interface after unattended installation

How to Open Ubuntu in Full Screen Using VirtualBox Guest Additions?

When you are using the newly created Ubuntu VM you may notice that Ubuntu is appearing in a small window. Even when you are trying to resize it or maximize it, the window size is persistent and the extra space is filled with blank spaces. To solve this issue, you have to install additional VirtualBox Guest Additions packages. Follow these processes to do that:

  1. First, open your Ubuntu VM.ubuntu not opening in full screen
  2. Then, click on devices. Then click on “Insert Guest Additions CD image”.insert guest additions image on virtualbox
  3. After that, a disk icon will appear on the sidebar of the Ubuntu interface. Now, click on the disk icon and a folder will open.click on the disk icon and then click on run software
  4. Then, click on Run Software. Or, you can open a terminal in this location by right-clicking inside the folder and selecting Open in Terminal. After that, execute the following command in the terminal:
    ./autorun.sh

    click on the disk icon and then open terminal in that directory

    install guest addition using terminal

  5. A new window will open and will ask for your sudo password. Type your sudo password and click on Authenticate.authenticate your guest additions installations
  6. Then, VirtualBox will install VirtualBox Guest Additions packages automatically.guest addition installation going on
  7. After the installation is completed, press ENTER.guest addition installation complete, press ENTER
  8. Now, you need to restart your VM for the changes to take effect. You can manually restart your VM graphically. Or you can simply run the following command to restart Ubuntu automatically:
    sudo reboot

    reboot ubuntu for guest addition to take effect

  9. Enter your sudo password.ubuntu interface is now opening on full screen
  10. After that Ubuntu will restart and you can see that Ubuntu is now opening in full-screen mode and you can now manually resize the Ubuntu VM window.

Conclusion

To sum it up, installing Ubuntu on VirtualBox unlocks a world of possibilities. Whether you are new to virtualization or an expert user, in this guide I have explored all possible ways to create a virtual machine in VirtualBox and install Ubuntu there. I hope the flexibility of full access to the customization and the security of an isolated VM will lead you to a new exploration of the Linux journey.

People Also Ask

What is VirtualBox?

VirtualBox is an open-source virtualization software developed by Oracle. It allows its users to create and manage virtual machines on their host computers. With VirtualBox, you can run multiple operating systems simultaneously on a single physical machine. This enables you to experiment, develop, and test software across different environments without altering your primary system. Its user-friendly interface and cross-platform compatibility make VirtualBox an invaluable tool for any user.

What is Ubuntu?

Ubuntu is a renowned and user-friendly Linux distribution. It is known for its accessibility and versatility. It was developed by Canonical Ltd. Ubuntu offers a powerful alternative to proprietary operating systems like Windows and macOS. Its seamless updates, security features, and regular releases make it a preferred choice for both beginners and advanced users. Ubuntu’s commitment to providing a free, reliable, and customizable computing experience, makes it a popular choice for desktops, servers, and cloud deployments.

Can I delete the iso file after installing Ubuntu in VirtualBox?

Yes, you can safely delete the iso file after Ubuntu installation is complete on VirtualBox. It is no longer necessary after the VM is up and running. But if you ever want to repair Ubuntu installation then you will need the iso file. However, in that case, having the iso file will make creating a new Ubuntu VM far easier and faster.

Can I use all the features of Ubuntu if I install it on VirtualBox?

Yes, you can use most of the features of Ubuntu as fluently as a native installation on VirtualBox. However, some resource-intensive tasks like heavy gaming or graphic-intensive applications might have reduced performance compared to a native Ubuntu installation.

Why do people install Ubuntu on VirtualBox?

The main reason people install Ubuntu on VirtualBox is that you can securely use Ubuntu as a guest OS without affecting our primary OS. There are many other reasons. People use it for learning Linux, software development, creating isolated environments, experimenting without affecting their main system, testing server configurations, etc.

What is the minimum requirement for Installing Ubuntu on VirtualBox?

For a smooth usage of the virtual Ubuntu system, it is recommended to ensure you have a 2 GHz dual-core processor or better, 4 GB of RAM, and 30 GB of free hard drive space allocated for the Ubuntu VM.

Related Articles


<< Go Back to Virtual Machine Installation Guide | Linux OS Installation Guide | Learn Linux Basics

4.9/5 - (14 votes)
Ridoy Chandra Shil

Hello everyone. I am Ridoy Chandra Shil, currently working as a Linux Content Developer Executive at SOFTEKO. I am a Biomedical Engineering graduate from Bangladesh University of Engineering and Technology. I am a science and tech enthusiast. In my free time, I read articles about new tech and watch documentaries on science-related topics. I am also a big fan of “The Big Bang Theory”. Read Full Bio

Leave a Comment