Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the idiomatic way to install a Debian package using Chef?

Tags:

Below my code for installing vcider. I am learning chef but have not seen anything for installing a dpkg. I would like to use version in the script. The code below works.

script "install_vcider" do   interpreter "bash"   user "root"   cwd "/tmp"   code <<-EOH   wget https://my.vcider.com/m/downloads/vcider_2.0.1b_amd64.deb   dpkg -i vcider__amd64.deb   EOH end 

Even with the code above can I replace 2.0.1b with #{version}? attribute file -> default[:vcider][:version] 2.0.1b

recipe file - > version = node[:vcider][:version] 
like image 422
Tampa Avatar asked Mar 27 '12 22:03

Tampa


People also ask

How do I install chef packages?

Installing Packages from Third-Party RepoStep 1 − Edit the default recipe of the cookbook. Step 2 − Edit the metadata to add dependency on the apt cookbook. Step 3 − Upload the modified cookbook to the Chef server. Step 4 − Validate that the package you are trying to install, is not yet installed.

What is Deb installer?

The extension . deb is used to signify a collection of files managed by the Debian packages management system. So, deb is an abbreviation for Debian package, as opposed to source package. You can install a downloaded Debian package using dpkg in a terminal: dpkg -i *.


1 Answers

The Right Thing is to use the built-in resource types. Presuming you've set the version and arch variables appropriately:

remote_file "/tmp/vcider_#{version}_#{arch}.deb" do   source "https://my.vcider.com/m/downloads/vcider_#{version}_#{arch}.deb"   mode 0644   checksum "" # PUT THE SHA256 CHECKSUM HERE end  dpkg_package "vcider" do   source "/tmp/vcider_#{version}_#{arch}.deb"   action :install end 
like image 145
Charles Duffy Avatar answered Sep 19 '22 13:09

Charles Duffy