我无法让 vagrant 使用 libvirt。
我首先使用发行版软件包,但它产生了与下面我的描述中看到的相同的错误。然后我删除了每个发行版 vagrant 软件包并安装了 hashcorp 提供的软件包:
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vagrant
然后我安装了 libvirt-vagrant 插件:
vagrant plugin install vagrant-libvirt
Installing the 'vagrant-libvirt' plugin. This can take a few minutes...
Fetching formatador-0.3.0.gem
Fetching fog-core-2.2.4.gem
Fetching fog-json-1.2.0.gem
Fetching nokogiri-1.12.5-x86_64-linux.gem
Fetching fog-xml-0.1.4.gem
Fetching ruby-libvirt-0.8.0.gem
Building native extensions. This could take a while...
Fetching fog-libvirt-0.9.0.gem
Fetching vagrant-libvirt-0.7.0.gem
Installed the plugin 'vagrant-libvirt (0.7.0)'!
然而vagrant up --provider=libvirt
仍然失败:
The provider 'libvirt' could not be found, but was requested to
back the machine 'debian11'. Please use a provider that exists.
Vagrant knows about the following providers: virtualbox, hyperv, docker
有任何想法吗?
答案1
所以我在一个新的虚拟机上尝试了这个过程,但这些是我遵循的步骤(在我的测试中,我觉得 libvirt 存储非常慢,是由于我的硬件还是预期的原因?)
我遵循的步骤
curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
sudo apt-get update && sudo apt-get install vagrant
apt install vagrant-libvirt
apt-get build-dep vagrant ruby-libvirt
apt-get install qemu libvirt-daemon-system libvirt-clients ebtables dnsmasq-base
apt-get install libxslt-dev libxml2-dev libvirt-dev zlib1g-dev ruby-dev
apt-get install libguestfs-tools
vagrant plugin install vagrant-libvirt
vagrant init fedora/32-cloud-base
vagrant up --provider=libvirt
好吧,我在云虚拟机中完成这一切,在完成时我遇到了错误,就像Error while creating domain: Error saving the server: Call to virDomainDefineXML failed: End of file while reading data: Input/output error
我希望它与您的查询无关一样。
希望能帮助到你。
参考: