1

并发现它很有用。我一直在关注文档,但是我不想使用 lucid32 机器,而是想使用 centos 6 机器并尝试使用 chef 配置,但是一旦 vm 加载,它似乎使用 apt-get 而不是 yum 来下载 chef . 我怎样才能让 vagrant 使用 yum 代替?

4

1 回答 1

6

您使用的是什么供应商?我在使用 Chef 时遇到了同样的问题,并通过将 apt-get 食谱替换为 yum 解决了这个问题,然后更新了包含的食谱。

如果您使用的是 Chef,您可以从opscode-cookbooks/yum下载 yum 食谱并将其放入您的食谱文件夹(例如./vagrant_guide/cookbooks/yum/),然后只需将 apt-get recipe 调用替换为 yum。

如果您遵循入门指南,您的项目可能如下所示:

./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"
于 2012-05-16T16:23:05.097 回答