This project demonstrates a multi-VM environment using Vagrant.
It provisions:
web01(Ubuntu) - Web Serverdb01(CentOS) - Database Server
Both VMs are configured with private networks and provisioned automatically.
- Prerequisites 🔑
- Architecture 🏗️
- Setup & Installation ⚙️
- Vagrant Configuration 📜
- Cleaning Up Resources 🧹
- Conclusion ✅
Before you start, ensure you have the following installed:
- Vagrant (latest version)
- VirtualBox or any other supported provider
This project sets up a multi-VM environment:
| VM Name | OS | IP Address | Purpose |
|---|---|---|---|
| web01 | Ubuntu | 192.168.56.41 | Web Server |
| db01 | CentOS 9 | 192.168.56.44 | Database Server |
vagrant initBelow is the Vagrantfile configuration used for this project:
Vagrant.configure("2") do |config|
config.vm.define "web01" do |web01|
web01.vm.box = "ubuntu/jammy64"
web01.vm.hostname = "web01"
web01.vm.network "private_network", ip: "192.168.56.41"
web01.ssh.insert_key = false
web01.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
end
config.vm.define "db01" do |db01|
db01.vm.box = "eurolinux-vagrant/centos-stream-9"
db01.vm.hostname = "db01"
db01.vm.network "private_network", ip: "192.168.56.44"
db01.ssh.insert_key = false
db01.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
db01.vm.provision "shell", inline: <<-SHELL
yum install -y wget unzip mariadb-server -y
systemctl start mariadb
systemctl enable mariadb
SHELL
end
endvagrant upvagrant statusvagrant ssh web01vagrant ssh db01ip addr show
systemctl status mariadb # (on db01 to check MariaDB status)exitTo remove the VM and free up system resources, run the following commands in order:
vagrant destroyvagrant global-status --pruneThis project automates a multi-VM setup with Ubuntu (Web Server) and CentOS (Database Server). It provides a quick and reproducible environment for testing and development.
This project was guided by Imran Teli, who provided valuable mentorship throughout the process.