How to install a package with yum on Amazon Opsworks

combinatorial asked:

I would like to install a single package with yum (or rpm) on my Amazon Opsworks instance when the instance starts. I have read about chef and recipes but all of the solutions seem very complex for an apparently simple and common task. I would like a simple example of how to install a package.

My answer:

In general what you’re going to do us create a chef recipe which installs a single package, probably using the yum_package resource.

This can be a very simple one-line recipe, if you just want the latest version of the package:

yum_package "my_package"

Then, you will add a cookbook containing just this setup recipe to an Opsworks custom layer. The custom layer doesn’t need to do anything else if all you want is to install the package. But since the custom layer lets you do a lot more, you might want to read Amazon’s documentation and some other sample cookbooks that it links to, to get a sense of what you can do.

View the full question and any other answers on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.