How to set up a VM with KVM qemu without VitualBox using Vagrant

0 votes

I want to use KVM/qemu with Vagrant and the VM managed GUI instead of VirtualBox. So I installed Vagrant ver. 1.9.1. So I read upon it and found that I require vagrant-libvirt for KVM to work with it. So, I installed it next:

$ vagrant plugin list
vagrant-libvirt (0.0.37)
vagrant-share (1.1.6, system)

Next, I to add a CentOS(7) box using vagrant box add "centos/7" and selected libvirt, when prompted. After which, I ran vagrant init and didn't encounter any errors:

After that I added CentOS(7) box in vagrant box using add centos/7 and selected vagrant-libvirt. Then I ran vagrant init without any errors.

$ 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.

But vagrant up seems to give error:

$ 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.

This is the provider section in vagrantfile

config.vm.provider :libvirt do |domain|
    domain.driver = "qemu"
    domain.memory = 512
    domain.cpus = 1
end

I tried changing it to:

config.vm.provider :libvirt do |domain|
    domain.driver = "kvm"
    domain.host = 'localhost'
    domain.uri = 'qemu:///system'
    domain.memory = 512
    domain.cpus = 1
end

And I tried vagrant up --provider=kvm, vagrant up --provider=qemu, and vagrant up --provider=libvirt too, but that too didn't seem to work.

Is there anything here that I'm doing wrong or something that i might have missed.

Edit: After the adding centos/7 using vagrant, it shows up when running vagrant box list.

$ vagrant box list
centos/7 (libvirt, 1611.01)
Apr 11, 2018 in DevOps & Agile by shubham
• 7,340 points
2,400 views

1 answer to this question.

0 votes

Start the vagrant box using:

vagrant up --provider=kvm

But maybe your issue is caused by the vagrant ver you're using. It says that vagrant-libvirt plugin is comaptible with vagrant 1.5 to 1.8.

answered Apr 11, 2018 by ajs3033
• 7,300 points

Related Questions In DevOps & Agile

+1 vote
2 answers

How do I run Apache server from Docker without mapping to a location?

If you're seeing a 500 error, that's ...READ MORE

answered Oct 18, 2018 in DevOps & Agile by lina
• 8,220 points
2,192 views
+13 votes
2 answers
0 votes
1 answer

How to get remote access to a private docker-registry?

New client version refuses to work with ...READ MORE

answered Jul 31, 2018 in DevOps & Agile by Kalgi
• 52,350 points
2,379 views
+5 votes
7 answers

Docker swarm vs kubernetes

Swarm is easy handling while kn8 is ...READ MORE

answered Aug 27, 2018 in Docker by Mahesh Ajmeria
3,925 views
+15 votes
2 answers

Git management technique when there are multiple customers and need multiple customization?

Consider this - In 'extended' Git-Flow, (Git-Multi-Flow, ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by DragonLord999
• 8,450 points
4,034 views
+2 votes
2 answers

how to set different provisioning profiles for different targets using Xcode Build

For multiple targets, each task has to ...READ MORE

answered Mar 27, 2018 in DevOps & Agile by ajs3033
• 7,300 points

edited Oct 16, 2018 by Kalgi 4,818 views
0 votes
1 answer

Using kitchen-terrform to set up extra context

Use .kitchen.yml file which cans specify where ...READ MORE

answered Aug 7, 2018 in DevOps & Agile by ajs3033
• 7,300 points
687 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP