Vagrant OEL 8 DevOps · VirtualBox · OEL 8

VagrantFirst OEL 8 VM with VirtualBox

Create your first Oracle Enterprise Linux 8 VM with Vagrant and VirtualBox. From project setup to SSH access, networking and basic VM management.

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.

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
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
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...
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
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
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
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/