How to Setup Puppet Master and Agent on CentOS 8

Puppet is an open source configuration management and server automation framework. Puppet can run on all Linux/unix and Microsoft Windows systems. It allows you to manage and perform administrative tasks and the configuration of multiple systems from one master server.

In this article, you will learn how to install Puppet on CentOS 8. I will install and configure a CentOS 8 server as a puppet 'master', and the other one as an 'agent'.


  • 2 CentOS 8 servers
    • 0.0.14    4 GB Memory
    • 0.0.15 3 GB RAM
  • Root privileges

What we will do:

  1. Puppet Pre-Installation
  2. Install and Configure Puppet server
  3. Install and Configure Puppet Agent
  4. Verify Puppet Agent Configuration
  5. Create First Puppet Manifest

Step 1 - Puppet Pre-Installation

In this step, we will perform some tasks including installation and configuration on both servers puppet master and puppet agent. We will configure the host's file, synchronizing time using the NTP server, Disable SELinux, and add the puppet repository to the system.

  1. Configure hosts on both machines by editing the hosts using vim
# vim /etc/hosts

Add the following configuration to the end of the line. [caption id="attachment_6210" align="aligncenter" width="735"]host-file-for-puppet host-file-for-puppet[/caption]
  1. Now test using the ping command on both machines to verify the connectivity
# ping
# ping
  1. Configure NTP Server. It's very important to keep in synchronization the time between master and agent server. Install the chrony packages on both servers using the dnf

# dnf -y install chrony
  • Edit the /etc/chrony.conf file and add, change, or remove the following.

server iburst
server iburst
server iburst

  • To enable agent to connect to the chrony on puppet master, change chrony.conf :
  • Adjust Firewall Setting

# firewall-cmd --add-service=ntp --permanent 
# firewall-cmd --reload 


  • Restart the NTP service:
# systemctl enable chronyd.service

# systemctl restart chronyd.service
  1. Disable SELinux. Edit the SELinux configuration using vim.
# vi /etc/sysconfig/selinux

Change the SELINUX value to 'disabled'.


Save and exit.

  1. Add Puppet Repository on both machines using the rpm command.
# rpm –Uvh
  1. When it is complete, reboot both servers.

Step 2 - Install and Configure Puppetserver

  1. Let us install the


    on the server using the


# dnf -y install puppetserver
  1. Configure the max memory allocation of 2GB for puppetserver by editing the 'puppetserver' configuration.
# vi /etc/sysconfig/puppetserver

change/verify the line as below.

JAVA_ARGS="-Xms2g –Xmx2g "

Save and exit.

  1. Go to the puppet configuration directory and edit the 'puppet.conf' file.
# cd /etc/puppetlabs/puppet
# vi puppet.conf

Add the following configuration.

certname =
server =
environment = production
runinterval = 1h

Save and exit.

  1. Now start the puppetserver and enable it to launch at boot time.
# systemctl start puppetserver
# systemctl enable puppetserver

The Puppetserver installation and configuration has been completed successfully.

  1. If you're using firewalld on your system, add the puppetserver port to the list using the firewall-cmd following command.
# firewall-cmd --add-port=8140/tcp --permanent
# firewall-cmd --reload

Step 3 - Install and Configure Puppet Agent

  1. Install the puppet agent on the '' server using the dnf command.
# dnf install -y puppet-agent
  1. After the installation is complete, go to the puppet configuration directory and edit the puppet.conf file.
# cd /etc/puppetlabs/puppet
# vi puppet.conf

Paste the following configuration.

certname =
server =
environment = production
runinterval = 1h

Save and exit.

  1. Register the puppet agent to the puppet master by runing the following command on the puppet agent shell.
# /opt/puppetlabs/bin/puppet resource service puppet ensure=running enable=true

The puppet agent is now running on the server, and it's attempting to register itself to the puppet master.

  1. Now back to the puppet master shell and run the following command.
# /opt/puppetlabs/bin/puppet cert list

You will get the pending Certificate Signing Request (CSR) from the puppet agent server ''.

  1. Sign the certificate using the command below.
# /opt/puppetlabs/bin/puppet cert sign

The result should be similar to the following:

[caption id="attachment_6211" align="aligncenter" width="768"]puppet-cert-sign-agent puppet-cert-sign-agent[/caption]

The puppet agent is now running on the system, and the certificate for the agent has been signed by the puppet master.

Step 4 - Verify the Puppet Agent Configuration

  1. After the puppet master signed the certificate file for the agent, run following command on the puppet agent to verify the configuration.
# /opt/puppetlabs/bin/puppet agent --test

And you will get the result as shown below.

[caption id="attachment_6212" align="aligncenter" width="447"]puppet-agent-test puppet-agent-test[/caption]


The output indicates that the Puppet agent pulled the configuration from the puppet master and applied to the server without any error.

Step 5 - Create First Manifest

  1. Let us create a simple manifest for Apache httpd web server installation for testing. On the puppet master server, go to the '/etc/puppetlabs/code/' directory and create the new manifest file 'site.pp' using vim.
# cd /etc/puppetlabs/code/environments/production/manifests

# vi site.pp node '' {
     package { 'httpd':
         ensure  => "installed",
     service { 'httpd':
         ensure => running,
     enable => true

Save and exit.

  1. Open the puppet agent server shell and run the command below.
# /opt/puppetlabs/bin/puppet agent --test

The command will retrieve new manifest configuration file from the puppet master and then apply it to the agent server.

  1. Open your web browser and type the IP address of the puppet agent,

    . You will get the default HTTP page as below.
[caption id="attachment_6215" align="aligncenter" width="768"] puppet-manifet-example[/caption]

The httpd web server has been installed using the puppet manifest. Installation and configuration of the Puppet Master and Puppet Agent on CentOS 8 has been completed successfully.