In this short tutorial we will learn how to install Puppet, an open source configuration and automation tool on CentOS 8 operating system.
Introduction
In the ever-evolving landscape of IT infrastructure management, automation and Infrastructure as Code (IaC) have emerged as crucial components for efficient, scalable, and consistent operations. Puppet is a powerful and widely adopted IaC tool that has become a cornerstone of DevOps practices. This article explores what Puppet is, its key features, and how it can benefit organizations in streamlining infrastructure management.
What is Puppet?
Puppet is an open-source, declarative, and model-driven configuration management and automation tool. Developed by Puppet, Inc., it allows system administrators to define and manage the configuration of servers and applications as code. Puppet operates on a client-server architecture, where the Puppet master server communicates with Puppet agents running on target systems to ensure that their configurations align with the desired state.
Key Features of Puppet
- Declarative Language: Puppet uses a declarative language that allows administrators to define the desired end state of their infrastructure. Instead of specifying how to achieve that state, Puppet takes care of the underlying implementation details. This simplifies configuration management, making it easier to understand and maintain.
- Cross-Platform Compatibility: Puppet supports various operating systems, including Linux, Windows, macOS, and many others. This cross-platform compatibility makes it a versatile choice for managing heterogeneous infrastructure.
- Resource Abstraction: Puppet abstracts infrastructure components into resources (e.g., files, packages, services) and relationships. These resources can be easily defined and managed, allowing for seamless infrastructure orchestration.
- Puppet Forge: Puppet Forge is a repository of pre-built Puppet modules and manifests contributed by the community. It simplifies and accelerates the development process, as users can leverage existing modules to automate common tasks.Reporting and Logging: Puppet provides detailed reporting and logging features, giving administrators insight into the state of their infrastructure. This is invaluable for monitoring and troubleshooting.
Benefits of Using Puppet
- Consistency: Puppet enforces a consistent and reproducible infrastructure configuration, reducing the risk of configuration drift and errors across your server fleet.
- Scalability: With Puppet, you can efficiently manage large-scale infrastructure. It allows you to scale your operations without a proportional increase in administrative effort.
- Time Savings: Automation with Puppet reduces the time and effort needed to deploy, configure, and maintain servers and applications. This frees up IT professionals to focus on more strategic tasks.ersion Control: Puppet code can be stored in version control systems like Git, allowing you to track changes and easily roll back to previous configurations if necessary.
- Security: Puppet helps in maintaining security and compliance standards by ensuring that all systems are configured according to specified security policies.
- Community and Ecosystem: Puppet has a large and active community, with a wealth of resources, modules, and documentation available. This community support makes it easier to learn and troubleshoot.
How To Install Puppet On CentOS 8
In this section we will install Puppet on CentOS 8 operating system. The installation will be consist of several steps as explained below :
1. Enable the Puppet Repo
2. Install Puppet for Servers/Puppet Masters
3. Install Puppet for Clients
4. Configuring Firewall
Step 1 : Enable the Puppet Repo
To install Puppet for either client or server machines on CentOS 8, we need to enable the Puppet repository first.For this purpose we will submit the following command line :
$ sudo rpm -Uvh https://yum.puppet.com/puppet8-release-el-8.noarch.rpm
Output :
[ramans@bckinfo ~]$ sudo rpm -Uvh https://yum.puppet.com/puppet8-release-el-8.noarch.rpm Retrieving https://yum.puppet.com/puppet8-release-el-8.noarch.rpm warning: /var/tmp/rpm-tmp.P65Cme: Header V4 RSA/SHA512 Signature, key ID 9e61ef26: NOKEY Verifying... ################################# [100%] Preparing... ################################# [100%] Updating / installing... 1:puppet8-release-1.0.0-3.el8 ################################# [100%]
Step 2 : Install Puppet Server/Puppet Master
After enabling Puppet repo, then we will install Puppet server by submitting command line :
$ sudo dnf install puppetserver
Output :
[ramans@bckinfo ~]$ sudo dnf install puppetserver Puppet 8 Repository el 8 - x86_64 441 kB/s | 1.0 MB 00:02 Last metadata expiration check: 0:00:02 ago on Sun 05 Nov 2023 06:44:31 PM PST. Dependencies resolved. ======================================================================================================== Package Architecture Version Repository Size ======================================================================================================== Installing: puppetserver noarch 8.2.3-1.el8 puppet8 71 M Installing dependencies: java-11-openjdk-headless x86_64 1:11.0.13.0.8-4.el8_5 appstream 40 M puppet-agent x86_64 8.2.0-1.el8 puppet8 27 M Transaction Summary ======================================================================================================== Install 3 Packages Total download size: 137 M Installed size: 269 M Is this ok [y/N]: y Downloading Packages: (1/3): puppet-agent-8.2.0-1.el8.x86_64.rpm 931 kB/s | 27 MB 00:29 (2/3): java-11-openjdk-headless-11.0.13.0.8-4.el8_5.x86_64.rpm 1.1 MB/s | 40 MB 00:37 (3/3): puppetserver-8.2.3-1.el8.noarch.rpm 1.6 MB/s | 71 MB 00:45 -------------------------------------------------------------------------------------------------------- Total 3.0 MB/s | 137 MB 00:45 Puppet 8 Repository el 8 - x86_64 1.6 MB/s | 1.7 kB 00:00 Importing GPG key 0x9E61EF26: Userid : "Puppet, Inc. Release Key (Puppet, Inc. Release Key) <release@puppet.com>" Fingerprint: D681 1ED3 ADEE B844 1AF5 AA8F 4528 B6CD 9E61 EF26 From : /etc/pki/rpm-gpg/RPM-GPG-KEY-2025-04-06-puppet8-release Is this ok [y/N]: y Key imported successfully Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Running scriptlet: java-11-openjdk-headless-1:11.0.13.0.8-4.el8_5.x86_64 1/1 Preparing : 1/1 Running scriptlet: puppet-agent-8.2.0-1.el8.x86_64 1/3 Installing : puppet-agent-8.2.0-1.el8.x86_64 1/3 Running scriptlet: puppet-agent-8.2.0-1.el8.x86_64 1/3 Installing : java-11-openjdk-headless-1:11.0.13.0.8-4.el8_5.x86_64 2/3 Running scriptlet: java-11-openjdk-headless-1:11.0.13.0.8-4.el8_5.x86_64 2/3 Running scriptlet: puppetserver-8.2.3-1.el8.noarch 3/3 Installing : puppetserver-8.2.3-1.el8.noarch 3/3 Running scriptlet: puppetserver-8.2.3-1.el8.noarch 3/3 usermod: no changes Running scriptlet: puppet-agent-8.2.0-1.el8.x86_64 3/3 Running scriptlet: puppetserver-8.2.3-1.el8.noarch 3/3 Verifying : java-11-openjdk-headless-1:11.0.13.0.8-4.el8_5.x86_64 1/3 Verifying : puppet-agent-8.2.0-1.el8.x86_64 2/3 Verifying : puppetserver-8.2.3-1.el8.noarch 3/3 Installed products updated. Installed: java-11-openjdk-headless-1:11.0.13.0.8-4.el8_5.x86_64 puppet-agent-8.2.0-1.el8.x86_64 puppetserver-8.2.3-1.el8.noarch Complete!
Once the installation is complete then we enable and start the Puppet service, by submitting command line :
$ sudo systemctl start puppetserver $ sudo systemctl enable puppetserver
Output :
[ramans@bckinfo ~]$ sudo systemctl start puppetserver [ramans@bckinfo ~]$ sudo systemctl enable puppetserver Created symlink /etc/systemd/system/multi-user.target.wants/puppetserver.service → /usr/lib/systemd/system/puppetserver.service. [ramans@bckinfo ~]$ sudo systemctl status puppetserver ● puppetserver.service - puppetserver Service Loaded: loaded (/usr/lib/systemd/system/puppetserver.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2023-11-05 18:49:04 PST; 27s ago Main PID: 50004 (java) Tasks: 49 (limit: 4915) Memory: 1.2G CGroup: /system.slice/puppetserver.service ├─50004 /usr/bin/java -Xms2g -Xmx2g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Sl> └─50127 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/server/data/puppetserver/dropsonde/b> Nov 05 18:48:32 bckinfo.bckinfo.com systemd[1]: Starting puppetserver Service... Nov 05 18:48:38 bckinfo.bckinfo.com puppetserver[49959]: WARNING: abs already refers to: #'clojure.core> Nov 05 18:49:04 bckinfo.bckinfo.com systemd[1]: Started puppetserver Service.
Step 3: Install Puppet for Clients
At this stage, we will install Puppet for client, for this puprose we will submit following comand line :
$ sudo dnf install puppet
Output :
[ramans@bckinfo ~]$ sudo dnf install puppet Last metadata expiration check: 0:06:09 ago on Sun 05 Nov 2023 06:44:31 PM PST. Dependencies resolved. ======================================================================================================== Package Arch Version Repository Size ======================================================================================================== Installing: puppet noarch 6.26.0-1.el8 epel 1.6 M Installing dependencies: augeas x86_64 1.12.0-6.el8 baseos 57 k boost-filesystem x86_64 1.66.0-10.el8 appstream 49 k boost-locale x86_64 1.66.0-10.el8 appstream 265 k boost-log x86_64 1.66.0-10.el8 appstream 448 k cpp-hocon x86_64 0.2.1-2.el8 epel 416 k facter x86_64 3.14.24-1.el8 epel 653 k hiera noarch 3.6.0-2.el8 epel 35 k leatherman x86_64 1.6.1-2.el8 epel 398 k libselinux-ruby x86_64 2.9-5.el8 appstream 146 k ruby x86_64 2.5.9-107.module_el8.4.0+847+ee687b6c appstream 87 k ruby-augeas x86_64 0.5.0-24.el8 epel 31 k ruby-facter x86_64 3.14.24-1.el8 epel 19 k ruby-irb noarch 2.5.9-107.module_el8.4.0+847+ee687b6c appstream 102 k ruby-libs x86_64 2.5.9-107.module_el8.4.0+847+ee687b6c appstream 2.9 M rubygem-concurrent-ruby noarch 1.1.5-2.el8 epel 254 k rubygem-deep_merge noarch 1.2.1-4.el8 epel 14 k rubygem-hocon noarch 1.3.0-1.el8 epel 96 k rubygem-httpclient noarch 2.8.0-8.el8 epel 228 k rubygem-json x86_64 2.1.0-107.module_el8.4.0+847+ee687b6c appstream 91 k rubygem-multi_json noarch 1.13.1-4.el8.1 epel 23 k rubygem-openssl x86_64 2.1.2-107.module_el8.4.0+847+ee687b6c appstream 189 k rubygem-psych x86_64 3.0.2-107.module_el8.4.0+847+ee687b6c appstream 95 k rubygem-puppet-resource_api noarch 1.8.13-1.el8 epel 34 k rubygem-semantic_puppet noarch 1.0.2-1.el8 epel 20 k rubygems noarch 2.7.6.3-107.module_el8.4.0+847+ee687b6c appstream 308 k yaml-cpp x86_64 0.6.2-3.el8 epel 171 k Installing weak dependencies: rubygem-bigdecimal x86_64 1.3.4-107.module_el8.4.0+847+ee687b6c appstream 97 k rubygem-did_you_mean noarch 1.2.0-107.module_el8.4.0+847+ee687b6c appstream 81 k rubygem-io-console x86_64 0.4.6-107.module_el8.4.0+847+ee687b6c appstream 67 k rubygem-rdoc noarch 6.0.1.1-107.module_el8.4.0+847+ee687b6c appstream 456 k Enabling module streams: ruby 2.5 Transaction Summary ======================================================================================================== Install 31 Packages Total download size: 9.4 M Installed size: 32 M Is this ok [y/N]: y Downloading Packages: (1/31): boost-log-1.66.0-10.el8.x86_64.rpm 572 kB/s | 448 kB 00:00 (2/31): boost-locale-1.66.0-10.el8.x86_64.rpm 336 kB/s | 265 kB 00:00 (3/31): boost-filesystem-1.66.0-10.el8.x86_64.rpm 51 kB/s | 49 kB 00:00 (4/31): libselinux-ruby-2.9-5.el8.x86_64.rpm 339 kB/s | 146 kB 00:00 (5/31): ruby-2.5.9-107.module_el8.4.0+847+ee687b6c.x86_64.rpm 176 kB/s | 87 kB 00:00 (6/31): ruby-irb-2.5.9-107.module_el8.4.0+847+ee687b6c.noarch.rpm 95 kB/s | 102 kB 00:01 (7/31): rubygem-bigdecimal-1.3.4-107.module_el8.4.0+847+ee687b6c.x86_64 102 kB/s | 97 kB 00:00 (8/31): rubygem-did_you_mean-1.2.0-107.module_el8.4.0+847+ee687b6c.noar 178 kB/s | 81 kB 00:00 (9/31): rubygem-json-2.1.0-107.module_el8.4.0+847+ee687b6c.x86_64.rpm 173 kB/s | 91 kB 00:00 (10/31): rubygem-io-console-0.4.6-107.module_el8.4.0+847+ee687b6c.x86_6 71 kB/s | 67 kB 00:00 (11/31): rubygem-psych-3.0.2-107.module_el8.4.0+847+ee687b6c.x86_64.rpm 155 kB/s | 95 kB 00:00 (12/31): rubygem-openssl-2.1.2-107.module_el8.4.0+847+ee687b6c.x86_64.r 235 kB/s | 189 kB 00:00 (13/31): ruby-libs-2.5.9-107.module_el8.4.0+847+ee687b6c.x86_64.rpm 1.0 MB/s | 2.9 MB 00:02 (14/31): augeas-1.12.0-6.el8.x86_64.rpm 155 kB/s | 57 kB 00:00 (15/31): rubygem-rdoc-6.0.1.1-107.module_el8.4.0+847+ee687b6c.noarch.rp 447 kB/s | 456 kB 00:01 (16/31): rubygems-2.7.6.3-107.module_el8.4.0+847+ee687b6c.noarch.rpm 309 kB/s | 308 kB 00:00 (17/31): cpp-hocon-0.2.1-2.el8.x86_64.rpm 640 kB/s | 416 kB 00:00 (18/31): hiera-3.6.0-2.el8.noarch.rpm 81 kB/s | 35 kB 00:00 (19/31): leatherman-1.6.1-2.el8.x86_64.rpm 1.6 MB/s | 398 kB 00:00 (20/31): ruby-augeas-0.5.0-24.el8.x86_64.rpm 164 kB/s | 31 kB 00:00 (21/31): facter-3.14.24-1.el8.x86_64.rpm 850 kB/s | 653 kB 00:00 (22/31): ruby-facter-3.14.24-1.el8.x86_64.rpm 170 kB/s | 19 kB 00:00 (23/31): rubygem-deep_merge-1.2.1-4.el8.noarch.rpm 124 kB/s | 14 kB 00:00 (24/31): rubygem-concurrent-ruby-1.1.5-2.el8.noarch.rpm 1.3 MB/s | 254 kB 00:00 (25/31): rubygem-hocon-1.3.0-1.el8.noarch.rpm 699 kB/s | 96 kB 00:00 (26/31): rubygem-multi_json-1.13.1-4.el8.1.noarch.rpm 106 kB/s | 23 kB 00:00 (27/31): rubygem-httpclient-2.8.0-8.el8.noarch.rpm 711 kB/s | 228 kB 00:00 (28/31): puppet-6.26.0-1.el8.noarch.rpm 1.7 MB/s | 1.6 MB 00:00 (29/31): rubygem-puppet-resource_api-1.8.13-1.el8.noarch.rpm 191 kB/s | 34 kB 00:00 (30/31): rubygem-semantic_puppet-1.0.2-1.el8.noarch.rpm 140 kB/s | 20 kB 00:00 (31/31): yaml-cpp-0.6.2-3.el8.x86_64.rpm 955 kB/s | 171 kB 00:00 -------------------------------------------------------------------------------------------------------- Total 1.2 MB/s | 9.4 MB 00:07 Running transaction check Transaction check succeeded.
Then we will start and enable Puppet client, by submitting command line :
$ sudo systemctl start puppet $ sudo systemctl enable puppet
Ouput :
[ramans@bckinfo ~]$ sudo systemctl start puppet [ramans@bckinfo ~]$ sudo systemctl enable puppet Created symlink /etc/systemd/system/multi-user.target.wants/puppet.service → /usr/lib/systemd/system/puppet.service. [ramans@bckinfo ~]$ sudo systemctl status puppet ● puppet.service - Puppet agent Loaded: loaded (/usr/lib/systemd/system/puppet.service; enabled; vendor preset: disabled) Active: active (running) since Sun 2023-11-05 19:06:35 PST; 16s ago Docs: man:puppet-agent(8) Main PID: 51169 (puppet) Tasks: 1 (limit: 23535) Memory: 73.2M CGroup: /system.slice/puppet.service └─51169 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/puppet agent --no-daemoni>
Step 4 : Configuring Filrewall
At the master server, it must have port 8140 opened to allow for incoming connections from the remote clients. We will configure the firewall to let agents can connect to the master.
$ sudo firewall-cmd --permanent --add-port=8140/tcp $ sudo firewall-cmd --reload
Conclusion
Puppet is a robust configuration management and automation tool that has revolutionized the way organizations manage their IT infrastructure. By adopting Infrastructure as Code principles and using Puppet, businesses can achieve consistent, scalable, and efficient infrastructure management. Its declarative language, cross-platform support, and rich ecosystem of modules make it a go-to choice for many in the DevOps world. As IT environments continue to grow in complexity, Puppet remains a valuable asset in achieving automation, reliability, and security in infrastructure management.