How to Install Puppet on Ubuntu 20.04

March 17, 2021

Introduction

Puppet is an open-source, automation admin engine used to perform administrative tasks and server management remotely. This tool is available on Linux, Unix, and Windows.

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

How to install Puppet on Ubuntu 20.04

Prerequisites

  • Multiple systems running Ubuntu 20.04 (one for the master node and one or more for client nodes)
  • Access to an account with sudo privileges
  • Access to the terminal/command line

Step 1: Update Package List

Before you start the installation process, update the list of available packages:

sudo apt-get update -y
Before installing Puppet, update your Ubuntu system

Step 2: Set Up Hostname Resolution

  With Puppet, master and client nodes communicate using hostnames. Before installing Puppet, you need to set up a unique hostname on each node.

1. Open the hosts file on each node by using:

sudo nano /etc/hosts

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

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

Where:

  • [puppet master ip] is the IP address of the master node, and
  • [puppet client ip] is the IP address of the client node.
Edit the hosts file on each of your nodes

3. Press Ctrl + X to close the file, and then type Y and press Enter to save the changes you made.

Step 3: Install Puppet Server on Master Node

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

wget https://apt.puppetlabs.com/puppet6-release-focal.deb
Download the Puppet installation files

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

sudo dpkg -i puppet6-release-focal.deb
Deploy the Puppet installation

3. Update the package repository:

sudo apt-get update -y

4. Install the Puppet server with the following command:

sudo apt-get install puppetserver -y

5. Open the puppetserver file by using:

sudo nano /etc/default/puppetserver

6. In the puppetserver file, modify the following line to change the memory size to 1GB:

JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"
Edit the puppetserver file to change available RAM to 1GB

7. Press Ctrl + X to close the puppetserver file. Type Y and press Enter to save the changes you made.

8. Start the Puppet service and set it to launch on system boot by using:

sudo systemctl start puppetserver
sudo systemctl enable puppetserver
Start up the puppetserver service

9. Check if the Puppet service is running with:

sudo systemctl status puppetserver
Check the status of the puppetserver service

Step 4: Install Puppet Agent on Client Node

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

wget https://apt.puppetlabs.com/puppet6-release-focal.deb

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

sudo dpkg -i puppet6-release-focal.deb

3. Update the package repository one more time:

sudo apt-get update -y

4. Install the Puppet agent by using:

sudo apt-get install puppet-agent -y

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
Edit the Puppet configuration file

7. Press Ctrl + X to close the Puppet configuration file, then type Y and press Enter to save the changes.

8. Start the Puppet service and set it to launch on system boot by using:

sudo systemctl start puppet
sudo systemctl enable puppet

9. Check if the Puppet service is running with:

sudo systemctl status puppet
Check the status of the Puppet service

Step 5: Sign Puppet Agent Certificate

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

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

2. Sign the certificates with:

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

3. Use the following command to test the communication between the master and client nodes:

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

Conclusion

After following this tutorial, you should have fully set up Puppet master and client nodes on Ubuntu 20.04. This configuration management tool will help you automate the management and configuration of your server infrastructure.

If you are using a macOS system, follow our guide on how to set up and install Puppet on Mac.

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

Was this article helpful?
YesNo
Aleksandar Kovačević
With a background in both design and writing, Aleksandar Kovacevic aims to bring a fresh perspective to writing for IT, making complicated concepts easy to understand and approach.
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
December 10, 2020

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