This tutorial is about How to Run Puppet 7 Server on Rocky Linux/Centos 8. Recently I updated this tutorial and will try my best so that you understand this guide. I hope you guys like this blog, How to Run Puppet 7 Server on Rocky Linux/Centos 8. If your answer is yes after reading the article, please share this article with your friends and family to support us.
Table of 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 in configuring, managing, and deploying 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 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 hostname. Puppet uses server hostnames to send manifests to nodes. Connect with the puppeteer.
The configured hostname
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: puppetmaster.citizix.comIcon name: Computer-vmChassis: vmMachine ID: ee3563997878469ebfcc3f721aec3c66Boot id: 2f916497602e4ecabe551a72b3f4ad74Virtualization: kvmOperating system: kvmOperating system: 4 o.cpe Name: rock: rock o.8 CPE: rocky Linux 8.4 (obsidian) : GA Kernel : Linux 4.18.0-305.3.1.el8_4.x86_64 Architecture: x86-64
Disable SELinux
Edit SELinux configuration using vim.
vim /etc/sysconfig/selinuxChange the value of SELINUX to ‘disabled’.
SELINUX=permissive
Save and exit. You will need to reboot for the changes to take effect. To apply the changes without rebooting, use this command:
sudo setenforce 0
Install the puppet server
Enabling the Puppet Platform repository makes the components necessary for the 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. Edit 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 …”Define Puppet Master DNS and FQDN Alternative Names:
sudo vim /etc/puppetlabs/puppet/puppet.conf Add the DNS configuration in the [server] section.
[server]vardir = /opt/puppetlabs/server/data/puppetserverlogdir = /var/log/puppetlabs/puppetserverrundir = /var/run/puppetlabs/puppetserverpidfile = /var/run/puppetlabs/puppetserver/puppetserver.pidcodedir = /etc/puppetlabs/codedns_alt_names =puppetmaster.citizix,puppetmasterAdd Parent Section – This is the puppet agent configuration.
[main]certname=puppetmaster.citizix.comserver=puppetmaster.citizix.comenvironment=productionruninterval=30m
Start and enable the puppet service
Once the installation and configuration is done, 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; provider default: disabled)Active: active (running) since Thursday 18 Nov 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[1]: Starting puppet server service… Nov 04 18:47:34 puppet.citizix.com systemd[1]: Puppet server service started. Check if you installed the puppet server correctly, 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 service port on firewall
With the service started, open the port in the firewall so you can access the server from the network. This is only necessary if you apply firewall rules and have firewalld installed.
sudo firewall-cmd –add-port=8140/tcp –permanentsudo 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 tests. Let’s register the puppet agent with the puppeteer.
Start 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; vendor default: disabled) Active: active (running) since Fri 05/ 2021/11:37:08 UTC; 15s ago Main PID: 142622 (puppet) Tasks: 1 (limit: 23168) Memory: 52.6MCGroup: /system.slice/puppet.service142622 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/ puppet agent –not-demonize
Nov 05 07:37:08 puppetmaster.citizix.com systemd[1]: Puppet agent started. Nov 05 07:37:09 puppetmaster.citizix.com puppet-agent[142622]: As of Puppet client version 7.12.0 Nov 5 07:37:11 puppetmaster.citizix.com puppet-agent[142623]: Catalog applied in 0.02 seconds10. Verify Puppet Agent Configuration
After 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: pluginfactsInfo retrieval: pluginInfo retrieval: catalog caching for puppetmaster.citizix.comInfo: configuration version app ‘1636097982’
The puppet agent pulled the puppeteer configuration and applied it to the server without any errors.
Create a simple manifest to deploy Nginx
With the installation and configuration of the agent and puppet master complete, let’s create a simple manifest for testing. We will create a manifest to install the Nginx web server. The puppet manifest will be stored in the environment specific directory at the path /etc/puppetlabs/code/environments/
cd /etc/puppetlabs/code/environments/production/manifestsCreate 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 will retrieve a new puppeteer manifest configuration file and then apply it to the agent server. The following is the result.
# puppet agent –test
Info: ‘production’ environment usage Info: pluginfacts retrieval Info: plugin retrieval Info: catalog caching for puppetmaster.citizix.com Info: config version app ‘1636098770’ Notice: /Stage[main]/Main/Node[puppetmaster.citizix.com]/Package[nginx]/ensure: createdWarning: /Stage[main]/Main/Node[puppetmaster.citizix.com]/Service[nginx]/ensure: make sure ‘stopped’ has been changed to ‘running’ Info: /Stage[main]/Main/Node[puppetmaster.citizix.com]/Service[nginx]: Deprogramming of the update in the Service[nginx]
You can check Nginx using this command:
# sudo systemctl status nginx● nginx.service – The nginx HTTP and reverse proxy server Loaded – Loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor default: disabled) Active – Active (running ) from Friday 2021- 11-05 07:53:49 UTC; 57s ago Main PID: 144600 (nginx) Tasks: 3 (limit: 23168) Memory: 6.1MCGroup: /system.slice/nginx.service144600 nginx: master process /usr/sbin/nginx144602 nginx: worker 144603 nginx: process of work
Nov 05 07:53:49 puppetmaster.citizix.com systemd[1]: Starting the nginx HTTP and reverse proxy server… Nov 5 07:53:49 puppetmaster.citizix.com nginx[144528]: nginx: /etc/nginx/nginx.conf config file syntax is ok Nov 5 07:53:49 puppetmaster.citizix.com nginx[144528]: nginx: /etc/nginx/nginx.conf config file test successfulNov 05 07:53:49 puppetmaster.citizix.com systemd[1]: Started The nginx HTTP and reverse proxy server.
Final remarks: How to Run Puppet 7 Server on Rocky Linux/Centos 8
I 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 related to this article. And if your answer is yes, please share this article with your friends and family to give us your support.