-
Notifications
You must be signed in to change notification settings - Fork 60
Install_on_Fedora
-
Fedora 18, or newer
- Fedora 20 is the version most recently tested for vagrant-kvm
- 64-bit OS is recommended
-
Vagrant 1.5.2, or newer
-
an processor that is capable to run KVM
- an Intel processor with the Intel VT and the Intel 64 extensions
- or, an AMD processor with the AMD-V and the AMD64 extensions
NOTES:
-
Because Vagrant 1.5 changed the structure of the boxes directory, we do not recommend to run vagrant-kvm with an older version of Vagrant.
-
Some users have reported they are having problem running vagrant-kvm on Fedora. If you have such problem, please report it here.
Install the packages required to run vagrant-kvm.
sudo yum -y install qemu-kvm libvirt libvirt-daemon-kvm libvirt-devel redir policycoreutils-python
sudo yum -y install gcc-c++ make libtool
Just for sure, reboot your system after installation.
Enable libvirt services at system start up.
sudo systemctl enable libvirtd
sudo systemctl enable libvirt-guests
Start libvirt services.
sudo systemctl start libvirtd
sudo systemctl start libvirt-guests
The default home directory permission will prevent a virtual machine
(qemu-system-x86_64
) to access the libvirt storage pool in
.vagrant.d
directory
(Issue #163).
Give x
permission for users in other groups.
chmod o+x $HOME
Fedora uses PolicyKit to manage access to libvirt, and by default, it
will require root privilege. You can add the following polkit rule to
allow users in virt
group to access libvirt in user privilege.
Add /etc/polkit-1/rules.d/10.virt.rules
with the following contents.
polkit.addRule(function(action, subject) {
polkit.log("action=" + action);
polkit.log("subject=" + subject);
var now = new Date();
polkit.log("now=" + now)
if ((action.id == "org.libvirt.unix.manage"
|| action.id == "org.libvirt.unix.monitor")
&& subject.isInGroup("virt")) {
return polkit.Result.YES;
}
return null;
});
Then restart polkit service.
sudo systemctl restart polkit.service
Create virt
group and add your user to the group.
sudo groupadd virt
sudo usermod -a -G virt ~~username~~
Logout and login again so that PolicyKit will recognize your group.
Up to vagrant-kvm 0.1.7, NFS is the only way to share folders between Vagrant host and a guest VM. (vagrant-kvm 0.1.8 or newer will be shipped with 9p share (virtfs) support as the default sharing protocol.) So you need to install NFS server on the host.
sudo yum -y install nfs-utils
sudo systemctl enable nfs-server
sudo systemctl start nfs-server
By default, Vagrant uses UDP protocol for NFS share. Add the UDP port to the firewall rule of NFS server.
/usr/lib/firewalld/services/nfs.xml
<?xml version="1.0" encoding="utf-8"?>
<service>
<short>NFS4</short>
<description>The NFS4 protocol is used to share files via TCP networking. You will need to have the NFS tools installed and properly configure your NFS server for this option to be useful.</description>
<port protocol="tcp" port="2049"/>
<port protocol="udp" port="2049"/> <!-- ADD THIS LINE -->
</service>
Then enable the firewall rules.
sudo firewall-cmd --permanent --zone public --add-service mountd
sudo firewall-cmd --permanent --zone public --add-service rpc-bind
sudo firewall-cmd --permanent --zone public --add-service nfs
sudo firewall-cmd --reload
Vagrant-kvm 0.1.8 or newer will be shipped with 9p share (virtfs) support as the default sharing protocol.
There is a libvirt bug(not implemented yet) that is not allow file share with 9p by SELinux enforcement. To avoid it, you need to install policycoreutils-python package. Vagrant-kvm 0.1.8 or newer will fix it for you automatically.
Download the latest Fedora RPM package from the Vagrant Download page. We recommend Vagrant 1.5.2 or newer.
Install the package. (Replace x.y.z
with the version you have.)
sudo rpm -ivh vagrant_x.y.z_x86_64.rpm
Or, let rpm to download and install the package at once. (Replace
x.y.z
with the version you have.)
sudo rpm -ivh https://dl.bintray.com/mitchellh/vagrant/vagrant_x.y.z_x86_64.rpm
Finally, install vagrant-kvm plugin.
vagrant plugin install vagrant-kvm
Verify that you have installed vagrant-kvm 0.1.7 or newer. The versions prior to 0.1.7 will not work with Vagrant 1.5 or newer.
vagrant plugin list
If you want to make vagrant-kvm as the default Vagrant provider, add
the following line to your shell's init script (e.g. .bashrc
).
export VAGRANT_DEFAULT_PROVIDER=kvm
You can test a development version of vagrant-kvm.
sudo yum -y install gcc-c++ make libtool git libxml2-devel libxslt-devel
sudo yum -y install ruby-devel rubygems rubygem-rake
git clone https://github.com/adrahon/vagrant-kvm.git
cd vagrant-kvm
gem build vagrant-kvm.gemspec
vagrant plugin install vagrant-kvm-x.y.z.gem
-
(TODO) Try out an existing Vagrant KVM box.
-
(TODO) Or, convert an existing Vagrant (VirtualBox) box or create your own.