This is a demo of a specific experience.
VirtualBox Linux Distribution Provisioning Guide
This guide covers setting up Rocky Linux, Arch Linux, Oracle Linux, RHEL, and Debian in VirtualBox.
ISO Sources
Rocky Linux
- Website: https://rockylinux.org/download
- Direct Download: https://download.rockylinux.org/pub/rocky/
- Recommended: Rocky Linux 9.x (latest stable)
Arch Linux
- Website: https://archlinux.org/download/
- Direct Download: https://geo.mirror.pkgbuild.com/iso/latest/
- Note: Rolling release, always download the latest ISO
Oracle Linux
- Website: https://www.oracle.com/linux/downloads/
- Direct Download: https://yum.oracle.com/oracle-linux-isos.html
- Recommended: Oracle Linux 9.x
RHEL (Red Hat Enterprise Linux)
- Website: https://developers.redhat.com/products/rhel/download
- Note: Requires free Red Hat Developer account
- Recommended: RHEL 9.x
Debian
- Website: https://www.debian.org/distrib/
- Direct Download: https://www.debian.org/CD/http-ftp/
- Recommended: Debian 12 (Bookworm) netinst
Basic VM Creation
1. Create New Virtual Machine
1. Open VirtualBox and click "New"
2. Name your VM (e.g., "Rocky-Linux-9")
3. Select Type: Linux
4. Select Version based on distribution:
- Rocky/Oracle/RHEL: Red Hat (64-bit)
- Arch: Arch Linux (64-bit)
- Debian: Debian (64-bit)
2. Recommended Settings
Memory (RAM)
- Minimal: 2048 MB (2 GB)
- Recommended: 4096 MB (4 GB)
- Server workloads: 8192 MB (8 GB)
Hard Disk
- Create a virtual hard disk now
- Type: VDI (VirtualBox Disk Image)
- Storage: Dynamically allocated
- Size:
- Minimal: 20 GB
- Recommended: 40-50 GB
- Development: 80+ GB
Processors
- Minimal: 1 CPU
- Recommended: 2-4 CPUs
3. Additional Configuration
Before starting the VM:
1. Go to Settings > System
- Enable EFI (optional, for UEFI boot)
- Adjust boot order (Optical, then Hard Disk)
2. Go to Settings > Storage
- Click on "Empty" under Controller: IDE
- Click the disk icon and select your ISO file
3. Go to Settings > Network
- Adapter 1: Enable Network Adapter
- Attached to: NAT (default)
Port Forwarding Setup
Configuring Port Forwarding (NAT Network)
-
Access Port Forwarding Settings:
- Select your VM
- Go to Settings > Network > Adapter 1
- Ensure "Attached to" is set to NAT
- Click "Advanced" > "Port Forwarding"
-
Common Port Forwarding Rules:
| Name | Protocol | Host IP | Host Port | Guest IP | Guest Port |
|---|---|---|---|---|---|
| SSH | TCP | 127.0.0.1 | 2222 | 10.0.2.15 | 22 |
| HTTP | TCP | 127.0.0.1 | 8080 | 10.0.2.15 | 80 |
| HTTPS | TCP | 127.0.0.1 | 8443 | 10.0.2.15 | 443 |
| Custom | TCP | 127.0.0.1 | 3000 | 10.0.2.15 | 3000 |
-
Add a Port Forwarding Rule:
- Click the "+" icon
- Fill in the details:
- Name: Descriptive name (e.g., "SSH")
- Protocol: TCP or UDP
- Host IP: Leave blank or use 127.0.0.1
- Host Port: Port on your host machine (e.g., 2222)
- Guest IP: Leave blank (auto-detects)
- Guest Port: Port inside the VM (e.g., 22)
-
Connect via SSH Example:
ssh -p 2222 username@localhost
Alternative: Bridged Network
For direct network access without port forwarding:
Settings > Network > Adapter 1
Attached to: Bridged Adapter
Name: Select your physical network adapter
The VM will receive an IP from your local network's DHCP server.
Distribution-Specific Installation Notes
Rocky Linux / Oracle Linux / RHEL
- Boot from ISO
- Select "Install Rocky/Oracle/Red Hat Enterprise Linux"
- Configure:
- Language and keyboard
- Installation destination (select your virtual disk)
- Network & hostname (enable network adapter)
- Root password and/or create user
- Begin installation
- Reboot after completion
Post-install: Update system
sudo dnf update -y
Arch Linux
- Boot from ISO (you'll be at a command prompt)
- Basic installation steps:
# Verify boot mode
ls /sys/firmware/efi/efivars
# Connect to network (should work automatically in VirtualBox)
ping archlinux.org
# Update system clock
timedatectl set-ntp true
# Partition disk (example for simple setup)
fdisk /dev/sda
# Create partitions as needed
# Format partitions
mkfs.ext4 /dev/sda1
# Mount partitions
mount /dev/sda1 /mnt
# Install base system
pacstrap /mnt base linux linux-firmware
# Generate fstab
genfstab -U /mnt >> /mnt/etc/fstab
# Chroot
arch-chroot /mnt
# Install bootloader and other essentials
pacman -S grub
grub-install /dev/sda
grub-mkconfig -o /boot/grub/grub.cfg
Note: Arch installation is more complex. Consider using archinstall script:
archinstall
Debian
- Boot from ISO
- Select "Graphical Install" or "Install"
- Configure:
- Language, location, and keyboard
- Hostname and domain
- Root password and create user account
- Partitioning (use entire disk - guided)
- Package manager mirror (select closest)
- Software selection (uncheck desktop for server, or select preferred DE)
- Install GRUB bootloader
- Reboot
Post-install: Update system
sudo apt update && sudo apt upgrade -y
Post-Installation: Install VirtualBox Guest Additions
Guest Additions provide better integration (shared clipboard, folders, resolution).
For Rocky/Oracle/RHEL:
sudo dnf install gcc make perl kernel-devel kernel-headers bzip2 -y
sudo dnf update kernel -y
# Reboot, then mount Guest Additions ISO from Devices menu
sudo mkdir /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom
sudo /mnt/cdrom/VBoxLinuxAdditions.run
sudo reboot
For Arch:
sudo pacman -S virtualbox-guest-utils
sudo systemctl enable vboxservice
sudo reboot
For Debian:
sudo apt install build-essential dkms linux-headers-$(uname -r)
# Mount Guest Additions ISO from Devices menu
sudo mkdir /mnt/cdrom
sudo mount /dev/cdrom /mnt/cdrom
sudo /mnt/cdrom/VBoxLinuxAdditions.run
sudo reboot
Quick Reference Commands
Check Network Configuration
ip addr show
ip route show
Enable SSH (if not running)
# Rocky/Oracle/RHEL
sudo systemctl enable --now sshd
# Arch
sudo pacman -S openssh
sudo systemctl enable --now sshd
# Debian
sudo apt install openssh-server
sudo systemctl enable --now ssh
Test Port Forwarding
From your host machine:
# Test SSH
ssh -p 2222 username@localhost
# Test HTTP
curl http://localhost:8080
Troubleshooting
- VM won't boot: Check ISO is properly mounted in Settings > Storage
- No network: Ensure network adapter is enabled in Settings > Network
- Can't SSH: Verify SSH is running in guest and port forwarding is configured
- Slow performance: Increase RAM/CPU allocation, install Guest Additions
- Display issues: Install Guest Additions for proper graphics support