Wednesday, November 9, 2016

How to install Vagrant with Oracle® VM VirtualBox and libvirt support on Antergos Linux

Installation

I recently needed to install Vagrant with support for Oracle® VM VirtualBox and libvirt for my dixie project at GitHub. Some of the virtualbox dependencies was found in this excellent post over at forum.antergos.com. Then I wrapped it into a script, and the here is the part of the script that installs and configures it:

if [ $(uname -r | grep ARCH | wc -l) -gt 0 ]; then
  sudo pacman -S --needed --noconfirm vagrant
  sudo pacman -S --needed --noconfirm libvirt
  sudo pacman -S --needed --noconfirm linux-headers
  sudo pacman -S --needed --noconfirm virtualbox virtualbox-guest-iso
  sudo pacman -S --needed --noconfirm vde2 net-tools virtualbox-ext-vnc virtualbox-host-modules-arch
  sudo pacman -S --needed --noconfirm ansible rsync
  sudo su -c "modprobe vboxdrv" || echo "Reboot your computer and try again"
  if [ ! -f "/etc/modules-load.d/virtualbox.conf" ]; then
    sudo touch /etc/modules-load.d/virtualbox.conf
  fi

  if [ $(grep vboxdrv /etc/modules-load.d/virtualbox.conf | wc -l) -eq 0 ]; then
    sudo su -c 'echo "vboxdrv" >> /etc/modules-load.d/virtualbox.conf'
  fi

  if [ $(grep vboxnetadp /etc/modules-load.d/virtualbox.conf | wc -l) -eq 0 ]; then
    sudo su -c 'echo "vboxnetadp" >> /etc/modules-load.d/virtualbox.conf'
  fi
  if [ $(grep vboxnetflt /etc/modules-load.d/virtualbox.conf | wc -l) -eq 0 ]; then
    sudo su -c 'echo "vboxnetflt" >> /etc/modules-load.d/virtualbox.conf'
  fi
  if [ $(grep vboxpci /etc/modules-load.d/virtualbox.conf | wc -l) -eq 0 ]; then
    sudo su -c 'echo "vboxpci" >> /etc/modules-load.d/virtualbox.conf'
  fi
fi

No comments:

Post a Comment