Establish the baseline virtualization sandbox running Ubuntu Server 22.04 LTS on VirtualBox to enable local development, SSH integrations, and file sharing.
Environment
VirtualBox / Local VM
Difficulty
Beginner
Course Module
Pre-requisites
Deliverables
VM Verification & SSH Proof
1. System Architecture & Workflow
This layout outlines how your physical Host computer interfaces with the virtual Linux Guest environment. All networking packets route through a NAT Adapter with port-forwarding mappings, and shared filesystem mounts bridge the OS storage scopes.
2. Part 1: Step-by-Step Action Items & Key Execution Steps
STEP 1
Install Host Software Packages
Prepare your host operating system environment with the primary local utilities required to download, configure, and connect to virtualized infrastructure.
Install the required software depending on your host operating system:
Option A: Windows Host (via native winget utility)
This command invokes the native Windows Package Manager (winget) to install VirtualBox, VS Code, Git, Postman, and 7-Zip directly on a fresh Windows system.
This command uses the macOS Homebrew package manager to download and configure the virtualization hypervisor, source editor, VCS client, API tool, and file archiving software.
Enable Nested Virtualization (VT-x/AMD-V): With the VM powered off, open your physical host terminal (PowerShell/Command Prompt on Windows, Terminal on macOS) and execute:
PS> VBoxManage modifyvm "devops-node" --nested-hw-virt on
This command enables nested hardware virtualization in VirtualBox for the VM, allowing the Ubuntu Guest OS to run its own virtual containers (like Docker and Kubernetes) inside the guest kernel.
Start the VM and follow the installer. Select default options, check Install OpenSSH Server, and complete installation. Reboot the VM.
STEP 3
Configure System Identity, Hostname, and Timezone
Log in directly inside the VirtualBox VM console and execute the configuration steps to set identity attributes.
$ sudo hostnamectl set-hostname devops-node
This command modifies the static system hostname inside the Linux system files, aligning the operating system identifier with the expected node classification in later configurations.
$ sudo timedatectl set-timezone UTC
This command updates the system timezone file links to point to Coordinated Universal Time, establishing a standard chronological reference frame across all servers, logging nodes, and databases.
$ sudo usermod -aG sudo $USER
This command appends the current user account record to the system administration sudo group, granting administrative credentials to execute commands requiring root permissions.
This command retrieves updated software index files and installs compilation tooling and system headers corresponding to the running kernel version to permit the building of Guest Additions modules.
1. In the VirtualBox window menu, select Devices -> Insert Guest Additions CD Image.
$ sudo mount /dev/cdrom /media && sudo /media/VBoxLinuxAdditions.run
This command mounts the virtual Guest Additions ISO file to the local media directory and runs the installer script to build and link kernel drivers for guest-host resource sharing.
2. Shut down the VM. In VirtualBox VM settings, select Shared Folders. Click Add Shared Folder:
Folder Path: Select a folder on your host machine (e.g., C:\devops_share)
Folder Name: Keep as devops_share
Check Auto-mount and Make Permanent. Leave Mount point blank. Restart VM.
$ sudo usermod -aG vboxsf $USER
This command registers the current user account with the virtual folder vboxsf group, granting the user permission to read and write files within the shared host directory without requiring root credentials.
STEP 5
Validate Network Interfaces, Package Management, and SSH Connectivity
Test the host-to-guest ssh mapping and check access to the network.
$ ssh -p 2222 devops@127.0.0.1
This command, executed on your physical host terminal, initiates an SSH protocol session targeting the localhost IP address on mapped port 2222, validating the port forwarding rule bridging host and guest.
$ sudo apt update && sudo apt upgrade -y
This command fetches current package database files from remote software mirrors and installs security revisions and system patches, ensuring the environment is up to date.
3. Operational Pipeline Architecture
The system validation pipeline automates checking your VM configuration. The script inspects the running host interfaces, processes, filesystems, and writes a unified JSON validation report back to the shared folder.
4. Part 2: Complete Deliverable Assets & Production Templates
To automate the verification of the guest workstation nodes, we will design a validation script. Follow the steps below to understand how the components are built up, and then combine them into a single executable script.
Step-by-Step Script Construction
Step 1
Define Shebang and Shell Script Safety Flags
Every script must declare its interpreter and configure immediate exit flags on errors to prevent syntax bugs from cascading silently.
#!/usr/bin/env bash
set -euo pipefail
This declaration registers the bash shell environment as the execution driver, while -e exits immediately on any command errors, -u flags unset variable calls as bugs, and -o pipefail propagates pipeline exit codes.
Step 2
Declare Directory variables
Setup paths where files will be scanned and reports generated.
This code block reads the hostname value and checks group privileges, assigning PASS/FAIL status based on whether 'sudo' (admin privileges) and 'vboxsf' (shared folder permissions) are detected.
Step 4
Check Network Resolution and Folder Mounts
Audit internet gateways and confirm the presence of guest addition shared mounts.
This code queries google.com with a connection timeout to verify internet connectivity, and uses mountpoint to check if the shared directory is mounted.
Step 5
Output Audit Results as JSON Reports
Write results in structured JSON format back to the shared folder path.
This constructs a JSON file using HEREDOC input syntax, writing timestamps, hostname parameters, and status checks to the shared folder report file.
Combined Automated Script
Save the consolidated blocks above as /home/devops/validate_workstation.sh inside the VM, make it executable with chmod +x validate_workstation.sh, and run it: