Skip to content

Instantly share code, notes, and snippets.

Last active September 4, 2021 12:22
  • Star 20 You must be signed in to star a gist
  • Fork 10 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
Vagrant and KVM(QEMU) on Centos7


yum group install -y "Development Tools"
yum -y install qemu-kvm libvirt virt-install bridge-utils libvirt-devel  libxslt-devel libxml2-devel libvirt-devel libguestfs-tools-c
echo "net.ipv4.ip_forward = 1"|sudo tee /etc/sysctl.d/99-ipforward.conf
sysctl -p /etc/sysctl.d/99-ipforward.conf
systemctl enable libvirtd
systemctl start libvirtd

rpm -Uvh vagrant_1.7.4_x86_64.rpm
vagrant plugin install vagrant-libvirt

server was built with a lot of space in home, just exploiting this as VAGRANT HOME echo 'export VAGRANT_HOME=/home/VMs/vagrant' >> /etc/profile

sudo vagrant box add centos64
sudo vagrant up --provider=libvirt
Vagrant.configure("2") do |config|
config.vm.define :server do |server| = "centos64" :public_network,
:auto_config => false,
:dev => "vibr0",
:mode => "bridge",
:type => "bridge"
server.vm.provision "shell",
run: "always",
inline: "dhclient -v eth1"
server.vm.provider :libvirt do |domain|
domain.management_network_address = ""
domain.management_network_name = "default"
domain.nic_model_type = "rtl8139"
domain.memory = 2048
domain.cpus = 2
domain.nested = true
domain.volume_cache = 'none'
domain.graphics_port = 5902
domain.graphics_ip = ''
domain.video_type = 'qxl'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment