How to Install Puppet on Ubuntu 20.04 and 22.04

January 25, 2024

Introduction

Puppet is an open-source configuration management tool used to perform administrative tasks and server management remotely. The official Puppet Server packages are designed to support Linux distributions exclusively.

However, the Puppet agent application, used for creating client nodes, is available on a broader range of operating systems, including Linux, Unix, Windows, and macOS.

In this step-by-step tutorial, we will cover the installation of Puppet on Ubuntu 20.04 and 22.04 on master and client nodes.

How to Install Puppet on Ubuntu 20.04 and 22.04

Prerequisites

  • Two systems running Ubuntu (one for the master node and one or more for client nodes).
  • Access to an account with sudo privileges.
  • Access to the terminal.

How to Install Puppet on Ubuntu 20.04 and 22.04

The Puppet installation process for Ubuntu 20.04 and 22.04 is the same. The following text elaborates on the necessary steps to get Puppet on these Ubuntu versions.

Step 1: Update Package List

Before starting the installation process, update the list of available packages on both nodes. Run the following command:

sudo apt update

The output on the master and the client nodes is the same:

sudo apt update master node terminal output

Step 2: Set up Hostname Resolution

With Puppet, master and client nodes communicate using hostnames. Before installing Puppet, set up a unique hostname on each node. Take the following steps:

1. Open the hosts file on each node via a text editor. For example, use Vim:

sudo vim /etc/hosts

2. Paste the following lines at the end of each hosts file:

[puppet master ip] puppetmaster puppet
[puppet client ip] puppetclient

Replace [puppet master ip] with the master node IP address, and [puppet client ip] with the client node IP address.

Setting up hostnames

3. Save and exit the file on both machines.

Step 3: Install Puppet Server (Master Node)

1. Download the latest Puppet version on the master node:

wget https://apt.puppetlabs.com/puppet8-release-jammy.deb
terminal output for wget https://apt.puppetlabs.com/puppet8-release-jammy.deb

In our case, the latest release is 8. Replace the package URL from the command above with the version you want to install.

Note: If you are using Ubuntu 20.04, replace jammy with focal in the command. The command should be: wget https://apt.puppetlabs.com/puppet8-release-focal.deb.

2. Once the download is complete, install the package by using:

sudo dpkg -i puppet8-release-jammy.deb
sudo dpkg -i puppet8-release-jammy.deb terminal output

Note: On Ubuntu 20.04, replace jammy with focal in the command.

3. Update the package repository again:

sudo apt update

4. Install the Puppet server with the following command:

sudo apt install puppetserver
sudo apt install puppet server terminal output

5. Open the puppetserver file by using:

sudo vim /etc/default/puppetserver

6. Modify Xms and Xmx values in the following line to change the memory settings to 1GB:

JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"
Edit the puppetserver file

7. Save and exit the file.

8. Start the Puppet service.

sudo systemctl start puppetserver
sudo systemctl start puppetserver terminal output

9. Enable the Puppet service to start on boot with:

sudo systemctl enable puppetserver
sudo systemctl enable puppetserver terminal output

10. Check if the Puppet service is running with:

sudo systemctl status puppetserver
Terminal output for sudo systemctl status puppet for the server node

Step 4: Install and Configure Puppet Agent (Client Node)

1. Download the latest version of Puppet on a client node. Use the following command:

wget https://apt.puppetlabs.com/puppet8-release-jammy.deb
wget for client node terminal output

Note that the latest version is 8 at the time of writing the article. Change the package URL to install the desired version.

Note: If you are using Ubuntu 20.04, replace jammy with focal in the command.

2. Once the download is complete, install the package by using:

sudo dpkg -i puppet8-release-jammy.deb
terminal output for sudo dpkg -i puppet8-release-jammy.deb

Note: If you are using Ubuntu 20.04, replace jammy with focal in the command.

3. Update the package repository one more time:

sudo apt update

4. Install the Puppet agent by using:

sudo apt install puppet-agent
sudo apt install puppet-agent terminal output

5. Open the Puppet configuration file:

sudo nano /etc/puppetlabs/puppet/puppet.conf

6. Add the following lines to the end of the Puppet configuration file to define the Puppet master information:

[main]
certname = puppetclient
server = puppetmaster
Changing puppet configuration file on the client node

7. Save and exit the file.

8. Start the Puppet service with the following command :

sudo systemctl start puppet
sudo systemctl start puppet terminal output

9. Set Puppet to launch on system boot by using:

sudo systemctl enable puppet
sudo systemctl enable pupper terminal output

Step 5: Check Puppet Agent Status

Check if the Puppet service is running with:

sudo systemctl status puppet
sudo systemctl status puppet terminal output

The output shows active (running).

Step 6: Sign Puppet Agent Certificate

1. Using the Puppet master node, list all the available certificates:

sudo /opt/puppetlabs/bin/puppetserver ca list --all
listing available certificates on the master node

2. Sign the certificates with:

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

The command either has no output or confirms the certificate is successfully signed.

Troubleshooting a Puppet Installation

Following the steps above generally results in a successful installation. However, users sometimes encounter issues while going through the installation process.

The following text presents the two most common Puppet installation issues and their solutions.

Issue 1: DNS Misconfiguration

When installing Puppet, a common issue is misconfigured DNS. Correct DNS configuration is crucial for a successful installation.

Solution

Ensure DNS is configured correctly for the installation to fix this issue. Use tools like nslookup or dig to confirm DNS resolution.

Confirm the agent is able to reach the primary server using the designated hostname. To validate this, perform a network test from the agent machine.

Issue 2: Security Settings Misconfiguration

Another potential problem during Puppet installation is misconfigured security settings, including firewall configurations.

Solution

Ensure the firewall settings are correctly configured to allow Puppet-related traffic. Verify inbound traffic is permitted on ports 8140 and 443 on the primary server, which are crucial for Puppet communication.

If the primary server has multiple network interfaces, ensure it allows traffic via the IP address corresponding to the valid DNS names. Avoid restricting traffic only to internal interfaces.

Conclusion

After following this tutorial, you have fully set up Puppet master and client nodes on Ubuntu 20.04 and 22.04. This configuration management tool helps automate the server infrastructure management and configuration.

Learn more about Puppet by finding out how it stacks up against Terraform in our article Terraform vs Puppet.

Was this article helpful?
YesNo
Sara Zivanov
Sara Zivanov is a technical writer at phoenixNAP who is passionate about making high-tech concepts accessible to everyone. Her experience as a content writer and her background in Engineering and Project Management allows her to streamline complex processes and make them user-friendly through her content.
Next you should read
How to Install Snap on Ubuntu
February 25, 2021

Snaps are self-contained application packages with mediated access to the system they are installed on. They...
Read more
How to Install SQL Express Server
February 4, 2021

SQL Server Express is a light, feature-restricted version of Microsoft's SQL Server 2019...
Read more
How to Install Helm on Ubuntu, Mac and Windows
October 30, 2024

Helm is a package manager for Kubernetes that simplifies deployment process. Follow this step-by-step...
Read more
How to Install Ubuntu 20.04 LTS Desktop
May 25, 2020

This article helps you install Ubuntu 20.04 on your machine. The latest Ubuntu Focal Fossa was released on...
Read more