Table of Contents
This tip is about the how to Run Puppet 7 Server on Rocky Linux/Centos 8. So read this free guide, How to Run Puppet 7 Server on Rocky Linux/Centos 8 step by step. If you have query related to same article you may contact us.
How to Run Puppet 7 Server on Rocky Linux/Centos 8 – Guide
Chef Infra is one of the popular open source infrastructure as code (IAC) tools used in configuring, administering, and deploying server resources across networks. CHEF is written in Ruby and Erlang languages and distributed under the Apache 2.0 License.
How to Run Puppet 7 Server on Rocky Linux/Centos 8
Ensure that servers up up to the present date
Before proceeding, let’s ensure that the server packages are up so far with the following command:
sudo dnf -y update
To define up Host name. Puppet uses server hostnames to send manifests to nodes. Connect to the puppet master.
the set up 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 puppetmaster Confirm that the hostname reflects:
$ Sudo hostnamectlStatic hostname: puppetmaster.citizix.comIcon name: computer-vmChassis: vmMachine ID: ee3563997878469ebfcc3f721aec3c66Boot ID: 2f916497602e4ecabe551a72b3f4ad74Virtualization: kvmOperating System: Rocky Linux 8.4 (Green Obsidian) CPE OS Name: CPE: / o: Rocky: Rocky: 8.4 : GAKernel : Linux 4.18.0-305.3.1.el8_4.x86_64Architecture: x86-64
Disable SELinux
Edit the SELinux configuration using vim.
vim /etc/sysconfig/selinuxChange the SELINUX value 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 Puppet Server
Enabling the Puppet platform repository makes the necessary components available for installation on your system.
sudo dnf install https://yum.puppet.com/puppet7-release-el-8.noarch.rpmPuppet Server is a required application that runs in the Java Virtual Machine (JVM) on the primary server.
In addition to hosting endpoints for the CA service, Puppet Server also powers the catalog compiler, which compiles configuration catalogs for agent nodes, using Puppet code and various other data sources. In this section, you will install the puppetserver package and start the service. Install the Puppet Server package.
sudo dnf install -y puppetserver
Configure Puppet Master and Agent
After the installation is complete, we need to configure memory allocation for the puppetserver. Let’s set the maximum memory allocation for puppetserver to 1 GB. Edit the ‘puppetserver’ configuration using vim.
sudo vim /etc/sysconfig/puppetserverNow change the line as below, save and exit.
JAVA_ARGS=”-Xms1g -Xmx1g …”Set Puppet Master FQDN and DNS aliases:
sudo vim /etc/puppetlabs/puppet/puppet.confAdd DNS settings under the [server] section.
[server]vardir = /opt/puppetlabs/server/data/puppetserverlogdir = /var/log/puppetlabs/puppetserverundir = /var/run/puppetlabs/puppetserverpidfile = /var/run/puppetlabs/puppetserver/puppetserver.pidcodedir = /etc/puppetlabs/codedns_alt_names =puppetmaster.citizix,puppetmasterAdd main section – this is the puppet agent configuration.
[main]certname = puppetmaster.citizix.comserver = puppetmaster.citizix.comenvironment = productionruninterval = 30m
Starting and enabling the puppet service
After installation and configuration, we can start the puppet server using this command:
sudo systemctl start puppetserverCheck the status of the puppetserver using this command:
$ sudo systemctl status puppetserver● puppetserver.service – puppetserver ServiceLoaded: loaded (/usr/lib/systemd/system/puppetserver.service; disabled; vendor default: disabled) Active: active (running) since Thu 2021-11-04 18:47:34 UTC; 1min 0s agoProcess: 132886 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS)Primary 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 the puppetserver service…Nov 04 18:47:34 puppetmaster.citizix.com systemd[1]: Started puppetserver Service. Check that you have installed Puppet Server correctly by running: puppetserver -v
puppetserver -vpuppetserver version: 7.4.1Now you can enable puppet server to always start on boot:
sudo systemctl enable puppet server
Open the service port on the firewall
With the service started, open the port on the firewall so you can access the server over 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 Binary Puppet folder to $PATH
Puppet binaries are located in /opt/puppetlabs/bin. This directory by default is not in your $PATH.
echo ‘export PATH=$PATH:/opt/puppetlabs/bin’ | tee -a ~/.bashrcsource ~/.bashrc9. Launch 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 for the puppet master.
Start puppet agent
sudo systemctl start puppetCheck the status using this command:
$ sudo systemctl status puppet● puppet.service – Puppet agentLoaded: loaded (/usr/lib/systemd/system/puppet.service; disabled; vendor preset: disabled)Active: active (running) since Fri 2021-11-05 07 : 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 -don’t-daemonize
Nov 05 07:37:08 puppetmaster.citizix.com systemd[1]: Started Puppet agent.Nov 05 07:37:09 puppetmaster.citizix.com puppet-agent[142622]: Starting Puppet client version 7.12.0Nov 05 07:37:11 puppetmaster.citizix.com puppet-agent[142623]: Catalog applied in 0.02 seconds10. Check the Puppet Agent configuration
After the puppet master signed the certificate file for the agent, run the below command in the puppet agent to verify the configuration
# puppet agent –testInfo: Using ‘production’Info environment: Retrieving pluginfactsInfo: Retrieving pluginInfo: Catalog cache for puppetmaster.citizix.comInfo: Applying configuration version ‘1636097982’
The Puppet agent extracted the configuration from the puppet master and applied it to the server without any errors.
Create a simple manifest to deploy Nginx
With the installation and configuration of the puppet master and agent complete, let’s create a simple manifest for testing. Let’s create a manifest to install the Nginx web server. The puppet manifest will be stored in the environment specific directory in the path /etc/puppetlabs/code/environments/
cd /etc/puppetlabs/code/environments/production/manifestsCreate a new manifest file.
vim site.ppPaste 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 command below.
puppet agent -t
The command will retrieve the new puppet master manifest configuration file and apply it to the agent server. Follow the result.
# puppet agent -test
Info: Using ‘production’ environmentInfo: Retrieving pluginfactsInfo: Retrieving pluginInfo: Cache catalog for puppetmaster.citizix.comInfo: Applying configuration version ‘1636098770’Notice: /Stage[main]/Main/Node[puppetmaster.citizix.com]/Package[nginx]/guarantee: createdWarning: /Step[main]/Main/Node[puppetmaster.citizix.com]/Service[nginx]/guarantee: guarantee changed ‘stopped’ to ‘running’Info: /Stage[main]/Main/Node[puppetmaster.citizix.com]/Service[nginx]: unscheduled update in service[nginx]
You can verify Nginx using this command:
# sudo systemctl status nginx● nginx.service – The nginx HTTP and reverse proxy serverLoaded: loaded (/usr/lib/systemd/system/nginx.service; enabled; vendor preset: disabled)Active: active (running) since Fri 2021-11-05 07:53:49 UTC; there are 57s Main PID: 144600 (nginx) Tasks: 3 (limit: 23168) Memory: 6.1MCGroup: /system.slice/nginx.service144600 nginx: master process /usr/sbin/nginx144602 nginx: worker process144603 nginx: worker process
Nov 05 07:53:49 puppetmaster.citizix.com systemd[1]: Starting nginx HTTP server and reverse proxy…Nov 05 07:53:49 puppetmaster.citizix.com nginx[144528]:nginx: config file syntax /etc/nginx/nginx.conf is okNov 05 07:53:49 puppetmaster.citizix.com nginx[144528]: nginx: configuration file /etc/nginx/nginx.conf test is successfulNov 05 07:53:49 puppetmaster.citizix.com systemd[1]: Started The nginx HTTP and reverse proxy server.
Final note
I hope you like the guide How to Run Puppet 7 Server on Rocky Linux/Centos 8. In case if you have any query regards this article you may ask us. Also, please share your love by sharing this article with your friends.