Home » Linux » Applications » Virtualization » Running Ubuntu In Virtualbox

Running Ubuntu in VirtualBox on Windows/Mac [Tutorial]

Here’s a straightforward set of instructions (with lots of screenshots) on how to set up Ubuntu Linux in VirtualBox for running Ubuntu in a Virtual Machine on Windows 10 and macOS.

VirtualBox allows you to set up and run virtual machines on your computer easily.  A virtual machine is a whole computer, virtualized running on top of your current operating system – allowing you to try out and experiment with new operating systems and tools without reformatting your computer.

Download and Install Virtualbox

The first step: head to the Virtualbox website to download VirtualBox:

https://www.virtualbox.org/

Click on the big ‘Download’ button to download Virtualbox
Then, select the package for your computer’s operating system – in my case Windows.

Once downloaded, run the VirtualBox installer.  If you’re on macOS, things will look a bit different, but the steps will be largely the same.

Click yes to acknowledge that you might lose internet for a few moments during the install.

The default install options are all fine for our purposes.

Click ‘Install’ when you’re ready to go.
You’ll see a bunch of prompts to install VirtualBox drivers – click ‘Install’ for each. Whether or not you want to be prompted for every further drive from Oracle is up to you – I prefer not to select ‘Always Trust’ so that I know what’s being installed on my system.

VirtualBox is installed! Click ‘Finish’ to continue and launch VirtualBox.

Download Ubuntu

To download Ubuntu, visit:

https://ubuntu.com

…navigate to the downloads section and click on the big green ‘Download’ button.

I recommend Ubuntu Desktop for beginners as it has a graphical interface and a bunch of pre-installed software to help you get started.

Create & Configure a Virtual Machine in VirtualBox

Back to the VirtualBox window, click the ‘New’ Button to create a new virtual machine.
Fill out the name for your virtual machine and select the Type and Version to match the version of Ubuntu you have downloaded. The machine folder can be left at the default.
Select the amount of RAM the virtual machine should have. 1024MB (1GB) is the bare minimum; you should probably use at least 2048MB if your computer, which is running VirtualBox, has more than 4GB of RAM.
Leave the option to create a new virtual hard disk at the default and hit ‘Create.’
Again, the default option ‘VDI’ is the one we want here.
Keep the default ‘Dynamically allocated’ option and continue.
Select the size for the virtual hard disk your Ubuntu virtual machine will use. At least 20GB is recommended (if you have space). As it will be dynamically allocated, it won’t use up this space all at once – the virtual hard disk will grow in size as needed until the 20GB limit is reached.

Start the Virtual Machine and Install Ubuntu

The virtual machine is now configured – let’s install Ubuntu!

Now that the virtual machine is created, the main VirtualBox window will show again. Click the green ‘Start’ button to start the new virtual machine.
You’ll be prompted for a startup disk – this will need to be the Ubuntu install disk image previously downloaded. Click on the folder icon to choose it.
You’ll be presented with a window to choose which disk to load – click on ‘Add’ to add the Ubuntu disk to the list.
Navigate to the downloaded Ubuntu disk image location and select it, then click ‘Open.’
The Ubuntu installer will now appear in the list – select it and then click ‘Choose.’
Click ‘Start’ to start the virtual machine with the chosen disk image.
The Ubuntu installer will boot automatically after running a few checks. VirtualBox will display some warnings about mouse/keyboard integration. They can be dismissed.
When the installer is ready, click ‘Install Ubuntu and follow the prompts.
Select your keyboard layout.
Choose your installation options – the defaults should be fine.
As we’re using a new virtual hard disk with no data on it, the default option of erasing it is fine.

Select your location.
Fill out the details for the Ubuntu user account. Choose a secure password – this account will have administrative rights.
The installer will then complete the installation while displaying some helpful messages.
When it’s done, you’ll be prompted to restart the virtual machine.
The installation disk image will have been automatically disconnected, so go ahead and press ENTER to continue.

Logging in to New Ubuntu Virtual Machine For the First Time

Ubuntu is now installed – let’s see what it can do!

The Ubuntu loading screen. Further mouse/keyboard integration warnings can be dismissed.
Click on your username to log in.

On the first run, you’ll see many welcome screens giving you the option to connect various accounts. Ignore or use them as you see fit.

Go ahead and install any updates if prompted. Staying up to date is a good thing.
The Ubuntu desktop ready to use (almost).

Installing VirtualBox Guest Additions in Ubuntu

We’re almost there – Ubuntu is ready to use, but you’ll probably notice it’s in a window that doesn’t fill your screen.  Installing the VirtualBox Guest Additions in Ubuntu will add support for dynamically resizing the Ubuntu desktop to fit whatever size you drag the VirtualBox window to, or even go full screen.  It also adds the ability to share folders with your virtual machine along with a bunch of other useful stuff.

First, we need to install some dependencies that VirtualBox Guest Additions require. Open the terminal by clicking on the dots in the bottom-left of the screen and searching for ‘Terminal,’ and clicking on the icon.
Once the terminal is ready, run the following commands:
sudo apt update

sudo apt install build-essential gcc make perl dkms

This will install the packages the VirtualBox Guest Additions installer requires.

Enter Y to confirm the installation of the dependencies if prompted.
Next, in the VirtualBox window, click on the ‘Devices’ drop-down and select ‘Insert Guest Additions CD Image.’
Open the file browser by clicking on the folder icon in the left menu bar and then click on the newly inserted disk image in the left panel.
If you aren’t automatically prompted, click the ‘Run Software’ button in the top right of the file browser, then click ‘Run’ to run the installer.
Enter your password if prompted.
You’ll see a bunch of text fly by while the installer does its thing.
When done, you’ll get a message about restarting your computer and be asked to press Return to close the window – do so.
Final step – restart! Click on the down-arrow icon in the top-right of the screen and then click ‘Power Off.’
…Then click ‘Restart.’

All Done!

Your Ubuntu virtual machine is now ready to use – and the screen will resize to fill the screen on the Windows 10 or Mac computer hosting it.

Once you’re up and running, be sure to visit LinuxScrew in your new Ubuntu virtual machine if you need any tips on using your new OS.

SHARE:
Author
I'm Brad, and I'm nearing 20 years of experience with Linux. I've worked in just about every IT role there is before taking the leap into software development. Currently, I'm building desktop and web-based solutions with NodeJS and PHP hosted on Linux infrastructure. Visit my blog or find me on Twitter to see what I'm up to.

Leave a Comment

Exit mobile version