MYHOSPITALNOW.COM

Find Trusted Doctors & Hospitals

Discover healthcare providers, compare hospitals, and explore treatment options worldwide.

Free Treatment Quotes • Doctor Search • Hospital Comparison

Find Healthcare Options

www.myhospitalnow.com

Puppet Tutorials: Installing and Configure Puppet Server & Agent

This guide installs Puppet Server 7 on RHEL 8 or CentOS 8, installs the Puppet agent on RHEL and Ubuntu nodes, and connects each agent to the server by signing its certificate. The original steps are shown first. Below them you'll find corrected commands, a first manifest to test the setup, and fixes for the errors people run into most often.


Setting up Puppet Server in RHEL 8 / CENTOS 8

Setting up Puppet Agent in Linux

Configure Puppet Agent with Server


How the setup works and what you need

Puppet uses a client-server model. The Puppet Server compiles catalogs and also acts as the certificate authority (CA). Each agent sends the server a certificate signing request. After the request is signed, the agent connects over HTTPS on TCP port 8140, sends its facts, gets back a catalog and applies it. By default the agent repeats this every 30 minutes.

RequirementWhy it matters
Server: 2 vCPU and at least 2โ€“4 GB RAMPuppet Server runs on the JVM. It starts with a 2 GB heap by default, so it may not start on smaller VMs.
Name resolution for every nodeAgents look for the server by name (puppet by default). Certificates are bound to hostnames.
Synchronised clocks (chrony/NTP)If the clocks are too far apart, SSL validation fails because certificates look not yet valid or already expired.
Port 8140/tcp open on the serverAll agent-to-server traffic uses this port.
Root or sudo accessPuppet settings, certificates and services live in system paths.
Same Puppet major version on server and agentsMixing versions (for example Puppet 6 agents with a Puppet 7 server) is a common cause of avoidable problems.

Note: Set the final hostname before the first start of puppetserver. On first start the server creates its CA and its own certificate from the current hostname. If you rename the host afterwards, you will need to regenerate those certificates.

Corrected Puppet Server installation (RHEL 8 / CentOS 8)

This version of the server steps adds what the gist leaves out: time sync, a firewall rule, enabling the service at boot, and an optional heap adjustment for small lab VMs. Run each command with sudo, or as root.

# 1. Hostname and name resolution (add the same /etc/hosts entries on every node)
sudo hostnamectl set-hostname puppet
echo '20.163.145.158  puppet' | sudo tee -a /etc/hosts
echo '172.173.236.231 agent1' | sudo tee -a /etc/hosts

# 2. Time sync
sudo dnf install -y chrony
sudo systemctl enable --now chronyd

# 3. Puppet 7 repository and server package
sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-8.noarch.rpm
sudo dnf install -y puppetserver

# 4. Optional on small VMs: lower the default 2g heap
sudo sed -i 's/-Xms2g -Xmx2g/-Xms1g -Xmx1g/' /etc/sysconfig/puppetserver

# 5. Open the Puppet port
sudo firewall-cmd --permanent --add-port=8140/tcp
sudo firewall-cmd --reload

# 6. Start now and on every boot
sudo systemctl enable --now puppetserver

# 7. Load /opt/puppetlabs/bin into PATH and verify
source /etc/profile.d/puppet-agent.sh
puppetserver -v
sudo systemctl status puppetserverCode language: PHP (php)

The first start can take a minute or more while the JVM warms up. When the server is ready, systemctl status shows active (running) and port 8140 is listening. You can check the port with sudo ss -tlnp | grep 8140.

Note: On RHEL, the secure_path setting for sudo does not include /opt/puppetlabs/bin. As a result, sudo puppetserver ... or sudo puppet ... often fails with command not found. Run these commands with the full path, for example sudo /opt/puppetlabs/bin/puppetserver, or from a root shell after sourcing the profile script.

Corrected Puppet agent installation (RHEL and Ubuntu)

Install the agent from the same Puppet major version as the server. The original installs Puppet 6 on RHEL 7 and on Ubuntu 18.04 (bionic). Puppet 6 is end of life and so is Ubuntu 18.04, so both are replaced below.

# --- RHEL / CentOS / Rocky / Alma 8 ---
sudo hostnamectl set-hostname agent1
sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-8.noarch.rpm
sudo dnf install -y puppet-agent

# --- RHEL / CentOS 7 ---
sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-7.noarch.rpm
sudo yum install -y puppet-agent

# --- Ubuntu 22.04 (jammy); use focal for 20.04 ---
wget https://apt.puppetlabs.com/puppet7-release-jammy.deb
sudo dpkg -i puppet7-release-jammy.deb
sudo apt-get update          # missing in the original; required after adding the repo
sudo apt-get install -y puppet-agentCode language: PHP (php)

Don't start the puppet service yet. The original starts and enables it straight after installation, before the server is configured or the certificate is signed. The agent then begins retrying in the background, which makes the first manual run harder to follow. Configure and bootstrap first, as described in the next section, and then enable the service.

Connecting the agent and signing its certificate

  1. On the agent, as root, point it at the server: sudo /opt/puppetlabs/bin/puppet config set server puppet --section main. If you run this without root, the setting goes into the user's ~/.puppetlabs config, and the system agent never reads it.
  2. Request a certificate: sudo /opt/puppetlabs/bin/puppet ssl bootstrap. This command waits and retries until the request is signed, so leave it running.
  3. On the server, list pending requests: sudo /opt/puppetlabs/bin/puppetserver ca list.
  4. Sign the request using the exact certname shown in the list: sudo /opt/puppetlabs/bin/puppetserver ca sign --certname agent1.
  5. Back on the agent, puppet ssl bootstrap finishes on its own. Then run the agent once in the foreground: sudo /opt/puppetlabs/bin/puppet agent -t.
  6. Enable the background service only now: sudo systemctl enable --now puppet.
$ sudo /opt/puppetlabs/bin/puppetserver ca list
Requested Certificates:
    agent1       (SHA256)  3B:9A:...:F1

$ sudo /opt/puppetlabs/bin/puppetserver ca sign --certname agent1
Successfully signed certificate request for agent1Code language: PHP (php)

The certname defaults to the agent's FQDN. If the host has a DNS domain, the request appears as something like agent1.example.com, and you must sign that full name.

Verify with a first manifest

A fresh server has no code, so the first agent run applies an empty catalog. To confirm the whole chain works, add a small manifest on the server:

# On the server: /etc/puppetlabs/code/environments/production/manifests/site.pp
node default {
  file { '/tmp/puppet-was-here':
    ensure  => file,
    content => "Managed by Puppet\n",
  }
}Code language: PHP (php)
$ sudo /opt/puppetlabs/bin/puppet agent -t
Info: Using environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for agent1
Info: Applying configuration version '1732999999'
Notice: /Stage[main]/Main/Node[default]/File[/tmp/puppet-was-here]/ensure: defined content as '{sha256}...'
Notice: Applied catalog in 0.03 seconds

$ cat /tmp/puppet-was-here
Managed by PuppetCode language: JavaScript (javascript)

Run the agent a second time and no changes should be reported. That means the node is in the desired state. Exit code 2 from puppet agent -t means changes were applied, 0 means nothing changed, and 4 or 6 means some resources failed.

Common errors and fixes

SymptomLikely causeFix
puppetserver fails to start, or journal shows OutOfMemoryError / killedDefault 2 GB heap is larger than the VM can provideLower -Xms/-Xmx in /etc/sysconfig/puppetserver (RHEL) or /etc/default/puppetserver (Debian/Ubuntu), then restart
Connection refused or timeout on port 8140Service not running or firewall blockingsystemctl status puppetserver; open 8140/tcp with firewall-cmd; test with curl -k https://puppet:8140
Could not resolve 'puppet' / getaddrinfo errorsMissing DNS or /etc/hosts entryAdd the server entry on every agent, or set server to the server's real FQDN
certificate verify failed or certificate not yet validClock skew, or stale certificates after a rename or rebuildFix time sync. On the server, run puppetserver ca clean --certname agent1. On the agent, run puppet ssl clean, then bootstrap again
sudo: puppet: command not found/opt/puppetlabs/bin is not in sudo's secure_pathUse full paths, or work from a root shell
Agent request never shows in ca listAgent is using a different server or config fileRun sudo /opt/puppetlabs/bin/puppet config print server certname --section agent

For deeper troubleshooting, the debug commands at the end of the gist work as written with open source Puppet, even though the comment there mentions PE. Use --http_debug for connection problems and --evaltrace to see how long each resource takes.

Best practices and security notes

  • Check the fingerprint before you sign a request. Compare it with the output of puppet ssl verify or the request fingerprint shown on the agent.
  • Avoid autosign = true in production. If you need automation, use a policy-based autosign script, or an autosign.conf limited to trusted name patterns on a trusted network.
  • Use real FQDNs and DNS rather than /etc/hosts once you have more than a few nodes. Hosts files tend to drift out of sync.
  • Keep Puppet code in Git and deploy it to /etc/puppetlabs/code/environments with a tool such as r10k. Don't edit site.pp directly on the server.
  • Pin the same major version on the server and the agents, and upgrade the server first.
  • Revoke and clean the certificates of decommissioned nodes with puppetserver ca clean --certname <name> so they can no longer connect.

Note: Since 2025, Perforce has changed how open source Puppet packages are distributed. Newer builds are published through a separate channel with its own terms. The community also maintains a fully open source fork called OpenVox. Before you build new infrastructure on the yum.puppet.com and apt.puppetlabs.com repositories used above, check what they currently provide.

Frequently asked questions

Which port does Puppet Server use?

Puppet Server listens on TCP port 8140. Agents connect to it over HTTPS, so open that port on the server's firewall and on any network security groups in between.

How do I re-sign a Puppet agent certificate after rebuilding the node?

On the server, run puppetserver ca clean --certname <agent>. On the agent, run puppet ssl clean. Then run puppet ssl bootstrap on the agent again and sign the new request on the server.

How often does the Puppet agent apply configuration?

When the puppet service is running, the agent checks in every 30 minutes by default. Change this with the runinterval setting in puppet.conf. To trigger a run straight away, use puppet agent -t.

Can a Puppet 6 agent connect to a Puppet 7 server?

Older agents can often talk to a newer server, but it is not a supported long-term setup. Puppet 6 is also end of life, so install the same major version on the agents as on the server.

Why does puppetserver fail to start on a small VM?

Puppet Server is a JVM application, and by default it reserves a 2 GB heap. On a VM with 2 GB of RAM or less, lower the -Xms and -Xmx values in /etc/sysconfig/puppetserver and restart the service.

Related tutorials

Find Trusted Cardiac Hospitals

Compare heart hospitals by city and services โ€” all in one place.

Explore Hospitals
I'm Rajesh Kumar, a DevOps, SRE, DevSecOps, Cloud, and Platform Engineering expert passionate about sharing practical knowledge, real-world experiences, and industry best practices. I have worked at Cotocus and regularly write about technology, travel, investing, health, product reviews, and digital marketing through my various platforms. I publish technical articles at DevOps School, travel stories at Holiday Landmark, stock market insights at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at TrueReviewNow, and SEO and digital marketing strategies at Wizbrand.

Related Posts

How to install Ansible in Centos 7/RHEL 7?

On CentOS 7 or RHEL 7 you can install Ansible in two ways: with yum from the EPEL repository, which gives you Ansible 2.9, or with pip…

Read More

Kibana 7.2 Install and configuration in RHEL 7/Centos

This guide covers installing Kibana 7.2 on RHEL 7 or CentOS 7 from the tar.gz archive, pointing it at an Elasticsearch cluster in kibana.yml, and starting it….

Read More

Principal Linux Administrator: Role Blueprint, Responsibilities, Skills, KPIs, and Career Path

The Principal Linux Administrator is the enterprise technical authority for Linux platforms within Enterprise IT, accountable for the reliability, security, standardization, and automation of Linux-based infrastructure that underpins business-critical applications and services. This is a senior individual contributor (IC) role with broad decision influence, responsible for setting Linux engineering standards, guiding platform roadmaps, and solving high-severity or high-complexity problems that span teams and domains.

Read More

Docker Tutorials: Installation and Configurations

Docker Installation in Centos/RHEL Method -1: How to install Docker Community Edition via YUM? Step 1 – Install required packages. yum-utils provides the yum-config-manager utility, and device-mapper-persistent-data…

Read More

What is yum and use cases of yum?

What is yum? yum, short for Yellowdog Updater Modified, is a command-line package management utility for RPM (Red Hat Package Manager)-based Linux distributions, such as CentOS and…

Read More

Git Install and Upgrade from Source in RHEL / CENTOS

This tutorial will help you to install git 2.9.5 on CentOS/RHEL 7/6/5 and Fedora 26/25/24 operating systems using the source code. Step 1 โ€“ Install Required Packages…

Read More
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
0
Would love your thoughts, please comment.x
()
x