Skip to content

Instantly share code, notes, and snippets.

@kpettijohn
Last active February 25, 2017 19:31
Show Gist options
  • Save kpettijohn/2253b82e0f47c109845f1ae2509a702d to your computer and use it in GitHub Desktop.
Save kpettijohn/2253b82e0f47c109845f1ae2509a702d to your computer and use it in GitHub Desktop.
Vagrant + libvirt setup (Fedora 23)
#!/bin/bash
USER=kp
VAGRANT_VERSION='1.9.1'
plugins="vagrant-libvirt vagrant-mutate vagrant-rekey-ssh"
sudo dnf install -y \
libxslt-devel \
libxml2-devel \
ruby-devel \
libguestfs-tools-c \
gcc \
qemu \
qemu-kvm \
libvirt \
libvirt-devel
if ! command -v vagrant 2>/dev/null; then
curl -L -O https://releases.hashicorp.com/vagrant/${VAGRANT_VERSION}/vagrant_${VAGRANT_VERSION}_x86_64.rpm
sudo rpm -Uvh vagrant_${VAGRANT_VERSION}_x86_64.rpm
fi
if ! id -nG "$USER" | grep -qw "libvirt"; then
sudo usermod -aG libvirt $USER
fi
for p in $plugins; do
if ! vagrant plugin list | grep -qw "$p"; then
vagrant plugin install $p
fi
done
vagrant init centos/7; vagrant up --provider libvirt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment