https://github.com/iambotcoder/vagrant-automation-centos
This project automates Virtual Machine (VM) provisioning using Vagrant with CentOS Stream 9.
https://github.com/iambotcoder/vagrant-automation-centos
Last synced: 5 months ago
JSON representation
This project automates Virtual Machine (VM) provisioning using Vagrant with CentOS Stream 9.
- Host: GitHub
- URL: https://github.com/iambotcoder/vagrant-automation-centos
- Owner: iambotcoder
- Created: 2025-02-08T08:48:07.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2025-02-08T08:56:59.000Z (about 1 year ago)
- Last Synced: 2025-02-16T18:48:52.041Z (about 1 year ago)
- Size: 5.86 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ๐ฅ๏ธ Vagrant Automation - CentOS Stream 9
---
## ๐ Overview
This project automates Virtual Machine (VM) provisioning using Vagrant with CentOS Stream 9. It simplifies the process of setting up a virtualized development environment with predefined configurations.
---
## ๐ Table of Contents
- [Prerequisites](#prerequisites) ๐
- [Architecture](#architecture) ๐๏ธ
- [Setup & Installation](#setup--installation) ๐ ๏ธ
- [Vagrant Setup](#vagrant-setup) ๐พ
- [Cleaning Up Resources](#cleaning-up-resources) ๐งน
- [Conclusion](#conclusion) โ
---
## ๐ Prerequisites
Before you start, ensure you have the following installed:
- [Vagrant](https://www.vagrantup.com/downloads)
- [VirtualBox](https://www.virtualbox.org/wiki/Downloads)
- Basic understanding of Linux and virtualization
---
## ๐๏ธ Architecture
This project uses Vagrant to automate VM provisioning with the following configurations:
- **OS**: CentOS Stream 9
- **Networking**: Private network with IP `192.168.56.14`
- **Resources**: 1600MB RAM, 2 CPU cores
- **SSH Configuration**: Custom SSH key setup
- **Provisioning (optional)**: Install and configure Apache web server
---
## ๐ ๏ธ Setup & Installation
### 1โฃ Initialize Vagrant:
```bash
vagrant init eurolinux-vagrant/centos-stream-9
```
## ๐พ Vagrant Setup ๐ฅ๏ธ
Below is the `Vagrantfile` configuration used:
```ruby
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure("2") do |config|
# Use the CentOS Stream 9 box
config.vm.box = "eurolinux-vagrant/centos-stream-9"
# Private network for host-only access (you can modify the IP)
config.vm.network "private_network", ip: "192.168.56.14"
# Synced folder from host to guest
# config.vm.synced_folder "D:\\scripts\\shellscripts", "/opt/scripts", type: "virtualbox"
# VirtualBox provider-specific configurations
config.vm.provider "virtualbox" do |vb|
# Allocate memory and CPUs
vb.memory = "1600"
vb.cpus = 2
vb.gui = false # Run the VM in headless mode (without GUI)
end
# Disable the default insecure SSH key and use newly generated keys
config.ssh.insert_key = false
# Ensure SSH keys are properly configured
config.ssh.private_key_path = "~/.vagrant.d/insecure_private_key"
# Provision the VM with necessary updates and package installations
#config.vm.provision "shell", inline: <<-SHELL
# Update and install necessary packages
# You can comment below commands to just have a simple Centos standard VM
sudo dnf -y update
sudo dnf -y install httpd
sudo systemctl enable httpd
sudo systemctl start httpd
#SHELL
end
```
### 2โฃ Start the Virtual Machine:
```bash
vagrant up
```
### 3โฃ Check VM Status:
```bash
vagrant status
```
### 4โฃ SSH into the VM:
```bash
vagrant ssh
```
### 5โฃ Check Network Configuration:
```bash
ip addr show
```
### 6โฃ Exit the VM:
```bash
exit
```
### ๐งน Cleaning Up Resources
To remove the VM and free up system resources, run the following commands in order:
### 1โฃ Destroy the Virtual Machine:
```bash
vagrant destroy
```
### 2โฃ Remove Unused Vagrant Instances:
```bash
vagrant global-status --prune
```
---
## โ
Conclusion
This project demonstrates how to automate VM provisioning using Vagrant and VirtualBox, making it easier to manage development and testing environments efficiently.
---
## ๐จโ๐ซ Instructor
This project was guided by Imran Teli, who provided valuable mentorship throughout the process.