Install Puppet 6.x Master / Server on CentOS 8 | RHEL 8

The
You can download this article in PDF format to support us through the following link.

Download the guide as a PDF

turn off
The

The
The

Today, we will discuss installing Puppet Master / Server on CentOS 8. RHEL 8 Linux machine. A separate guide on the installation and configuration of Puppet Agent will also be published. puppet Runs in an agent master control architecture, where the master control node controls the configuration information of a set of managed agent nodes.

The puppet server performs the role of master node. Puppet Server is a Ruby and Clojure application running on the Java Virtual Machine (JVM) and provides the same services as the classic Puppet main application. It is mainly achieved by running existing Puppet main code in several JRuby interpreters, but it replaces some parts of the classic application with new services written in Clojure.

There are two versions of Puppet:

If you want to use the Puppet Enterprise version, its architecture is shown below.

The Puppet platform contains the following components:

Package Contents
puppetserverPuppet server. This controls the configuration information of a set of managed agent nodes
puppetdbPuppetDB-collects data generated by Puppet. It enables advanced Puppet features, such as exported resources.
puppet-agentPuppet, Facter, Hiera, PXP proxy, root certificates and prerequisites such as Ruby and Augeas. The agent runs on any node in the Puppet cluster.
puppetdb-terminiPlugin for connecting your host to PuppetDB

Install Puppet 6.x Master on CentOS 8 / RHEL 8

There are multiple ways to install Puppet Master on CentOS 8 Linux system. The common and easiest way is to extract the required packages from the YUM repository provided and maintained by Puppet.

Step 1: Update the CentOS machine

Make sure your CentOS 8 machine has been updated:

sudo dnf -y update
sudo dnf -y install wget curl vim bash-completion

Since the update includes the latest kernel software package, if there are no critical applications running, consider rebooting the computer.

sudo systemctl reboot

Step 2: Set the system host name and set the time

Set a correct host name for your machine.

sudo hostnamectl set-hostname puppetmaster.example.com

Make sure the hostname has the correct DNS record, and update the / etc / hosts file.

echo "192.168.122.12 puppetmaster.example.com puppetmaster" | sudo tee -a /etc/hosts

where:

  • 192.168.122.12 Is the IP address of the Puppet server
  • puppetmaster.example.com Is the FQDN of the Puppet server

Restart the service named after the host.

sudo systemctl restart systemd-hostnamed

Log out and log in again to confirm the host name.

$ exit
$ hostname
puppetmaster.example.com

Configure timing NTP

$ sudo dnf -y install chrony
$ sudo systemctl enable --now chronyd
$ sudo timedatectl set-timezone Africa/Nairobi --adjust-system-clock
$ sudo timedatectl set-ntp yes

Confirm that the date and time are configured correctly.

$ timedatectl 
               Local time: Sat 2020-04-18 14:33:26 EAT
           Universal time: Sat 2020-04-18 11:33:26 UTC
                 RTC time: Sat 2020-04-18 11:33:25
                Time zone: Africa/Nairobi (EAT, +0300)
System clock synchronized: yes
              NTP service: active
          RTC in local TZ: no

Step 3: Add the Puppet Yum repository

Add the required repositories by running the following command in the terminal.

sudo dnf -y install https://yum.puppet.com/puppet-release-el-8.noarch.rpm

You can also consider adding an EPEL repository:

sudo dnf -y install https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm

Step 4: Install Puppet Master / Server on CentOS 8 / RHEL 8

After configuring all prerequisites, you can start installing Puppet Master on CentOS 8 / RHEL 8 Linux.

Update the package list cache:

$ sudo dnf makecache
CentOS-8 - AppStream                                                                                                    4.2 kB/s | 4.3 kB     00:01    
CentOS-8 - Base                                                                                                         5.7 kB/s | 3.8 kB     00:00    
CentOS-8 - Extras                                                                                                       1.8 kB/s | 1.5 kB     00:00    
CentOS-8 - PowerTools                                                                                                   7.0 kB/s | 4.3 kB     00:00    
Extra Packages for Enterprise Linux 8 - x86_64                                                                           24 kB/s |  39 kB     00:01    
Puppet Repository el 8 - x86_64                                                                                         3.3 kB/s | 2.5 kB     00:00    
Metadata cache created.

The puppet repository should be in the list of available repositories in the system.

$ sudo dnf repolist
Last metadata expiration check: 0:00:30 ago on Sat 18 Apr 2020 02:36:49 PM EAT.
repo id                                                repo name                                                                                  status
AppStream                                              CentOS-8 - AppStream                                                                       5,281
BaseOS                                                 CentOS-8 - Base                                                                            2,231
PowerTools                                             CentOS-8 - PowerTools                                                                      1,533
*epel                                                  Extra Packages for Enterprise Linux 8 - x86_64                                             5,315
extras                                                 CentOS-8 - Extras                                                                             15
puppet                                                 Puppet Repository el 8 - x86_64                                                              148

You can query the list of Puppet packages available in the repository:

$ sudo dnf search puppet
Last metadata expiration check: 0:04:41 ago on Sat 18 Apr 2020 02:36:49 PM EAT.
============================================================ Name & Summary Matched: puppet ============================================================
puppetdb.noarch : Puppet Labs puppetdb
puppetdb-termini.noarch : Termini for puppetdb
puppetserver.noarch : Puppet Labs puppetserver
puppet-release.noarch : Release packages for the Puppet repository
puppet-release.noarch : Release packages for the Puppet repository
puppet6-release.noarch : Release packages for the Puppet 6 repository
python3-collectd_puppet.noarch : Collectd plugin to monitor puppet agents
puppet-agent.x86_64 : The Puppet Agent package contains all of the elements needed to run puppet, including ruby, facter, and hiera.
================================================================= Name Matched: puppet =================================================================
puppet-bolt.x86_64 : Stand alone task runner
=============================================================== Summary Matched: puppet ================================================================
pdk.x86_64 : Puppet Development Kit

Install the Puppet Master package on CentOS 8 Linux.

sudo dnf install puppetserver

Puppet Agent will be installed as a dependency:

Last metadata expiration check: 0:05:03 ago on Sat 18 Apr 2020 02:36:49 PM EAT.
Dependencies resolved.
========================================================================================================================================================
 Package                                     Architecture           Version                                             Repository                 Size
========================================================================================================================================================
Installing:
 puppetserver                                noarch                 6.10.0-1.el8                                        puppet                     60 M
Installing dependencies:
 copy-jdk-configs                            noarch                 3.7-1.el8                                           AppStream                  27 k
 java-1.8.0-openjdk-headless                 x86_64                 1:1.8.0.242.b08-0.el8_1                             AppStream                  33 M
 javapackages-filesystem                     noarch                 5.3.0-1.module_el8.0.0+11+5b8c10bd                  AppStream                  30 k
 libjpeg-turbo                               x86_64                 1.5.3-10.el8                                        AppStream                 156 k
 lua                                         x86_64                 5.3.4-11.el8                                        AppStream                 193 k
 tzdata-java                                 noarch                 2019c-1.el8                                         AppStream                 189 k
 lksctp-tools                                x86_64                 1.0.18-3.el8                                        BaseOS                    100 k
 net-tools                                   x86_64                 2.0-0.51.20160912git.el8                            BaseOS                    323 k
 puppet-agent                                x86_64                 6.14.0-1.el8                                        puppet                     25 M
Enabling module streams:
 javapackages-runtime                                               201801                                                                             

Transaction Summary
========================================================================================================================================================
Install  10 Packages

Total download size: 119 M
Installed size: 208 M
Is this ok [y/N]: y

On RHEL 8:

Dependencies resolved.
========================================================================================================================================================
 Package                                Architecture      Version                                     Repository                                   Size
========================================================================================================================================================
Installing:
 puppetserver                           noarch            6.10.0-1.el8                                puppet                                       60 M
Installing dependencies:
 puppet-agent                           x86_64            6.14.0-1.el8                                puppet                                       25 M
 javapackages-filesystem                noarch            5.3.0-1.module+el8+2447+6f56d9a6            rhel-8-for-x86_64-appstream-rpms             30 k
 copy-jdk-configs                       noarch            3.7-1.el8                                   rhel-8-for-x86_64-appstream-rpms             27 k
 tzdata-java                            noarch            2019c-1.el8                                 rhel-8-for-x86_64-appstream-rpms            189 k
 libjpeg-turbo                          x86_64            1.5.3-10.el8                                rhel-8-for-x86_64-appstream-rpms            156 k
 lua                                    x86_64            5.3.4-11.el8                                rhel-8-for-x86_64-appstream-rpms            193 k
 java-1.8.0-openjdk-headless            x86_64            1:1.8.0.242.b08-0.el8_1                     rhel-8-for-x86_64-appstream-rpms             33 M
 lksctp-tools                           x86_64            1.0.18-3.el8                                rhel-8-for-x86_64-baseos-rpms               100 k
 avahi-libs                             x86_64            0.7-19.el8                                  rhel-8-for-x86_64-baseos-rpms                63 k
 cups-libs                              x86_64            1:2.2.6-28.el8                              rhel-8-for-x86_64-baseos-rpms               433 k
Enabling module streams:
 javapackages-runtime                                     201801                                                                                       

Transaction Summary
========================================================================================================================================================
Install  11 Packages

Total download size: 119 M
Installed size: 208 M
Is this ok [y/N]: y

When prompted, agree to import the GPG key.

Total                                      2.4 MB/s | 119 MB     00:48     
warning: /var/cache/dnf/puppet-caea408efb9b2853/packages/puppet-agent-6.14.0-1.el8.x86_64.rpm: Header V4 RSA/SHA256 Signature, key ID ef8d349f: NOKEY
Puppet Repository el 8 - x86_64            1.6 MB/s | 1.6 kB     00:00    
Importing GPG key 0xEF8D349F:
 Userid     : "Puppet, Inc. Release Key (Puppet, Inc. Release Key) <[email protected]>"
 Fingerprint: 6F6B 1550 9CF8 E59E 6E46 9F32 7F43 8280 EF8D 349F
 From       : /etc/pki/rpm-gpg/RPM-GPG-KEY-puppet-release
Is this ok [y/N]: y

Confirm the package installation:

$ rpm -qi puppetserver 
Name        : puppetserver
Version     : 6.10.0
Release     : 1.el8
Architecture: noarch
Install Date: Sat 18 Apr 2020 02:44:33 PM EAT
Group       : System Environment/Daemons
Size        : 73314128
License     : ASL 2.0
Signature   : RSA/SHA256, Tue 07 Apr 2020 09:05:06 AM EAT, Key ID 7f438280ef8d349f
Source RPM  : puppetserver-6.10.0-1.el8.src.rpm
Build Date  : Tue 07 Apr 2020 09:04:04 AM EAT
Build Host  : mesos-jenkins-4061cacede444ca0b7c075972400ef86-worker-artifacto
Relocations : / 
Packager    : Puppet Labs <[email protected]>
Vendor      : Puppet Labs <[email protected]>
URL         : http://puppet.com
Summary     : Puppet Labs puppetserver
....

Step 4: Configure Puppet Master / Server on CentOS 8 / RHEL 8

After installing Puppet Master / Server on CentOS 8, it is time to start configuration.

Define the Puppet Master FQDN and DNS alternate names:

$ sudo vim /etc/puppetlabs/puppet/puppet.conf

Add DNS settings to [master] section.

dns_alt_names=puppetmaster.example.com,puppetmaster,puppetserver

[main]
certname = puppetmaster.example.com
server = puppetmaster.example.com
environment = production
runinterval = 1h

where:

  • puppetmaster.example.com Is the FQDN of your Puppet server.

After the update, my configuration looks like this:

[master]
vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code
dns_alt_names=puppetmaster.example.com,puppetmaster,puppetserver

[main]
certname = puppetmaster.example.com
server = puppetmaster.example.com
environment = production
runinterval = 1h

Configure JVM memory allocation

The files in which you can set the minimum and maximum memory of the JVM are:

$ sudo vim /etc/sysconfig/puppetserver

By default, it is set to 2GB. Adjust based on the resources available on the computer.

JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"

Start Puppet Server on CentOS 8 / RHEL 8

After completing the basic Puppet Server configuration, start the service and set it to start at system startup.

sudo systemctl enable --now puppetserver

If you have already started before, please restart after modification.

sudo systemctl restart puppetserver

Check the service status to confirm that it is running.

$ systemctl status puppetserver
● puppetserver.service - puppetserver Service
   Loaded: loaded (/usr/lib/systemd/system/puppetserver.service; enabled; vendor preset: disabled)
   Active: active (running) since Sat 2020-04-18 14:56:58 EAT; 18s ago
  Process: 4068 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS)
 Main PID: 4077 (java)
    Tasks: 42 (limit: 4915)
   Memory: 670.5M
   CGroup: /system.slice/puppetserver.service
           └─4077 /usr/bin/java -Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger -XX:OnOutOfMemoryError=kill -9 %p -cp />

Open the service port on the firewall

After the service starts, open the port on the firewall so that the server can be accessed from the network.

sudo firewall-cmd --add-service=puppetmaster --permanent
sudo firewall-cmd --reload

Use Puppet Client on CentOS 8 to confirm that the Puppet server is running:

$ sudo /opt/puppetlabs/bin/puppet agent --test --ca_server=puppetmaster.example.com 
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for puppetmaster.example.com
Info: Applying configuration version '1587211455'
Info: Creating state file /opt/puppetlabs/puppet/cache/state/state.yaml
Notice: Applied catalog in 0.01 seconds

Add Puppet Binary folder to $ PATH

Puppet binary is located / opt / puppetlabs / bin. By default, this directory is not in your $ PATH. It can be confirmed by:

$ ls /opt/puppetlabs/bin/
facter  hiera  puppet  puppetserver

$ which puppet
/usr/bin/which: no puppet in (/home/vagrant/.local/bin:/home/vagrant/bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin)

Add it to PATH:

$ vim ~/.bashrc
export PATH=$PATH:/opt/puppetlabs/bin
$ source ~/.bashrc
$ which puppet
/opt/puppetlabs/bin/puppet

Our next guide will explain how to install Puppet Agent on a computer to be managed with Puppet. And how to write a basic checklist to install software packages, add users, manage Linux services, etc.

Similar guidelines:

Install Ansible on CentOS / RHEL 8

How to install and configure Ansible tower on CentOS 7 / RHEL 7/8

How to set up Chef Infra server on CentOS 8 / RHEL 8

The
You can download this article in PDF format to support us through the following link.

Download the guide as a PDF

turn off
The

The
The

Sidebar