Skip to content

somaz94/vagant-packer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

📦 Vagrant & Packer Collection

This repository provides a collection of setup and configuration scripts for Vagrant and Packer.


🌀 Enable Nested Virtualization IN KVM In Linux


🛠 Vagrant Installation


CentOS/RHEL:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install vagrant
sudo yum -y install qemu libvirt libvirt-devel ruby-devel gcc qemu-kvm libguestfs-tools
vagrant plugin install vagrant libvirt
vagrant plugin install vagrant-mutate
vagrant plugin install vagrant-parallels

Ubuntu/Debian:

# Ubuntu/Debian
wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install vagrant
sudo apt install -y qemu qemu-kvm libvirt-daemon libvirt-clients bridge-utils virt-manager
vagrant plugin install vagrant libvirt
vagrant plugin install vagrant-mutate
vagrant plugin install vagrant-parallels

⚙️ Options

Creating a KVM-libvirt pool for Vagrant VMs and saving the /dev/sdb1 disk on the server:

mkfs.xfs /dev/sdb1
mkdir -p /var/lib/libvirt/vagrant
echo "$(blkid /dev/sdb1 -o export | grep ^UUID) /var/lib/libvirt/vagrant xfs default 0 0" >> /etc/fstab
mount -a
virsh pool-define-as --name vagrant --type dir --target /var/lib/libvirt/vagrant
virsh pool-start vagrant
virsh pool-autostart vagrant
virsh pool-list --all
 Name                 State      Autostart
-------------------------------------------
 default              active     yes
 vagrant              active     yes

📦 Packer Installation


CentOS/RHEL:

sudo yum install -y yum-utils
sudo yum-config-manager --add-repo https://rpm.releases.hashicorp.com/RHEL/hashicorp.repo
sudo yum -y install packer

Ubuntu/Debian:

wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update && sudo apt install packer

📚 Reference

Releases

No releases published

Packages

No packages published