简体   繁体   English

Vagrant + Chef + apt:是否可以在Ubuntu VM上安装特定版本的deb软件包?

[英]Vagrant + Chef + apt: Is it possible to install a specific version of a deb package on a Ubuntu VM?

I'm using Vagrant with Chef to build a Ubuntu 12.04 virtual machine. 我正在使用Vagrant和Chef来构建一个Ubuntu 12.04虚拟机。 I'm using the opscode cookbooks from here: https://github.com/opscode/cookbooks 我正在使用这里的opscode cookbook: https//github.com/opscode/cookbooks

I want to use the opscode apt cookbook to install packages. 我想使用opscode apt cookbook来安装包。 I want to make sure it installs a specific version of a package, to make sure the build environment is consistent. 我想确保它安装特定版本的软件包,以确保构建环境一致。 Here's an example of what I'm trying to do: 这是我正在尝试做的一个例子:

package "git" do
  action :install
end

I know that if you install the package using apt from the command line, you can specify the version like so: 我知道如果你从命令行使用apt安装软件包,你可以像这样指定版本:

apt-get install git=1:1.7.9.5-1

But I can't figure out how to do this via the cookbook. 但我无法通过食谱弄清楚如何做到这一点。 Is this possible? 这可能吗?

I think I figured it out. 我想我明白了。 It's pretty simple: 这很简单:

package "git" do
  version "1:1.7.9.5-1"
  action :install
end

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM