It might be worth posting this to their github issues and see if it can be taken into the project as an 'official' branch of some kind?
HOWTO: Homestead on libvirt (kvm)
Since my environment was already running libvirt as virtualization layer, the default option of using VirtualBox for Homestead was not available to me.
However, it is surprisingly easy to adapt the software. Here's what I've changed to make it happen. Hopefully this is useful to anyone else facing the same scenario :-) or maybe even to get to an official libvirt box...
See here for details on installing the vagrant plugin: https://github.com/vagrant-libvirt/vagrant-libvirt
-
make a copy of the VirtualBox vagrant box
-
convert the .vmdk from the VirtualBox vagrant box to .qcow2 format:
qemu-img convert -f vmdk -O qcow2 box-disk001.vmdk box.img -
temporarily mount the box.img file (or boot it in a temporary vm) to make a change to /etc/network/interfaces and make the primary section look as follows (i.e. change interface name to ens5)
# The primary network interface auto ens5 iface ens5 inet dhcp pre-up sleep 2 -
create metadata.json:
{ "provider": "libvirt", "format": "qcow2", "virtual_size": 40 } -
create Vagrantfile:
Vagrant.configure("2") do |config| config.vm.box = "laravel/homestead" config.vm.provider :libvirt do |libvirt| libvirt.driver = "kvm" libvirt.host = "" libvirt.connect_via_ssh = false libvirt.storage_pool_name = "default" end end -
optional: package up the three files into a vagrant .box :)
-
copy the files manually into ~/.vagrant.d/boxes/laravel-VAGRANTSLASH-homestead/2.1.0/libvirt
-
in the Homestead.yaml, set the proper provider:
provider: libvirt -
add the following section to the scripts/homestead.rb file:
# Configure libvirt settings config.vm.provider "libvirt" do |kvm| kvm.memory = settings["memory"] ||= "2048" kvm.cpus = settings["cpus"] ||= "1" end -
vagrant up !!
Hopefully I didn't forget anything while documenting this. Thanks for a great piece of software! Cheers.
Please or to participate in this conversation.