I'm working with someone else's chef recipe and it consists of these references to the process of installing 1.9.3p0
on my server:
我正在与其他人的厨师食谱合作,它包括对我的服务器上安装1.9.3p0的过程的这些参考:
package 'ruby1.9.3'
package 'ruby1.9.1-dev'
# set ruby 1.9 to be default
execute 'update-alternatives --set ruby /usr/bin/ruby1.9.1'
execute 'update-alternatives --set gem /usr/bin/gem1.9.1'
ohai "reload" do
action :reload
end
I'm new to chef so I'm not sure where these packages reside, but seeing no other reference them to them in the repo of recipes, I'm guessing it's referring to a central repo. In that case, how could I modify this recipe to get chef (solo) to prepare my servers with a different patch level?
我是厨师的新手,所以我不确定这些软件包在哪里,但是在食谱回购中没有看到其他人参考它们,我猜这是指一个*回购。在这种情况下,我怎么能修改这个配方让厨师(独奏)准备我的服务器与不同的补丁级别?
1 个解决方案
#1
1
The documentation may clear things up a little here:
文档可能会在这里清楚一点:
package
tells the chef-client to use one of sixteen different providers during the chef-client run, where the provider that is used by chef-client depends on the platform of the machine on which the chef-client run is taking placepackage告诉厨师 - 客户在厨师 - 客户端运行期间使用16个不同提供商之一,其中chef-client使用的提供商取决于主厨客户端运行的机器平台
So on Debian-based systems like the one that recipe was written for, Chef will automatically resolve the package
resource to an apt_package
resource, which will call apt-get
to install ruby1.9.3
.
因此,在基于Debian的系统(如编写配方的系统)上,Chef将自动将包资源解析为apt_package资源,该资源将调用apt-get来安装ruby1.9.3。
Now, given none of the mainstream Linux distros or FreeBSD package up multiple patchlevels of Ruby (and, in some cases, stated patchlevels are not what they seem), you probably don't want to use package
to get Ruby. Most likely you'll end up wanting to build it from source using something like the bash
resource.
现在,由于没有主流的Linux发行版或FreeBSD打包多个Ruby的补丁级别(并且在某些情况下,声明的补丁级别不是它们看起来的那样),您可能不希望使用包来获取Ruby。最有可能你最终想要使用类似bash资源的东西从源代码构建它。
package
will still be useful for installing the Ruby prerequisites, which you can use from your vendor's package repository without issue.
package仍然可用于安装Ruby先决条件,您可以从供应商的软件包存储库中使用它而不会出现问题。
#1
1
The documentation may clear things up a little here:
文档可能会在这里清楚一点:
package
tells the chef-client to use one of sixteen different providers during the chef-client run, where the provider that is used by chef-client depends on the platform of the machine on which the chef-client run is taking placepackage告诉厨师 - 客户在厨师 - 客户端运行期间使用16个不同提供商之一,其中chef-client使用的提供商取决于主厨客户端运行的机器平台
So on Debian-based systems like the one that recipe was written for, Chef will automatically resolve the package
resource to an apt_package
resource, which will call apt-get
to install ruby1.9.3
.
因此,在基于Debian的系统(如编写配方的系统)上,Chef将自动将包资源解析为apt_package资源,该资源将调用apt-get来安装ruby1.9.3。
Now, given none of the mainstream Linux distros or FreeBSD package up multiple patchlevels of Ruby (and, in some cases, stated patchlevels are not what they seem), you probably don't want to use package
to get Ruby. Most likely you'll end up wanting to build it from source using something like the bash
resource.
现在,由于没有主流的Linux发行版或FreeBSD打包多个Ruby的补丁级别(并且在某些情况下,声明的补丁级别不是它们看起来的那样),您可能不希望使用包来获取Ruby。最有可能你最终想要使用类似bash资源的东西从源代码构建它。
package
will still be useful for installing the Ruby prerequisites, which you can use from your vendor's package repository without issue.
package仍然可用于安装Ruby先决条件,您可以从供应商的软件包存储库中使用它而不会出现问题。