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

Arch Linux

Oracle Linux

RHEL (Red Hat Enterprise Linux)

Debian

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)

Memory (RAM)

Hard Disk

Processors

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)

  1. Access Port Forwarding Settings:

    • Select your VM
    • Go to Settings > Network > Adapter 1
    • Ensure "Attached to" is set to NAT
    • Click "Advanced" > "Port Forwarding"
  2. 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
  1. 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)
  2. 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

  1. Boot from ISO
  2. Select "Install Rocky/Oracle/Red Hat Enterprise Linux"
  3. Configure:
    • Language and keyboard
    • Installation destination (select your virtual disk)
    • Network & hostname (enable network adapter)
    • Root password and/or create user
  4. Begin installation
  5. Reboot after completion

Post-install: Update system

sudo dnf update -y

Arch Linux

  1. Boot from ISO (you'll be at a command prompt)
  2. 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

  1. Boot from ISO
  2. Select "Graphical Install" or "Install"
  3. 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)
  4. Install GRUB bootloader
  5. 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