How to Install Puppet on Ubuntu 20.04

Install Puppet on Ubuntu 20.04

In this article, we will have explained the necessary steps to install and configure Puppet on Ubuntu 20.04 LTS. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Puppet is an open-source, cross-platform, enterprise automation tool that allows IT admins to automate infrastructure and complex workflows enabling continuous compliance in a simple, yet powerful way. This tool is available on Linux, Unix, and Windows.

Install Puppet on Ubuntu 20.04

Step 1. First, before you start installing any package on your Ubuntu server, we always recommend making sure that all system packages are updated.

sudo apt update
sudo apt upgrade

Step 2. Install Puppet on the Ubuntu system.

  • For this tutorial, our Puppet server IP is 192.168.1.1, and Puppet client IP is 192.168.1.2:
192.168.88.1           puppetmaster      puppet
192.168.88.2           puppetclient

Now add Puppet repository, run the commands below:

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

Next, run the command to install it from the repository:

sudo apt install ./puppet7-release-focal.deb

Installing Puppet Server:

Once the repository is installed, run the commands below to install Puppet Server:

sudo apt update
sudo apt install puppetserver

Next, run the commands to stop, start and enable server to always start up with the server boots:

sudo systemctl stop puppetserver
sudo systemctl start puppetserver
sudo systemctl enable puppetserver

Installing Puppet Agent:

Now install the Puppet client version on the client node:

cd /tmp/
wget https://apt.puppetlabs.com/puppet7-release-focal.deb
sudo apt install ./puppet7-release-focal.deb

Next, run the below command on the agent node to install the puppet agent:

sudo apt update
sudo apt install puppet-agent

On the client, run the commands below to open the Puppet configuration file:

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

Add the following line:

# This file can be used to override the default puppet settings.
# See the following links for more details on what settings are available:
# - https://puppet.com/docs/puppet/latest/config_important_settings.html
# - https://puppet.com/docs/puppet/latest/config_about_settings.html
# - https://puppet.com/docs/puppet/latest/config_file_main.html
# - https://puppet.com/docs/puppet/latest/configuration.html

[main]
certname = puppetclient
server = puppetmaster

Save and close the file when you are finished. Then, start the Puppet service and enable it to start at system reboot with the following command:

sudo systemctl stop puppet
sudo systemctl start puppet
sudo systemctl enable puppet

Step 3. Sign Puppet Agent Certificate.

On the Puppet master node, run the following command to list all certificate:

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

Then, run the commands below to test communication between Puppet client and server:

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

If everything is fine, you should get the following output:

Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for puppet-client
Info: Applying configuration version '15510012062'
Notice: Applied catalog in 0.11 seconds

Step 4. Configure firewall.

I you have Ubuntu firewall enable then make sure to allow this port through the firewall:

sudo ufw allow 8140/tcp

That’s all you need to do to install Puppet on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Puppet, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.