Setting up a virtual lab for Linux experimentation is an essential skill for anyone starting their journey in cloud engineering, DevOps, or system administration. VirtualBox is a powerful, free, and open-source virtualization tool that can run multiple operating systems, while CentOS Stream 9 provides an ideal environment for Linux-based applications and servers. This comprehensive guide will walk you through installing VirtualBox and CentOS Stream 9, ensuring a smooth setup process that enhances your learning experience.
Why VirtualBox and CentOS Stream 9?
VirtualBox allows you to create and manage virtual machines (VMs) on your local computer, providing a safe space for testing and development. CentOS Stream 9 is the upstream version of CentOS, closely aligned with Red Hat Enterprise Linux (RHEL) and perfect for developers and sysadmins who want to work in a stable, enterprise-focused Linux environment.
With VirtualBox and CentOS Stream 9, you can create and test configurations, install packages, and develop software without worrying about compromising your primary operating system. The following instructions guide you through the installation and configuration process.
Prerequisites for Installation
Before starting the installation, ensure that your system meets the following prerequisites:
Hardware Requirements
A computer with at least 4 GB of RAM and 20 GB of free disk space.
Processor Support
Hardware virtualization (Intel VT-x or AMD-V) enabled.
Internet Connection
Active connection to download files.
Basic Knowledge
Familiarity with operating systems and file management.
Video Tutorial: Installation Walkthrough
For a visual walkthrough of the installation process, watch the video tutorial below:
[Embed YouTube video here]
Step 1: Download and Install VirtualBox
1.1. Downloading VirtualBox
To begin, visit the official VirtualBox website to download the latest version of the software. The VirtualBox package is available for various operating systems, including Windows, macOS, and Linux. Make sure to select the appropriate version based on your host operating system.

1.2. Installing VirtualBox on Windows
- Locate the downloaded installer and double-click to run it.
- Follow the on-screen instructions to complete the installation. You may need to approve the installation of device drivers.
- Once the installation is complete, launch VirtualBox from the Start menu.
1.3. Installing VirtualBox on macOS
- Open the downloaded `.dmg` file.
- Drag the VirtualBox icon to the Applications folder.
- Open VirtualBox from your Applications folder.
1.4. Installing VirtualBox on Linux
If you’re using a Linux distribution that supports package management (such as Ubuntu), you can install VirtualBox using the terminal. For Ubuntu, run:
sudo apt update
sudo apt install virtualbox
If you’re using a different Linux distribution, refer to the VirtualBox website for specific installation instructions.
Step 2: Create a Virtual Machine in VirtualBox
2.1. Launching VirtualBox
After installation, open VirtualBox. You will be greeted by the VirtualBox Manager, where you can manage all your virtual machines.
2.2. Setting Up a New Virtual Machine
- Click the New button to create a new virtual machine.
- In the “Name and Operating System” window, enter a name for your VM (e.g., CentOS Stream 9). For “Type,” choose Linux, and for “Version,” select Red Hat (64-bit).
- Set the memory (RAM) for the VM. A minimum of 2 GB is recommended, but allocate more for smoother performance.
- Select “Create a virtual hard disk now” and click Create.
- In the “Hard disk file type” screen, select the default option VDI (VirtualBox Disk Image).
- Choose whether to allocate the hard disk size dynamically or as a fixed size. The recommended size for CentOS Stream 9 is 20 GB or more.
- Click Create to finalize the VM creation.
Step 3: Download CentOS Stream 9 ISO
3.1. Obtain CentOS Stream 9 ISO
- Navigate to the official CentOS website and download the CentOS Stream 9 ISO file. The ISO is available for free and can be used to install CentOS Stream 9 on a virtual machine.
- Select the architecture that matches your VM (typically x86_64) and download the DVD ISO image.
3.2. Mount the CentOS ISO in VirtualBox
- In VirtualBox, with the VM selected, click Settings.
- Go to the Storage tab, and under the Controller: IDE section, click the empty disk icon.
- On the right side, click the Disk icon next to “Optical Drive” and select the CentOS Stream 9 ISO you downloaded earlier.
- Click OK to close the settings.
Step 4: Install CentOS Stream 9
4.1. Boot the Virtual Machine
- Start the VM by clicking Start in the VirtualBox Manager.
- The CentOS installation process should begin. Follow the on-screen instructions to install CentOS Stream 9.
4.2. Setting Language and Keyboard Layout
- In the installation window, select your preferred language and keyboard layout.
- Proceed to the next step.
4.3. Partitioning the Disk
- Choose Automatic Partitioning for simplicity, or select Custom Partitioning if you want more control over the disk layout.
- Click Done to proceed.
4.4. Setting the Timezone and Network Configuration
- Set your timezone based on your geographic location.
- Configure the network settings by enabling the network interface and setting a hostname.
4.5. Setting Root Password and User Accounts
- Set a strong password for the root user (administrator).
- Optionally, create a standard user account to log into CentOS.
4.6. Begin Installation
Once the configurations are complete, click Begin Installation. The installation process will take several minutes. Afterward, you will be prompted to reboot the system.

Step 5: Post-Installation Configuration
After rebooting, CentOS Stream 9 will load, and you will be prompted to complete the initial setup. This includes configuring language settings, enabling additional repositories, and updating the system.
5.1. Perform System Updates
- Open a terminal window.
- Run the following command to ensure your system is fully updated:
sudo dnf update -y
5.2. Install Additional Software (Optional)
You can install additional software and tools as needed. For example, to install the vim text editor, use:
sudo dnf install vim
Conclusion
Congratulations! You now have a fully functional virtual lab with VirtualBox and CentOS Stream 9. This environment is your sandbox for learning Linux, testing configurations, and building foundational IT skills.
If you found this guide helpful, explore my other blogs for more tutorials and insights. Feel free to connect with me on LinkedIn or reach out via email. Let’s learn and grow together!
FAQ
What is the difference between CentOS Stream and CentOS?
CentOS Stream is a rolling-release version, offering a preview of the next Red Hat Enterprise Linux (RHEL) updates.
Can I use VirtualBox on a low-spec computer?
Yes, but ensure you have at least 4 GB of RAM and sufficient disk space for a smooth experience.
How much disk space does CentOS Stream 9 require?
A minimum of 20 GB is recommended, but more may be needed for additional software or files.
Do I need an internet connection for this setup?
Yes, especially for downloading updates and additional packages.
Is CentOS Stream 9 free to use?
Absolutely! CentOS Stream is free and open-source.
How do I access my CentOS VM from another machine?
Ensure your VM is configured with bridged networking and find the IP using ip a. You can then SSH into it from another machine.