Skip to main content

🧰 How to Set Up Oracle Linux 8 Using Vagrant and VirtualBox in 2025


Even in the era of Docker and Kubernetes, Vagrant continues to be a simple and effective way to spin up full-featured VMs. If you're setting up an Oracle environment, Vagrant is still a go-to tool for building consistent, disposable, and scriptable development machines.

In this comprehensive tutorial, you'll learn how to build an Oracle Linux 8 VM using Vagrant with VirtualBox as the provider — with steps to configure memory, attach a custom disk, and bring the VM online.

💡 Pro Tip: This setup is perfect for Oracle Database installations, testing environments, and development sandboxes!

📋 Prerequisites

Before we dive in, make sure you have:

  • VirtualBox installed on your system
  • Vagrant installed and configured
  • ✅ At least 10GB of free disk space
  • 8GB RAM available for the VM

📁 Step 1: Create Your Vagrant Working Directory and Add the Oracle Linux Box

First, let's create a dedicated folder for your Oracle Linux project:

mkdir C:\vagrant-oraclelinux
cd C:\vagrant-oraclelinux

Now, add the generic Oracle Linux 8 base box using:

vagrant box add generic/oracle8

During the prompt, you'll be asked to choose the provider. Select VirtualBox (option 6) as shown below:

==> box: Loading metadata for box 'generic/oracle8'
    box: URL: https://vagrantcloud.com/api/v2/vagrant/generic/oracle8
This box can work with multiple providers! The providers that it
can work with are listed below. Please review the list and choose
the provider you will be working with.

1) docker
2) hyperv
3) libvirt
4) parallels
5) qemu
6) virtualbox
7) vmware_desktop

Enter your choice: 6

After successful download, you'll see:

==> box: Successfully added box 'generic/oracle8' (v4.3.12) for 'virtualbox (amd64)'!

🎯 Quick Tip: The download might take a few minutes depending on your internet speed. Grab a coffee! ☕

✍️ Step 2: Create and Edit the Vagrantfile

Open the Vagrantfile in your favorite text editor:

notepad Vagrantfile

Paste the following configuration:

Vagrant.configure("2") do |config|
  config.vm.box = "generic/oracle8"
  config.vm.hostname = "oracle19c"
  
  config.vm.provider "virtualbox" do |vb|
    vb.memory = 8192
    vb.cpus = 2
    vb.customize [
      "storageattach", :id,
      "--storagectl", "SATA Controller",
      "--port", 1,
      "--device", 0,
      "--type", "hdd",
      "--medium", "C:/vagrant-oraclelinux/u01.vdi"
    ]
  end
end

📝 Configuration Breakdown:

Parameter Value Description
Box Name "generic/oracle8" Oracle Linux 8 base image
Hostname oracle19c Sets guest machine name
Memory 8192 MB Allocates 8 GB RAM
CPUs 2 Assigns 2 CPU cores
Custom Disk u01.vdi Additional 50GB storage

⚠️ Important: Adjust memory and CPU values based on your host machine's capabilities!

💾 Step 3: Create a Virtual Disk for Oracle Data

Use VBoxManage.exe to create a 50GB virtual hard disk for Oracle data:

& "C:\Program Files\Oracle\VirtualBox\VBoxManage.exe" createmedium disk --filename "C:\vagrant-oraclelinux\u01.vdi" --size 51200

This dedicated disk will be used for:

  • 🗄️ Oracle installation files
  • 💾 Database storage
  • 📊 Tablespaces and data files

💡 Storage Tip: You can adjust the size by changing 51200 (50GB) to your preferred size in MB.

🚀 Step 4: Start the Virtual Machine

Now let's power up the VM:

vagrant up

Vagrant will automatically:

  1. 🔧 Initialize the VM
  2. 💽 Attach the custom disk
  3. 🖥️ Boot Oracle Linux 8
  4. ⚙️ Configure networking

The process typically takes 2-5 minutes. You'll see output similar to:

Bringing machine 'default' up with 'virtualbox' provider...
==> default: Checking if box 'generic/oracle8' is up to date...
==> default: Clearing any previously set network interfaces...
==> default: Preparing network interfaces based on configuration...

🔐 Step 5: Connect to the VM via SSH

Once the VM is up and running, connect to it:

vagrant ssh

🎉 Success! You're now inside the Oracle Linux 8 virtual machine, ready to install Oracle software or run any manual configuration.

Quick System Check:

# Check OS version
cat /etc/os-release

# Check available disk space
df -h

# List attached disks
lsblk

🛠️ Step 6: VM Lifecycle Management

To stop the VM:

vagrant halt

To restart it:

vagrant up

To reconnect:

vagrant ssh

To destroy the VM (when no longer needed):

vagrant destroy

🔄 Lifecycle Tip: Use vagrant status to check the current state of your VM.

🤔 What's Next?

Now that your Oracle Linux 8 VM is ready, you can:

  1. Install Oracle Database 19c or 21c
  2. Set up Oracle APEX for web application development
  3. Configure Oracle Grid Infrastructure for RAC testing
  4. Install Oracle Enterprise Manager for database management
  5. Create multiple VMs for cluster configurations

Did you find this tutorial helpful? Share it with your fellow Oracle DBAs and developers! 🚀

Tags: #OracleLinux #Vagrant #VirtualBox #DatabaseDevelopment #DevOps #Oracle #Virtualization #Linux


Comments

Popular posts from this blog

🚀 Automating Oracle Database Patching with Ansible: A Complete Guide

Oracle database patching has long been the bane of DBAs everywhere. It's a critical task that requires precision, expertise, and often results in extended maintenance windows. What if I told you that you could automate this entire process, reducing both risk and downtime while ensuring consistency across your Oracle estate? 💡 In this comprehensive guide, I'll walk you through a production-ready Ansible playbook that completely automates Oracle patch application using OPatch. Whether you're managing a single Oracle instance or hundreds of databases across your enterprise, this solution will transform your patch management strategy! 🎯 🔥 The Challenge: Why Oracle Patching is Complex Before diving into the solution, let's understand why Oracle patching is so challenging: 🔗 Multiple dependencies : OPatch versions, Oracle Home configurations, running processes ⚠️ Risk of corruption : Incorrect patch application can render databases unusable ⏰ Downtime requirements : Da...

Oracle RAC Switchover & Switchback: Step-by-Step Guide

 Ensuring business continuity requires regular Disaster Recovery (DR) drills. This guide covers the Switchover and Switchback process between Primary (DC) and Standby (DR) databases . Pre-checks Before Performing Switchover Before starting the activity, ensure there are no active sessions in the database. If any are found, share the session details with the application team, get their confirmation, and terminate the sessions. Primary Database Name: PRIMARY Standby Database Name: STANDBY  Identify Active Sessions set lines 999 pages 999 col machine for a30 col username for a30 col program for a30 compute sum of count on report break on report select inst_id,username,osuser,machine,program,status,count(1) "count" from gv$session where inst_id=1 and program like 'JDBC%' group by inst_id,username,osuser,machine,program,status order by 1,2; select inst_id,username,osuser,machine,program,status,count(1) "count" from gv$session where inst_id=2 and program lik...

Mastering Oracle RAC with SRVCTL Commands

Oracle Real Application Clusters (RAC) provide high availability, scalability, and manageability for databases. One of the most powerful tools for managing RAC databases is srvctl , a command-line utility that allows administrators to control various database services. This blog explores essential srvctl commands to help you efficiently manage Oracle RAC environments. 1. Checking Database Configuration and Status  List all available databases on the host:                  srvctl config database   Check the status of a specific database and its instances:                    srvctl status database -d <database_name>   Retrieve detailed status information about a database, including its instances and states:                    srvctl status database -d <database_name> -v 2. Stopping and Starting Databases   ...