本文介绍了libvirt 和 VirtualBox/入门的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用 VirtualBox 作为虚拟化解决方案开始使用 libvirt.我安装了所有东西,并且在使用他们的 VBoxHeadless 命令时 VirtualBox 本身正在运行.但是,libvirt 无法连接到 VirtualBox:

I'm trying to get started on libvirt with VirtualBox as a virtualization solution. I installed everything and VirtualBox itself is running when using their VBoxHeadless command.However, libvirt fails to connect to VirtualBox:

# virsh -c vbox:///session
libvir: error : could not connect to vbox:///session
error: failed to connect to the hypervisor

我在 libvirt 文档中找不到任何关于在使用 virsh 之前是否必须进行任何域特定配置的提示.

I could not find any hints in the libvirt documentation that point to whether I have to make any domain specific configuration before using virsh.

有大佬指点一下吗?或者甚至更好,也许是一个教程,通过从头开始使用 libvirt、virsh 或它的 API(我以后的目标)的方式工作.

Does anyone have a hint? Or even better, maybe a tutorial that works through the way of using libvirt, virsh or it's APIs (my later goal) from the ground up.

推荐答案

如果你在 Ubuntu 上这样做,那么问题在于他们的 libvirt 包是在没有 VirtualBox 支持的情况下构建的.

If you are doing this on Ubuntu, then the problem is their libvirt package is built without VirtualBox support.

您可以非常轻松地在支持下重建包.类似的东西:

You can rebuild the package with support very easily. Something like:

apt-get source -d libvirt
sudo apt-get build-dep libvirt
dpkg-source -x libvirt*dsc

进入 libvirt 目录并编辑 debian/rules 以便它显示 -- 而不是 --without-vbox带-vbox.您可以在 debian/changelog 的顶部添加一个条目,以便将包编译为不同的版本(例如,将 ~local1 附加到版本).

Go into the libvirt directory and edit debian/rules so that instead of --without-vbox it says --with-vbox. You can add an entry to the top of debian/changelog so the package is compiled as a different version (e.g., append ~local1 to the version).

dpkg-buildpackage -us -uc -b -rfakeroot

您将在上面的目录中获得新的 .debs.使用 dpkg -i 安装相关的(libvirt0、libvirt0-bin 和任何你想要的).

You'll get new .debs built in the directory above. Use dpkg -i to install the relevant ones (libvirt0, libvirt0-bin, and whatever else you want).

这篇关于libvirt 和 VirtualBox/入门的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

06-30 10:27