AlmaLinuxRHEL Based

How To Install Puppet on AlmaLinux 9

Install Puppet on AlmaLinux 9

In this tutorial, we will show you how to install Puppet on AlmaLinux 9. Puppet is a renowned open-source configuration management tool that enables system administrators to automate repetitive tasks and ensure consistency across their infrastructure. By automating configuration and management, Puppet helps reduce errors and allows IT teams to scale efficiently.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of Puppet on AlmaLinux 9. You can follow the same instructions for CentOS and Rocky Linux or RHEL-based.

Prerequisites

  • A server running one of the following operating systems: AlmaLinux 9.
  • It’s recommended that you use a fresh OS install to prevent any potential issues.
  • SSH access to the server (or just open Terminal if you’re on a desktop).
  • An active internet connection. You’ll need an internet connection to download the necessary packages and dependencies for Puppet.
  • A non-root sudo user or access to the root user. We recommend acting as a non-root sudo user, however, as you can harm your system if you’re not careful when acting as the root.

Install Puppet on AlmaLinux 9

Step 1. Before diving into the installation process, ensure your AlmaLinux 9 system is up-to-date. Run the following commands in your terminal:

sudo dnf update

Step 2. Installing Essential Packages.

To smoothly install Puppet, you’ll need some essential packages. Install them with the following command:

sudo dnf install wget curl

Step 3. Setting up Hostname and Domain Name.

Configure your system’s hostname and domain name using the following commands:

sudo hostnamectl set-hostname puppet-master
sudo echo "127.0.0.1 puppet-master" >> /etc/hosts

Step 4. Installing Puppet on AlmaLinux 9.

To install Puppet, you need to add the Puppet repository to your system and import the Puppet GPG key:

sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-9.noarch.rpm

To ensure that the repository has been added successfully, run:

sudo dnf repolist

Import the Puppet GPG key to verify package authenticity:

sudo rpm --import https://yum.puppet.com/RPM-GPG-KEY-puppet

Now, let’s install the Puppet server package:

sudo dnf install puppetserver

Step 5. Configuring Puppet Server.

  1. Setting Up Puppet Master Hostname

Edit the /etc/puppetlabs/puppet/puppet.conf file and add the following lines to configure the Puppet Master hostname:

[main]
certname = puppet-master
  1. Configuring Puppet Master DNS

Ensure that the Puppet Master’s DNS is correctly configured. Verify the /etc/resolv.conf file:

cat /etc/resolv.conf

To start the Puppet service and enable it to start at boot, run:

sudo systemctl start puppetserver
sudo systemctl enable puppetserver

Step 6. Installing Puppet Agent.

Now, let’s install the Puppet agent package:

sudo dnf install puppet-agent

Step 7. Configuring Puppet Agent

  1. Setting Up Puppet Agent Hostname

Edit the /etc/puppetlabs/puppet/puppet.conf file on the agent node and add the following lines to configure the Puppet agent hostname:

[main]
certname = puppet-agent
  1. Configuring Puppet Agent DNS

Ensure that the Puppet agent’s DNS is correctly configured. Verify the /etc/resolv.conf file on the agent node as well.

To start the Puppet agent service and enable it to start at boot, run:

sudo systemctl start puppet
sudo systemctl enable puppet

Step 8. Puppet SSL Certificate Setup.

Puppet relies on SSL certificates for secure communication between the master and agents. Let’s set up the SSL certificates.

On the Puppet Master node, run the following commands to generate SSL certificates:

sudo /opt/puppetlabs/bin/puppetserver ca setup

On the Puppet Master, sign the agent’s certificate request:

sudo /opt/puppetlabs/bin/puppetserver ca sign --all

To check the certificate status, run:

sudo /opt/puppetlabs/bin/puppetserver ca list --all

Step 9. Puppet Configuration Files

Puppet configuration files play a crucial role in defining the behavior of your Puppet environment. Here’s an overview of some important configuration files:

  • /etc/puppetlabs/puppet/puppet.conf: The main Puppet configuration file.
  • /etc/puppetlabs/code/environments/production/manifests/site.pp: The main Puppet manifest file.

You can modify these files to customize your Puppet setup according to your specific requirements.

Step 10. Testing Puppet.

Before we proceed further, it’s essential to verify that Puppet is working correctly.

  • Applying a Sample Puppet Manifest

Create a simple Puppet manifest file, for example, /etc/puppetlabs/code/environments/production/manifests/test.pp, with the following content:

file { '/tmp/testfile':
ensure => present,
content => 'Hello, Puppet!',
}

Apply this manifest using the puppet apply command:

sudo /opt/puppetlabs/bin/puppet apply /etc/puppetlabs/code/environments/production/manifests/test.pp

Verify that the Puppet agent can communicate with the master by running:

sudo /opt/puppetlabs/bin/puppet agent --test

Check if the /tmp/testfile has been created on the agent node:

cat /tmp/testfile

Congratulations! You have successfully installed Puppet. Thanks for using this tutorial for installing Puppet on your AlmaLinux 9 system. For additional help or useful information, we recommend you check the official Puppet website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is a seasoned Linux system administrator with a wealth of experience in the field. Known for his contributions to idroot.us, r00t has authored numerous tutorials and guides, helping users navigate the complexities of Linux systems. His expertise spans across various Linux distributions, including Ubuntu, CentOS, and Debian. r00t's work is characterized by his ability to simplify complex concepts, making Linux more accessible to users of all skill levels. His dedication to the Linux community and his commitment to sharing knowledge makes him a respected figure in the field.
Back to top button