Installing packages
We need some packages for our server. Now our server is configured to use Chef and talk to a Chef server, let's install a few packages such as the Apache server, PHP, and MariaDB to build a classic LAMP server on a CentOS 7.2 server.
Getting ready
To work through this recipe, you will need the following:
- A working Chef DK installation on the workstation
- A working Chef client configuration on the remote host
How to do it…
To install a package on a Red Hat-based system, we'd use either yum
(until CentOS 7) or dnf
(for Fedora after version 22). As we're using a CentOS 7 server, the Apache2 HTTP server package name is httpd
, (it's apache2
on Debian-based systems). Manually, we would have typed the following:
$ dnf install httpd $ yum ...
Get Infrastructure as Code (IAC) Cookbook now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.