Installing Ubuntu on VirtualBox
Installing Ubuntu on VirtualBox: A Beginner’s Guide
Introduction
Before starting the Bash scripting series, you need a Linux environment where you can practice commands, write scripts, and experiment safely. One of the easiest ways to get started is to install Ubuntu inside a virtual machine using Oracle VirtualBox.
In this tutorial, we will walk through downloading Ubuntu, installing VirtualBox, creating a virtual machine, and completing the initial Ubuntu setup.
You do not need to replace Windows or repartition your computer's physical drive. Ubuntu will run inside a virtual machine, allowing you to learn Linux while keeping your existing operating system.
What You Will Need
A Windows, macOS, or Linux computer.
Oracle VirtualBox installed on your computer.
The Ubuntu Desktop ISO installation file.
Enough free disk space and memory for a virtual machine.
Estimated time: 30–60 minutes, depending on your computer and internet connection.
Table of Contents
Introduction to Ubuntu
Installing Oracle VirtualBox
Organizing Your Files
Downloading the Ubuntu ISO
Creating a Virtual Machine
Connecting the ISO
Installing Ubuntu
Starting Ubuntu for the First Time
Shutting Down Your Virtual Machine
Final Checklist
Conclusion
1. Introduction to Ubuntu
Ubuntu is a Linux distribution based on open-source software. It is widely used for desktop computing, development, and server environments, making it a suitable choice for learning Linux fundamentals.
Throughout this series, Ubuntu will serve as our primary environment for practicing Linux commands and Bash scripting.
2. Installing Oracle VirtualBox
What Is VirtualBox?
Oracle VirtualBox is virtualization software that allows you to create and run virtual machines on your computer.
Before continuing, it is important to understand two terms:
Host machine: The physical computer running VirtualBox. Its operating system is called the host operating system.
Guest machine: The virtual computer running inside VirtualBox. In our case, Ubuntu will be the guest operating system.
Think of the host as a computer that can accommodate multiple virtual machines. The host remains in control and manages the resources allocated to each guest.
Download VirtualBox
Visit the official VirtualBox download page:
Download Oracle VirtualBox: https://www.virtualbox.org/wiki/Downloads
Choose the installer appropriate for your host operating system and follow the installation instructions. Once the installation is complete, open Oracle VM VirtualBox Manager.
3. Organizing Your Files
Before downloading Ubuntu, create a dedicated folder for your virtual machine files.
For example, create a folder named:
VMs
You can place it somewhere convenient on your computer, such as your Documents folder or another drive with sufficient free space.
Keeping your files organized makes it easier to locate installation images, virtual disks, and other resources later.
4. Downloading the Ubuntu ISO
An ISO file is an image containing the files required to install an operating system.
Follow these steps:
Visit the official Ubuntu Desktop download page: https://ubuntu.com/download/desktop
Download the Ubuntu Desktop ISO file.
Wait for the download to finish.
Move the ISO file into the
VMsfolder you created earlier.
Remember where you saved the file. You will need its location when configuring VirtualBox.
5. Creating a Virtual Machine
Step 1: Open VirtualBox Manager
Launch Oracle VM VirtualBox Manager and click New to create a virtual machine.
Step 2: Configure the Virtual Machine
Enter a name for your virtual machine. For this tutorial, we will use Ubuntu-Bash.
Name: Ubuntu-Bash
Type: Linux
Version: Ubuntu (64-bit), where available
The machine folder determines where VirtualBox stores the virtual machine files. You can use the default location or choose your VMs folder.
The exact interface may differ depending on your VirtualBox version.
Step 3: Allocate Memory
The next step is to allocate RAM to your virtual machine.
The original lab uses 8192 MB (8 GB) as an example. The appropriate amount depends on your computer's available memory and the requirements of the host operating system.
Avoid allocating so much memory that Windows or your other host applications become unstable or unresponsive.
Step 4: Create a Virtual Hard Disk
Select the option to create a new virtual hard disk.
The original lab recommends a disk size of 25 GB. This provides room for Ubuntu and your practical exercises.
File location: The location where the virtual disk is stored.
File size: Use 25 GB for this example.
Hard disk file type: VDI is VirtualBox's native virtual disk format.
Storage allocation: A dynamically allocated disk grows as needed, up to its configured maximum. A fixed-size disk reserves its allocated space upfront.
For this beginner setup, a dynamically allocated VDI disk is a reasonable choice.
Review your settings and click Create.
6. Connecting the Ubuntu ISO
Your virtual machine has been created, but it still needs access to the Ubuntu installation media.
Select your Ubuntu virtual machine in VirtualBox Manager.
Open Settings.
Navigate to Storage.
Locate the virtual optical drive. Depending on your version, it may appear as an empty drive under a storage controller.
Select the empty drive and choose the option to select a disk image.
Browse to your
VMsfolder and select the Ubuntu ISO.Confirm the settings.
The ISO should now be connected to your virtual machine. This allows VirtualBox to boot from the Ubuntu installer when you start the machine.
7. Installing Ubuntu
Select your virtual machine and click Start. The virtual machine should boot from the Ubuntu ISO and display the installation interface.
The screens may vary depending on the Ubuntu release, but the general process is similar.
Step 1: Select Your Language
Choose the language you want to use for Ubuntu. English is a suitable choice for following this series.
Step 2: Configure Your Keyboard
Select the keyboard layout that matches your physical keyboard, such as English (UK) or English (US).
Use the keyboard test option, where available, to check that the keys behave as expected. You can change the layout after installation if necessary.
Step 3: Choose Your Installation Options
Ubuntu's installer may offer different installation choices, including a minimal installation or an installation with additional applications.
The original lab uses the minimal installation option to reduce the number of applications installed initially. You can install additional software later.
Step 4: Select the Installation Type
The installer may display a disk or installation confirmation screen. Pay close attention to the target disk before continuing.
Important: Because Ubuntu is being installed inside a virtual machine, the intended installation target is the virtual disk created for that VM, not your physical computer's Windows drive.
The installer may warn that existing information on the selected disk will be erased. This is expected when installing onto a new, empty virtual disk.
Verify the target before approving any disk-erasure option. Never approve such an option on your physical computer unless you deliberately intend to install an operating system there.
Step 5: Configure Your Time Zone
Select your appropriate geographical region and time zone. This ensures that Ubuntu displays the correct local time.
Step 6: Create Your User Account
Ubuntu will ask you to configure your account details. Depending on the installer, you may need to provide:
Your name.
Your computer's name.
A username.
A password and password confirmation.
For this tutorial, you can name your virtual machine Ubuntu-Bash and choose a username you can easily remember.
Create your own password rather than using a shared or publicly documented password. Keep your login details somewhere secure.
Step 7: Complete the Installation
Continue with the installation process and wait while Ubuntu copies files and configures the operating system.
Once the installation finishes, follow the on-screen instructions to restart the virtual machine.
If prompted to remove the installation media, follow the instructions. You may need to disconnect the ISO through VirtualBox's virtual optical drive settings so that the virtual machine boots from the installed system.
Congratulations! Your Ubuntu virtual machine is installed.
8. Starting Ubuntu for the First Time
After restarting, log in using the account you created during installation.
Once the Ubuntu desktop appears, open the terminal. Depending on your desktop configuration, you can find it through the applications menu or use this keyboard shortcut:
Ctrl + Alt + T
Now try the following commands.
Check Your Username
whoamiThis displays the username of the currently logged-in user.
Check Your Current Directory
pwdThis displays your current working directory.
Display System Information
uname -aThis displays system and kernel information.
List Files and Directories
lsThis lists the contents of the current directory.
If these commands execute successfully, you are ready to practice the Linux fundamentals covered in the first prerequisite guide.
9. Shutting Down Your Virtual Machine
When you finish working, you should shut down or save the state of the virtual machine correctly.
Save the Machine State
This option preserves the current running state of the virtual machine so that you can resume your session later. It is similar to hibernation because your running session can be restored.
Use this option when you want to continue your work later without starting a fresh session.
Send the Shutdown Signal
This requests a normal shutdown of the guest operating system. Ubuntu can close applications and shut down through its usual process.
This is the preferred option when you have finished your work and want to shut down Ubuntu normally.
Power Off the Machine
This immediately stops the virtual machine, much like cutting power to a physical computer. It can result in lost unsaved work and, in some circumstances, filesystem problems.
Avoid using this option unless necessary.
Recommended practice: Save your work and shut down Ubuntu normally. Use Save the Machine State when you want to resume the same running session later.
10. Final Checklist
Before proceeding to the Bash scripting series, make sure you can complete the following tasks:
Explain the difference between a host and a guest operating system.
Install Oracle VirtualBox.
Download and locate the Ubuntu ISO.
Create a virtual machine with an appropriate memory allocation and virtual disk.
Connect the ISO and complete the Ubuntu installation.
Log in to Ubuntu and open the terminal.
Run basic commands such as
whoami,pwd,uname -a, andls.Shut down or save your virtual machine correctly.
If you can complete these tasks, your environment is ready.
Conclusion
Installing Ubuntu in VirtualBox gives you a convenient way to learn Linux without replacing your existing operating system.
You now have a dedicated environment in which to explore the terminal, experiment with commands, create files, and eventually write your own Bash scripts.
Keep your virtual machine organized, save your exercises, and practice regularly. The more comfortable you become with Linux, the easier it will be to understand the scripting concepts introduced in the next lessons.
Next step: Continue with Linux 101: Essential Prerequisites for the Bash Scripting Series, where we explore the Linux command line, file-system navigation, file management, permissions, and other foundational commands.
Comments