Joyce
Joyce

Reputation: 1451

vagrant to use yum instead of apt-get for centos boxes

and have found it useful. I was following the documentation along, but instead of using the lucid32 box, I wanted to use a centos 6 box and try out chef provisioning, but once the vm loaded up, it seems to be using apt-get rather than yum to download chef. How can I make vagrant use yum instead?

Upvotes: 1

Views: 1829

Answers (1)

Mike Branski
Mike Branski

Reputation: 677

What provisioner are you using? I had the same question using Chef, and resolved it by replacing the apt-get cookbook with yum, then updating the recipe include.

If you're using Chef, you can download the yum cookbook from opscode-cookbooks/yum and drop it in your cookbooks folder (e.g. ./vagrant_guide/cookbooks/yum/), then simply replace the apt-get recipe call with yum.

If you're following the Getting Started Guide, your project might look something like this:

./vagrant_guide/Vagrantfile

Vagrant::Config.run do |config|
    config.vm.box = "centos"

    config.vm.provision :chef_solo do |chef|
        chef.add_recipe "vagrant_main"
        # You could optionally just call chef.add_recipe "yum"
        # here instead of doing it in the vagrant_main recipe
    end
end

./vagrant_guide/cookbooks/vagrant_main/recipes/default.rb

require_recipe "yum"

Upvotes: 6

Related Questions