Skip to main content
Hi — I’m Alan. This guide shows how to build a small local lab in VirtualBox for experimenting with configuration automation (Ansible). We’ll create a CentOS-based template VM, then clone it into a controller (management) machine and two target (managed) hosts. The demo was recorded on macOS, but the same steps apply on Windows and Linux with minor UI differences. What you’ll get
  • A reusable CentOS template VM in VirtualBox
  • A bridged network setup so the host can SSH to guests
  • A process for cloning the template into controller and managed hosts
Prerequisites
  • VirtualBox installed: https://www.virtualbox.org
  • CentOS Stream ISO for your architecture (x86_64 or ARM64)
  • Basic familiarity with SSH and VirtualBox UI
Download VirtualBox and the CentOS Stream ISO
  1. Install VirtualBox using the installer for your platform from VirtualBox.org.
  2. Go to the CentOS site and download the CentOS Stream ISO that matches your platform (for example, ARM64 for Apple Silicon).
A screenshot of the VirtualBox download page with a "Download VirtualBox" header, links to platform packages (Windows, macOS Intel/Apple Silicon, Linux, Solaris) on the left and the VirtualBox Extension Pack with an "Accept and download" button on the right.
Create the CentOS template VM
  • In VirtualBox click New and create a VM that matches the CentOS Stream ISO.
  • Give it a clear name such as centos-template. If VirtualBox fails to create a VM with that name, there may be a leftover folder in your VirtualBox VMs directory—delete it and retry.
  • Choose Linux as the OS type and a matching vendor/version (for CentOS Stream 10: Red Hat / Red Hat 10).
  • Increase CPU to 2 if desired, keep other defaults, and create a new virtual hard disk.
  • Before powering on, open Settings → Network and change Adapter 1 from NAT to Bridged Adapter. Bridged mode lets the guest get an IP on your LAN so your host can SSH to it directly.
  • Ensure VirtualBox is set to Expert Mode (Preferences → General view setting) so you have full cloning and advanced options.
A macOS desktop with Notification Center widgets on the left and a "New Virtual Machine" setup window on the right. The VM dialog is configured for a CentOS/Red Hat ARM64 ISO named "centos-template".
Boot the VM from the ISO and install CentOS
  • Start the VM and boot from the CentOS Stream ISO.
  • At the GRUB menu select the plain install option (or equivalent).
  • Proceed through the installer:
    • Choose language and keyboard layout.
    • Confirm Installation Destination (default disk is fine).
    • Set a root password and enable the root account if you want to SSH as root. Alternatively, create a regular user (for example, alan) and allow sudo access — recommended for security.
    • Complete installation and reboot into the installed system.
A computer desktop screenshot with macOS widgets (world clocks, battery/device status, and screen time) over an Earth/space wallpaper. On the right is a virtual machine window showing a CentOS installation summary.
Get the VM’s IP and verify SSH access
  • After first boot, open a terminal inside the guest and run ip a to find the bridged interface IP (ignore lo).
Example ip a output:
  • From your host (macOS Terminal, Windows PowerShell, or Linux shell) SSH into the guest:
  • Verify the connection (ls, whoami, or create a test file).
Shut down the guest from SSH
  • To power off from the SSH session:
Example interactive sudo output:
Clone the template into controller and managed hosts
  • After the template VM is powered off, create clones:
    • Right-click the template VM → Clone.
    • Use “Full clone” for convenience (this produces independent VMs).
    • Create at least three clones total: one for the controller (Ansible control node) and two or more managed hosts.
  • Boot each clone and set unique hostnames and static or DHCP-assigned IPs as needed.
  • Confirm each clone is reachable via SSH from the controller VM and from your host.
Quick commands and references Troubleshooting tips
  • If VirtualBox refuses to create a VM with a name, look for a leftover folder in your VirtualBox VMs directory and delete it before retrying.
  • If guests don’t get a bridged IP, verify your host network and adapter selection in VirtualBox. Some Wi-Fi adapters don’t support bridged networking reliably on all platforms—switch to NAT with port forwarding if needed.
If you hit an error creating a VM with a given name, check for leftover VM folders under your VirtualBox VMs directory and delete them before retrying. Also ensure VirtualBox is in Expert Mode for full cloning functionality.
Next steps (recommended)
  • Convert one clone into your Ansible controller:
    • Install Ansible on that VM (package manager or pip).
    • Add SSH keys to the managed hosts for passwordless access.
  • Practice basic playbooks and inventories against the managed hosts.
  • Snapshot the controller VM before major changes so you can roll back quickly.
Links and references That completes the short demo: create a CentOS template VM in VirtualBox, enable bridged networking for SSH access, and clone the template for an Ansible lab.

Watch Video