Vagrant and Oh-My-Vagrant on RHEL7

My employer keeps paying me, which I appreciate, so it’s good to spend some time to make sure RHEL7 customers get a great developer experience! So here’s how to make vagrant, vagrant-libvirt and Oh-My-Vagrant work on RHEL 7+. The same steps should work for CentOS 7+.

I’ll first paste the commands you need to run, and then I’ll explain what’s happening for those that are interested:

# run these commands, and then get hacking!
# this requires the rhel-7-server-optional-rpms repo enabled
sudo subscription-manager repos --enable rhel-7-server-optional-rpms
sudo yum install -y gcc ruby-devel libvirt-devel libvirt qemu-kvm
sudo systemctl start libvirtd.service
sudo yum install -y vagrant_1.7.4_x86_64.rpm
vagrant plugin install vagrant-libvirt
sudo cp -a purpleidea-vagrant-libvirt-epel-7.repo /etc/yum.repos.d/
sudo yum install -y vagrant-libvirt    # noop plugin for oh-my-vagrant dependency
sudo cp -a purpleidea-oh-my-vagrant-epel-7.repo /etc/yum.repos.d/
sudo yum install -y oh-my-vagrant
. /etc/profile.d/ # logout/login or source

Let’s go through it line by line.

sudo subscription-manager repos --enable rhel-7-server-optional-rpms

Make sure you have the optional repos enabled, which are needed for the ruby-devel package.

sudo yum install -y gcc ruby-devel libvirt-devel libvirt
sudo systemctl start libvirtd.service

Other than the base os, these are the dependencies you’ll need. If you have some sort of super minimal installation, and find that there is another dependency needed, please let me know and I’ll update this article. Usually libvirt is already installed, and libvirtd is started, but this includes those two operations in case they are needed.

sudo yum install -y vagrant_1.7.4_x86_64.rpm

Vagrant has finally landed in Fedora 22, but unfortunately it’s not in RHEL or any of the software collections yet. As a result, we install it from the upstream.

vagrant plugin install vagrant-libvirt

Similarly, vagrant-libvirt hasn’t been packaged for RHEL either, so we’ll install it into the users home directory via the vagrant plugin system.

sudo cp -a purpleidea-vagrant-libvirt-epel-7.repo /etc/yum.repos.d/
sudo yum install -y vagrant-libvirt    # noop plugin for oh-my-vagrant dependency

Since there isn’t a vagrant-libvirt RPM, and because the RPM’s for Oh-My-Vagrant depend on that “requires” to install correctly, I built an empty vagrant-libvirt RPM so that Oh-My-Vagrant thinks the dependency has been met in system wide RPM land, when it’s actually been met in the user specific home directory space. I couldn’t think of a better way to do this, and as a result, you get to read about the exercise that prompted my recent “empty RPM” article.

sudo cp -a purpleidea-oh-my-vagrant-epel-7.repo /etc/yum.repos.d/
sudo yum install -y oh-my-vagrant

This last part installs Oh-My-Vagrant from the COPR. There is no “dnf enable” command in RHEL, so we manually wget the repo file into place.

. /etc/profile.d/ # logout/login or source

Lastly if you’d like to reuse your current terminal session, source the /etc/profile.d/ file that is installed, otherwise close and reopen your terminal.

You’ll need to do an omv init at least once to make sure all the user plugins are installed, and you should be ready for your first vagrant up! Please note, that the above process definitely includes some dirty workarounds until vagrant is more easily consumable in RHEL, but I wanted to get you hacking earlier rather than later!

I hope this article helps you hack it out in RHEL land, be sure to read about how to build your own custom RHEL vagrant boxes too!

Happy Hacking,


12 thoughts on “Vagrant and Oh-My-Vagrant on RHEL7

    • Actually, I completely agree with both these comments, but I basically just copied and pasted the output form my WIP hacking, which I did like that, so that I had the artifacts left in $HOME, so not optimal, but left as an exercise to the reader ;)

  1. Pingback: Links 12/8/2015: Docker 1.8, Kali Linux 2.0 | Techrights

  2. Nice post, purpleidea! Do you have a good recommendation on the provider tweaks one would need to do in the Vagrantfile, so it works seamless on libvirt (instead of virtualBox)?

  3. Here’s what I had to do to get it working on Arch x86_64 (Note I all ready had vagrant and docker installed):

    1. sudo pacman -Sy libvirt ruby libxslt libxml2
    2. sudo systemctl start libvirtd.service
    3. Install the vagrant-libvirt plugin
    3a. I had to follow the instructions at
    4. Install the following ruby gems
    4a. gem install domain_names -v 0.5.24
    4b. gem install net-ssh -v 2.9.2
    5. sudo git clone –recursive /usr/share/
    6. Add /usr/share/oh-my-vagrant/bin to the your PATH
    7a. edit ~/.bash_profile to have the following line:
    export PATH=$PATH:/usr/share/oh-my-vagrant/bin

    Then I ran ` init $OMV_CONFIG_DIR` and the files where generated in $OMV_CONFIG_DIR. Step 4 and the libxslt / limbxml2 may not be needed to run manually. I also have no idea on the correctness / validity of this. Use at your own risk.

    • Addendum:
      1a. Set up libvirt authentication, . I used file based permissions.

      I now think that steps 5-7a are not optimal. The above steps are definitely a step in the right direction, but they do not ensure OMV is installed correctly in “mainstream” mode.

      For “simple” mode:
      The git repo should probably be cloned into an area where your user account has ownership, say ~/oh-my-vagrant/.

      Then within ~/oh-my-vagrant/vagrant you can edit the omv.yaml file and begin to do stuff within that directory.

      Hopefully someone with more knowledge than me may be able to use what I’ve written as a starting point to actually install OMV in arch in “mainstream” mode.

  4. @Leonardo: I appreciate the write up! Would you like help in figuring out any missing information to make it easier to make an arch package? Then you could write up a whole blog post of your own on it. If you’re interested, LMK. I’m purpleidea in #ohmyvagrant on Freenode.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s