Vagrant — Complete Cheat Sheet (All 38 Pages)
The ultimate quick reference for Vagrant with OEL 8 on VirtualBox and Parallels. Every important command, config snippet, and pattern from the full series in one page.
VM Lifecycle
BASH — VM Lifecycle
vagrant up # Start / create VM
vagrant up --provider=virtualbox # Explicit VirtualBox
vagrant up --provider=parallels # Explicit Parallels
vagrant up --no-parallel # Sequential start
vagrant halt # Stop gracefully
vagrant halt --force # Force stop
vagrant reload # Restart
vagrant reload --provision # Restart + re-provision
vagrant destroy --force # Delete completely
vagrant status # Current project VMs
vagrant global-status --prune # ALL VMs on machine
vagrant ssh # SSH in
vagrant ssh machinename # SSH into named VM
vagrant ssh -c "sudo systemctl status mysqld" # Run command
vagrant provision # Re-run provisioners
vagrant port # Show forwarded ports
Box Commands
BASH — Box Commands
vagrant box list # List downloaded boxes
vagrant box add generic/oracle8 # Add from Vagrant Cloud
vagrant box add mybox file.box # Add local box (VirtualBox)
vagrant box add metadata.json # Add via metadata (Parallels!)
vagrant box remove mybox # Remove box
vagrant box update # Update all boxes
vagrant box prune # Remove old versions
Snapshots
BASH — Snapshots
vagrant snapshot save NAME # Save named snapshot
vagrant snapshot save VM NAME # Specific machine snapshot
vagrant snapshot restore NAME # Restore snapshot
vagrant snapshot list # List snapshots
vagrant snapshot delete NAME # Delete snapshot
vagrant snapshot push # Push to stack (unnamed)
vagrant snapshot pop # Restore + delete last
Essential Plugins
BASH — Plugins
vagrant plugin install vagrant-parallels # Parallels provider
vagrant plugin install vagrant-disksize # Disk resize
vagrant plugin install vagrant-vbguest # VirtualBox Guest Additions
vagrant plugin install vagrant-hostmanager # Auto /etc/hosts
vagrant plugin install vagrant-reload # Reboot mid-provision
vagrant plugin install vagrant-env # Load .env file
vagrant plugin install vagrant-proxyconf # Corporate proxy support
vagrant plugin list # List installed
vagrant plugin update # Update all
Vagrantfile Quick Reference
Ruby — Full Vagrantfile Reference
Vagrant.configure("2") do |config|
# Box
config.vm.box = "generic/oracle8"
config.vm.hostname = "oel8-lab"
# Networks
config.vm.network "private_network", ip: "192.168.56.10"
config.vm.network "forwarded_port", guest: 3306, host: 13306
config.vm.network "forwarded_port", guest: 1521, host: 11521
config.vm.network "forwarded_port", guest: 6033, host: 16033
# Synced folder
config.vm.synced_folder "./sql", "/home/vagrant/sql"
config.vm.synced_folder "./scripts", "/home/vagrant/scripts"
# Disk resize (vagrant-disksize plugin)
config.disksize.size = "50GB"
# VirtualBox provider
config.vm.provider "virtualbox" do |vb|
vb.name = "OEL8-Lab"
vb.memory = 4096
vb.cpus = 2
vb.customize ["modifyvm", :id, "--ioapic", "on"]
vb.customize ["modifyvm", :id, "--natdnshostresolver1", "on"]
end
# Parallels provider
config.vm.provider "parallels" do |prl|
prl.name = "OEL8-Lab"
prl.memory = 4096
prl.cpus = 2
prl.update_guest_tools = false
prl.optimize_power_consumption = false
prl.linked_clone = true
end
# Shell provisioner
config.vm.provision "shell", inline: "dnf install -y vim wget"
config.vm.provision "shell", path: "scripts/setup.sh"
config.vm.provision "shell", run: "always", inline: "echo VM ready"
# With env vars
config.vm.provision "shell",
path: "scripts/install_mysql.sh",
env: { "ROOT_PASS" => ENV["DB_ROOT_PASS"] || "Root@123!" }
end
Correct Parallels Box Packaging
BASH — Parallels Box Packaging
# NEVER do this for Parallels:
vagrant box add myname file.box # FAILS for Parallels!
# CORRECT method:
# 1. Create metadata.json inside box
echo '{"provider":"parallels"}' > metadata.json
# 2. Create Vagrantfile inside box
echo 'Vagrant.configure("2") do |c|; end' > Vagrantfile
# 3. Package: metadata.json + Vagrantfile + .pvm folder
tar -czf myoel8.box metadata.json Vagrantfile MyVM.pvm/
# 4. Create box-metadata.json (for vagrant box add)
cat > box-meta.json << EOF
{
"name": "oraclelinux8-parallels",
"versions": [{
"version": "1.0.0",
"providers": [{
"name": "parallels",
"url": "file:///absolute/path/to/myoel8.box"
}]
}]
}
EOF
# 5. Add box
vagrant box add box-meta.json
vagrant box list # Shows: oraclelinux8-parallels (parallels, 1.0.0)
Database Lab Quick Reference
| Lab | IPs | Key Port | Page |
|---|---|---|---|
| MySQL 8 Single | 192.168.56.20 | 13306 | 21 |
| MySQL Replication | .11 master, .12-.13 replicas | 13306-13308 | 22 |
| ProxySQL Full Stack | .10 proxy, .11-.13 mysql | 16033, 13306+ | 23 |
| Oracle 19c | 192.168.56.30 | 11521 | 26 |
| Oracle RAC | .41-.42 nodes, .70 SCAN | 11521 | 27 |
| PostgreSQL 15 | 192.168.56.40 | 15432 | 28 |
| MySQL Group Replication | .51-.53 nodes | 13311-13313 | 29 |
| Galera/PXC | .61-.63 nodes | 13361-13363 | 30 |
| InnoDB Cluster | .71-.73 nodes | 13371-13373 | 31 |
| MongoDB 7 | 192.168.56.80 | 127017 | 32 |
Complete Page Index
| # | Page Title | Section |
|---|---|---|
| 1 | Introduction & Architecture | Basics |
| 2 | Installation — VirtualBox | Basics |
| 3 | Installation — Parallels | Basics |
| 4 | CLI Commands Reference | Basics |
| 5 | Vagrantfile Deep Dive | Basics |
| 6 | OEL 8 Box Setup | Basics |
| 7 | First VM — VirtualBox | VirtualBox |
| 8 | Networking | VirtualBox |
| 9 | Synced Folders | VirtualBox |
| 10 | Multi-Machine Setup | VirtualBox |
| 11 | Shell Provisioning | VirtualBox |
| 12 | Ansible Provisioning | VirtualBox |
| 13 | Snapshots & Rollback | VirtualBox |
| 14 | Resource Tuning | VirtualBox |
| 15 | First VM — Parallels | Parallels |
| 16 | Correct Parallels Box Packaging ⭐ | Parallels |
| 17 | Parallels Networking | Parallels |
| 18 | Parallels Multi-Machine | Parallels |
| 19 | Parallels Synced Folders | Parallels |
| 20 | Parallels Snapshots | Parallels |
| 21 | MySQL 8 on OEL 8 | Database Labs |
| 22 | MySQL Replication Lab | Database Labs |
| 23 | ProxySQL Full Stack Lab | Database Labs |
| 24 | Troubleshooting | Database Labs |
| 25 | Cheat Sheet (Basic) | Database Labs |
| 26 | Oracle 19c on OEL 8 | Advanced Labs |
| 27 | Oracle RAC Lab | Advanced Labs |
| 28 | PostgreSQL 15 on OEL 8 | Advanced Labs |
| 29 | MySQL Group Replication Lab | Advanced Labs |
| 30 | Galera Cluster (PXC) Lab | Advanced Labs |
| 31 | MySQL InnoDB Cluster Lab | Advanced Labs |
| 32 | MongoDB 7 on OEL 8 | Advanced Labs |
| 33 | Essential Plugins | Advanced |
| 34 | Custom Box Creation | Advanced |
| 35 | Vagrant Cloud Publishing | Advanced |
| 36 | Environment Variables & Secrets | Advanced |
| 37 | Behind Proxy & Firewall | Advanced |
| 38 | Complete Cheat Sheet | Advanced |