Your First OEL 8 VM with VirtualBox
This page walks through creating your first Oracle Enterprise Linux 8 VM using Vagrant and VirtualBox — from creating the project directory to SSHing into the running VM.
Step 1 — Create Project Directory
BASH — Create Project
# Create project directory
mkdir -p ~/vagrant-labs/oel8-first
cd ~/vagrant-labs/oel8-first
# Initialize Vagrantfile with OEL 8 box
vagrant init generic/oracle8
# This creates a Vagrantfile in the current directory
ls -la
Step 2 — Edit Vagrantfile
Ruby — Vagrantfile
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# OEL 8 box
config.vm.box = "generic/oracle8"
config.vm.hostname = "oel8-lab"
# Private network — access VM at this IP from host
config.vm.network "private_network", ip: "192.168.56.10"
# Forward MySQL port (optional)
config.vm.network "forwarded_port", guest: 3306, host: 13306
# VirtualBox settings
config.vm.provider "virtualbox" do |vb|
vb.name = "OEL8-First"
vb.memory = 2048
vb.cpus = 2
vb.gui = false
end
# Basic provisioning
config.vm.provision "shell", inline: <<-SHELL
echo "=== Updating OEL 8 ==="
dnf update -y --quiet
dnf install -y vim wget curl net-tools
echo "=== Done ==="
SHELL
end
Step 3 — Start the VM
BASH — Start VM
# Start VM (downloads box if not present — first time takes a few minutes)
vagrant up
# Start with explicit provider
vagrant up --provider=virtualbox
# Watch the output:
# ==> default: Importing base box 'generic/oracle8'...
# ==> default: Setting the name of the VM: OEL8-First
# ==> default: Configuring network adapters within the VM...
# ==> default: Running provisioner: shell...
Step 4 — SSH into the VM
BASH — SSH into VM
# Connect to the VM
vagrant ssh
# You are now inside OEL 8!
# Check OS version
cat /etc/oracle-release
# Check hostname
hostname
# Check IP
ip addr show
# Check available memory
free -h
# Check disk
df -h
# Exit VM
exit
Step 5 — Verify Everything
BASH — Verify
# From host machine — check VM status
vagrant status
# Check forwarded ports
vagrant port
# Test private network connectivity
ping 192.168.56.10
# Test MySQL port forwarding (after MySQL installed)
# mysql -u root -h 127.0.0.1 -P 13306
Step 6 — Stop and Manage
BASH — Stop and Manage
# Gracefully stop VM
vagrant halt
# Check status
vagrant status
# Output: default poweroff (virtualbox)
# Start again
vagrant up
# Restart
vagrant reload
# Destroy VM completely
vagrant destroy
VM Quick Info
BASH — Inside VM Info
# Inside VM — useful info commands
cat /etc/oracle-release # OS version
uname -r # Kernel version
hostnamectl # Hostname and OS details
ip addr show eth1 # Private network IP
df -h # Disk usage
free -h # Memory
nproc # CPU count
systemctl list-units --state=running # Running services
💡 Note: The first vagrant up downloads the box (~1GB). Subsequent vagrant up commands are much faster as the box is cached in ~/.vagrant.d/boxes/