vagrant-libvirt/docs/index.markdown
Darragh Bailey 82202945ce
Migrate documentation to github pages (#1523)
Switch from having all documentation contained within the README to
publishing a jekyll static site of documentation under github pages.

This allows for configuration and installation guides to be handled
separately to make for the relevant pieces to be in smaller chunks and
therefore easier to follow for users. Additionally a table of contents
can now be included in a left navigation section that ensures it should
be possible to quickly jump from the start to any section and back
again.

Include support for publishing previews and releases under separate
directories to allow for them to exist at the same time as the other
latest version of the documents.

The navigation section also includes support for accessing any of the
other versions published so that it easier to see what configuration
options exist for a given release. These will be published automatically
when releases are added.
2022-07-19 13:48:02 +00:00

3.1 KiB

title redirect_from nav_order toc
Quickstart
/home/
/quickstart/
/extras/
1 true

Vagrant-libvirt is a Vagrant plugin that adds a Libvirt provider to Vagrant, allowing Vagrant to control and provision machines via Libvirt toolkit.

{: .info } Actual version is still a development one. Feedback is welcome and can help a lot :-)

Prerequisites

Vagrant-libvirt requires the following:

  • Vagrant
  • Libvirt (and QEMU)
  • GCC and Make (if not using vagrant from your distribution)

{: .warn } Before you start using vagrant-libvirt, please make sure your Libvirt and QEMU installation is working correctly and you are able to create QEMU or KVM type virtual machines with virsh or virt-manager.

See [Requirements]({{ '/installation/#requirements' | relative_url }}) for guides and details.

Installation

  1. Install Vagrant, Libvirt and QEMU for your distribution

    • Ubuntu
    sudo apt-get update && \
        sudo apt install -y qemu libvirt-daemon-system libvirt-clients \
            ebtables dnsmasq-base libguestfs-tools
    sudo apt install -y --no-install-recommends vagrant ruby-fog-libvirt
    
    • Fedora
    vagrant_libvirt_deps=($(sudo dnf repoquery --depends vagrant-libvirt 2>/dev/null | cut -d' ' -f1))
    dependencies=$(sudo dnf repoquery --qf "%{name}" ${vagrant_libvirt_deps[@]/#/--whatprovides })
    sudo dnf install --assumeyes --setopt=install_weak_deps=False @virtualization ${dependencies}
    
  2. Install the latest release of vagrant-libvirt

vagrant plugin install vagrant-libvirt

If you encounter any errors during this process, check that you have installed all the prerequisites in [Requirements]({{ '/installation/#requirements' | relative_url }}). If you still have issues, see [Troubleshooting]({{ '/troubleshooting/#installation-problems' | relative_url }}).

{: .info } Installation varies based on your operating system or use of upstream vagrant. See our [guides]({{ '/installation/#guides' | relative_url }}) for OS-specific instructions.

Initial Project Creation

After installing the plugin (instructions above), the quickest way to get started is to add Libvirt box and specify all the details manually within a config.vm.provider block. So first, add Libvirt box using any name you want. You can find more Libvirt-ready boxes at Vagrant Cloud. For example:

vagrant init fedora/36-cloud-base

Or make a Vagrantfile that looks like the following, filling in your information where necessary. For example:

Vagrant.configure("2") do |config|
  config.vm.define :test_vm do |test_vm|
    test_vm.vm.box = "fedora/36-cloud-base"
  end
end

Start VM

In prepared project directory, run following command:

$ vagrant up --provider=libvirt

Vagrant needs to know that we want to use Libvirt and not default VirtualBox. That's why there is --provider=libvirt option specified. Other way to tell Vagrant to use Libvirt provider is to setup environment variable

export VAGRANT_DEFAULT_PROVIDER=libvirt