rah*_*huL 13 kvm qemu vagrant vagrantfile devops
我开始使用Vagrant并希望将它与KVM/qemu(以及Virtual Machine Manager GUI)一起使用,而不是安装VirtualBox.所以我先安装了Vagrant:
$ vagrant --version
Vagrant 1.9.1
$ vagrant box list
There are no installed boxes! Use `vagrant box add` to add some
Run Code Online (Sandbox Code Playgroud)
由于每 这些 帖子,我需要vagrant-libvirt
为它与KVM工作,所以我安装了下一个:
$ vagrant plugin list
vagrant-libvirt (0.0.37)
vagrant-share (1.1.6, system)
Run Code Online (Sandbox Code Playgroud)
接下来,我在提示时添加一个CentOS(7)框vagrant box add "centos/7"
并使用和选中libvirt
.之后,我跑了vagrant init
,没有遇到任何错误:
$ vagrant init centos/7
A `Vagrantfile` has been placed in this directory. You are now
ready to `vagrant up` your first virtual environment! Please read
the comments in the Vagrantfile as well as documentation on
`vagrantup.com` for more information on using Vagrant.
Run Code Online (Sandbox Code Playgroud)
然而,vagrant up
似乎是错误的,像这样:
$ vagrant up
No usable default provider could be found for your system.
Vagrant relies on interactions with 3rd party systems, known as
"providers", to provide Vagrant with resources to run development
environments. Examples are VirtualBox, VMware, Hyper-V.
The easiest solution to this message is to install VirtualBox, which
is available for free on all major platforms.
If you believe you already have a provider available, make sure it
is properly installed and configured. You can see more details about
why a particular provider isn't working by forcing usage with
`vagrant up --provider=PROVIDER`, which should give you a more specific
error message for that particular provider.
Run Code Online (Sandbox Code Playgroud)
这是提供者部分Vagrantfile
config.vm.provider :libvirt do |domain|
domain.driver = "qemu"
domain.memory = 512
domain.cpus = 1
end
Run Code Online (Sandbox Code Playgroud)我尝试将其修改为:
config.vm.provider :libvirt do |domain|
domain.driver = "kvm"
domain.host = 'localhost'
domain.uri = 'qemu:///system'
domain.memory = 512
domain.cpus = 1
end
Run Code Online (Sandbox Code Playgroud)我也试过vagrant up --provider=kvm
,vagrant up --provider=qemu
和vagrant up --provider=libvirt
也无济于事.
有没有我错过的一步?还是需要安装的另一个包/依赖项?
编辑:centos/7
使用vagrant 添加后,它会在运行时显示vagrant box list
.
$ vagrant box list
centos/7 (libvirt, 1611.01)
Run Code Online (Sandbox Code Playgroud)
您可以使用命令行选项--provider=kvm
,也可以设置VAGRANT_DEFAULT_PROVIDER
环境变量:
export VAGRANT_DEFAULT_PROVIDER=kvm # <-- may be in ~/.profile, /etc/profile, or elsewhere
vagrant up
Run Code Online (Sandbox Code Playgroud)
用命令启动游民箱
vagrant up --provider=kvm
Run Code Online (Sandbox Code Playgroud)
尽管在https://seven.centos.org/2017/08/updated-centos-vagrant-images-available-v1707-01/中已经说过
vagrant-libvirt插件仅与Vagrant 1.5至1.8兼容
归档时间: |
|
查看次数: |
18286 次 |
最近记录: |