How to Install Puppet on Ubuntu 18.04 | 20.04

How to Install Puppet on Ubuntu 18.04 20.04

In this post, we are going to show that how to Install Puppet on Ubuntu 18.04 | 20.04. If your are going to Install Puppet on your Ubuntu system then this post is ideal for you.

Puppet is a free, open source and cross-platform automated administrative tool which is available for Linux, Unix, and Windows operating systems. It is used to automate infrastructure, deploying, configuring, complex workflows and managing servers and it is also performs admin tasks such as adding users, installing packages, and many others tasks.


How to Install Puppet on Ubuntu

Simply follow below steps to install Puppet on your Ubuntu system:

Step 1 : Update and Prepare Ubuntu

Run the command below to update Ubuntu:

sudo apt update

Next, open Ubuntu hosts file and add Puppet server and Puppet client IP in the file. To open Ubuntu hosts file, run the command below:

sudo nano /etc/hosts

Now add IP’s for Puppet server and Puppet client in the host file as show below:

type-puppet-master-ip         puppetmaster      puppet
type-puppet-client-ip         puppetclient

Step 2 : Add Puppet Repository

To add Puppet 7 release repository, run the commands below:

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

Next, run the command below to install the Puppet repository:

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

Step 3 : Install Puppet Server

Next, you will need to install Puppet Server by following below commands:

sudo apt update
sudo apt install puppetserver

Next, run the commands below 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

To check Puppet status, run the command below.

sudo systemctl status puppetserver

In case, if your ubuntu firewall enable, run the command below to allow this port through the firewall:

sudo ufw allow 8140/tcp

Step 4 : Install and Configure Puppet Agent

At this stage, the Puppet server is installed. Next, you will need to install the Puppet client version on the client node.

Run the commands below to download and install Puppet client repository:

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

Next, install Puppet agent by using commands below:

sudo apt update
sudo apt install puppet-agent

Next, open Puppet configuration file using below command:

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

After open config file, add the below highlighted lines to define the Puppet master information:

# 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

When you are done, save and close the file.

Next, run the commands below to stop, start and enable Puppet agent to always start up with the client boots:

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

To check Puppet agent status, run the command below:

sudo systemctl status puppet

Step 5 : Sign Puppet Agent Certificate

Run the command below to list all certificate on the server:

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

The above command will display lists of certificates as output.

Next run the command below to sign all the certificates listed. To do that, run the command below:

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

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

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

If everything is fine and communication is successful, you will get a output similar like below:

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

That’s all

If you face any error and issue in above steps , please use comment box below to report.

If our tutorials helped you, please consider buying us a coffee. We appreciate your support!

Thank you for your support.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Scroll to Top