How to Run Puppet 7 Server on Rocky Linux/Centos 8 2022

This tutorial is about how to run Puppet 7 server on Rocky Linux/Centos 8. We will try our best for you to understand this guide. I hope you will like this blog How to Run Puppet 7 Server on Rocky Linux/Centos 8. If your answer is yes, please share after reading this.
Contents

Check How to Run Puppet 7 Server on Rocky Linux/Centos 8

Chef Infra is one of the popular open-source infrastructure-as-code (IAC) tools used to configure, manage, and deploy server resources in networks. CHEF is written in the Ruby and Erlang languages ​​and is released under the Apache 2.0 license.

How to Run Puppet 7 Server on Rocky Linux/Centos 8

Make sure the servers are up to date

Before we continue, let’s make sure the server packages are up to date with the following command:

sudo dnf -y update

Set the host name. Puppet uses server hostnames to send manifests to nodes. Connect with the puppeteer.

The configured host name

sudo hostnamectl set-hostname puppetmaster.citizix.com Make sure the hostname has a proper DNS record and also update the /etc/hosts file.

sudo vim /etc/hostsAdd this content:

10.2.40.54 puppetmaster.citizix.com puppetmasterConfirm that the hostname reflects:

$ Sudo hostnamectlStatic hostname: Name puppetmaster.citizix.comIcon: Computer-vmChassis: vmMachine ID: ee3563997878469ebfcc3f721aec3c66Boot id: 2f916497602e4ecabe551a72b3f4ad74Virtualization: kvmOperating System: System kvmOperating 4 o.cpe Name: rock: Rock o.8 CPE: rocky Linux 8.4 (Obsidian): General purpose kernel: Linux 4.18.0-305.3.1.el8_4.x86_64 Architecture: x86-64

Disable SELinux

Modify the SELinux configuration using vim.

vim /etc/sysconfig/selinux Change the value of SELINUX to ‘disabled’.

SELINUX=permissive

Save and exit. You will need to reboot for the changes to take effect. To apply changes without restarting, use this command:

sudo setenforce 0

Install Puppet Server

Enabling the Puppet Platform repository makes the components needed for installation available on your system.

sudo dnf install https://yum.puppet.com/puppet7-release-el-8.noarch.rpmPuppet Server is a required application that runs on the Java Virtual Machine (JVM) on the main server.

In addition to hosting endpoints for the CA service, Puppet Server also powers the Catalog Builder, which compiles configuration catalogs for agent nodes, using Puppet code and other data sources. . In this section, you will install the Puppet Server package and start the service. Install the Puppet Server package.

sudo dnf install -y puppet server

Configure puppet master and agent

Once the installation is complete, we need to configure the memory allocation for the puppet server. We will set the maximum memory allocation for the puppet server to 1 GB. Modify the ‘puppetserver’ configuration using vim.

sudo vim /etc/sysconfig/puppetserver Now change the line as shown below, then save and exit.

JAVA_ARGS=”-Xms1g -Xmx1g …”Set Puppet Master DNS and FQDN Alternate Names:

sudo vim /etc/puppetlabs/puppet/puppet.conf Add the DNS configuration in the section.

vardir = /opt/puppetlabs/server/data/puppetserverlogdir = /var/log/puppetlabs/puppetserverrundir = /var/run/puppetlabs/puppetserverpidfile = /var/run/puppetlabs/puppetserver/puppetserver.pidcodedir = /etc/puppetlabs/codens_alt_names =puppetmaster.citizix,puppetmasterAdd Parent Section – This is the Puppet agent configuration.

certname=puppetmaster.citizix.comserver=puppetmaster.citizix.comenvironment=productionruninterval=30m

Start and activate the puppet service

Once the installation and configuration is complete, we can start the puppet server using this command:

sudo systemctl start puppetserver Check the status of puppetserver using this command:

$ sudo systemctl status puppetserver● puppetserver.service – puppetserver ServiceLoaded: loaded (/usr/lib/systemd/system/puppetserver.service; disabled; default provider: disabled) Active: active (running) since Thursday 18 November 2021: 47:34 UTC; 1 min 0 s ago Process: 132886 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exit, status=0/SUCCESS) Main PID: 132913 (java) Tasks: 45 (limit : 4915 ) Memory: 988.9MCGroup: /system.slice/puppetserver.service132913 /usr/bin/java -Xms2g -Xmx2g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger -XX:OnOutOfMemoryError=kill -9 %p – XX: ErrorFile=/var/log/puppetlabs/puppetserver/puppetserver_err_pid%p.log -cp /opt/puppet>

Nov 04 18:47:09 puppetmaster.citizix.com systemd: Puppet Server service started… Nov 04 18:47:34 puppet.citizix.com systemd: Puppet Server service started. Check if you have correctly installed the puppet server by running: puppet server -v

puppetserver -vpuppetserver version: 7.4.1 You can now enable the puppet server to always start on boot:

sudo systemctl enable puppet server

Open the service port on the firewall

Once the service is started, open the port in the firewall so that you can access the server from the network. This is only necessary if you are applying firewall rules and firewalld is installed.

sudo firewall-cmd –add-port=8140/tcp –permanent sudo firewall-cmd –reload

Add Puppet Binary folder to $PATH

The puppet binaries are located in /opt/puppetlabs/bin. This default directory is not in your $PATH.

echo ‘export PATH=$PATH:/opt/puppetlabs/bin’ | tee -a ~/.bashrcsource ~/.bashrc9. Start the puppet client

Let’s start the puppet agent service as we will be using it for some testing. Let’s register the puppet agent with the puppeteer.

Start the puppet agent

sudo systemctl start puppet Check the status with this command:

$ sudo systemctl status puppet● puppet.service – Puppet Agent Loaded: loaded (/usr/lib/systemd/system/puppet.service; disabled; default provider: disabled) Active: active (running) since Fri 05/2021/11:37:08 UTC; 15s ago Main PID: 142622 (puppet) Tasks: 1 (limit: 23168) Memory: 52.6 MCGroup: /system.slice/puppet.service142622 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs /puppet/bin/ puppet agent -undemonized

Nov 05 07:37:08 puppetmaster.citizix.com systemd: Puppet agent has started. Nov 05 07:37:09 puppetmaster.citizix.com puppet-agent: Starting with Puppet client version 7.12.0 Nov 05 07:37:11 puppetmaster.citizix.com puppet-agent: Catalog applied in 0.02 seconds10 . Check the configuration of the puppet agent

Once the puppeteer has signed the certificate file for the agent, run the following command on the puppet agent to verify the settings

#puppet-agent –testInfo: ‘production’ environment usage info: fetching pluginfactsInfo: fetching pluginInfo: catalog caching for puppetmaster.citizix.comInfo: app config version ‘1636097982’

The puppet agent pulled the configuration from the puppeteer and applied it to the server without any errors.

Create a Simple Manifest to Deploy Nginx

With the agent and puppet master installed and configured, let’s create a simple manifest to test. We will create a manifest to install the Nginx web server. The puppet manifest will be stored in the environment specific directory at path /etc/puppetlabs/code/environments/. We’ve defined production in our case, so let’s jump into the production manifests directory using this.

cd /etc/puppetlabs/code/environments/production/manifests Create a new manifest file.

vim site.pp Paste the following configuration.

node ‘puppetmaster.citizix.com’ {package { ‘nginx’:ensure => “installed”,}service { ‘nginx’:ensure => running,enable => true}}Save and exit.

Now open the puppet agent server shell and run the following command.

puppet agent -t

The command retrieves a new puppeteer manifest configuration file and then applies it to the agent server. Here is the result.

# puppet agent –test

Info: using ‘production’ environment Info: retrieving pluginfacts Info: retrieving plugin Info: caching catalog for puppetmaster.citizix.com Info: app config version ‘1636098770’ Notice: / Stage/Main/Node/Package/ensure: createdWarning: /Stage /Main/Node/Service/ensure: ensure ‘stopped’ has been changed to ‘running’ Info: /Stage/Main/Node/Service: Unscheduling the update in the Service

You can check Nginx using this command:

# sudo systemctl status nginx● nginx.service – The nginx HTTP server and reverse proxy Loaded – Loaded (/usr/lib/systemd/system/nginx.service; enabled; default provider: disabled) Active – Active (running execution) from Friday 2021 – 11-05 07:53:49 UTC; 57 s ago Main PID: 144600 (nginx) Tasks: 3 (limit: 23168) Memory: 6.1MCGroup: /system.slice/nginx.service144600 nginx: main process /usr/sbin/nginx144602 nginx: worker 144603 nginx: process working

Nov 05 07:53:49 puppetmaster.citizix.com systemd: Starting nginx HTTP server and reverse proxy server… Nov 05 07:53:49 puppetmaster.citizix.com nginx: nginx: /etc/nginx configuration file syntax /nginx.conf is ok Nov 05 07:53:49 puppetmaster.citizix.com nginx: nginx: /etc/nginx/nginx.conf config file test passedNov 05 07:53:49 puppetmaster.citizix.com systemd: Started The nginx HTTP and reverse proxy server.

Final Words: How to Run Puppet 7 Server on Rocky Linux/Centos 8

Hope you understand this article How to Run Puppet 7 Server on Rocky Linux/Centos 8, if your answer is no, you can ask anything via the contact forum section linked to this article. And if your answer is yes, share this article with your family and friends.