Install PuppetDB on Ubuntu Server
This article is for those looking for a detailed and straightforward guide on installing PuppetDB on Ubuntu Server.
PuppetDB is a scalable and reliable data store for Puppet. PuppetDB collects data generated by Puppet and also provides advanced functionality based on a powerful API.
Zabbix is an open-source, enterprise-class distributed monitoring solution.
In this guide, we will consider the case when you already have a server with the Ubuntu Server 22.04 LTS operating system installed on it.
You can read more about how to install Ubuntu Server 22.04 LTS in my guide “Install Ubuntu Server 22.04 LTS”.
Also, the Puppet Server must be installed on the server.
You can find out how to install Puppet on Ubuntu Server by reading “Install Puppet на Ubuntu Server”.
In addition, OpenSSH must be installed on the server, and port 22 must be open in order to be able to connect to the server using the SSH protocol.
To install OpenSSH on a server, you can use the command:
If you plan to connect to the server using the Windows operating system, you can use PuTTY or MobaXterm.
This guide describes how to connect to a server using the iTerm2 terminal emulator installed on the macOS operating system.
Please note that you will need to open the following TCP ports to access your server:
- TCP port 8081 - for Puppet Agent to work.
This tutorial uses “puppet.heyvaldemar.net” as the Puppet server name.
The server with the agent installed must resolve the Puppet server name not only by the base name puppet.heyvaldemar.net but also by the name puppetdb.heyvaldemar.net. Also, the Puppet server has to resolve the name of the client-server.
Make sure the Puppet server and client-server have the correct DNS records and update the “/etc/hosts” file if necessary.
Puppet binaries are located in the “/opt/puppetlabs/bin/” directory, which is not in the “PATH” environment variable by default and in the “secure_path” variable that is used for “sudo” operations.
By adding the path to executable files to variables, you can use:
Instead:
You can learn how to properly prepare the Puppet server to install PuppetDB and add the path to the Puppet executables to variables by reading “Install Puppet on Ubuntu Server”.
We connect to the Puppet server on which you plan to install PuppetDB.
Update the local package index to the latest changes in the repositories using the command:
Now install PostgreSQL using the command:
Please note that this tutorial will use PostgreSQL as a database management system.
Now you need to create a database that PuppetDB will use in the future, as well as a user with the necessary rights in this database.
Switch to the “postgres” user who has administrator rights in PostgreSQL using the command:
We create a new user using the command:
In this tutorial, “puppetdb” will be used as the username, with the password “sqhrgX8G*RCaYURftzoG89b”.
Specify a strong password for the new user and press the “Enter” button.
Enter the password again and press the “Enter” button.
We create a new database and grant the rights to it to the previously created user using the command:
Next, you need to install the “pg_trgm” index extension optimized for RegExp using the command:
Log out as user “postgres” using the command:
Now install PuppetDB using the command:
Next, install additional Ruby plugins to use PuppetDB using the command:
Now you need to make changes to the PuppetDB configuration file by opening it in a text editor using the command:
In this tutorial, the database for PuppetDB is on the same server as Puppet.
Press the “i” button to switch to edit mode, find the “subname” parameter and uncomment it by removing the “#” symbol.
This tutorial uses “puppetdb” as the database name for PuppetDB.
Next, add new parameters “classname” and “subprotocol” with the following values:
This tutorial uses “puppetdb” as the database username for PuppetDB.
Find the “username” parameter and uncomment it by removing the “#” symbol. Then we set the parameter to “puppetdb”.
Find the “password” parameter and uncomment it by removing the “#” symbol. Then, as a value for the parameter, specify the password assigned to the “puppetdb” user.
Next, add a new parameter “log-slow-statements” with the following value:
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
Check that the certificates that will be used by PuppetDB are generated and the configuration file “jetty.ini” contains the correct values using the command:
Next, you need to create a configuration file for PuppetDB to work correctly using the command:
Press the “i” button to switch to edit mode, and add a new section “[Main]” with the following parameters:
In this tutorial, the Puppet Server is installed on the puppet.heyvaldemar.net server. You will need to specify your server through which your Puppet Server will be accessible from the Internet or on the local network of your organization.
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
By default, PuppetDB JVM is configured to use 192 MB of RAM. This value can be changed in the PuppetDB config file by opening it in a text editor using the command:
Hit the “i” button to go into edit mode, find the line JAVA_ARGS=”-Xmx192m” and change the “Xmx” parameter in accordance with the requirements for your PuppetDB server.
Please note that in this tutorial the “Xmx” parameter will be 256 MB.
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
Next, you need to make changes to the Puppet configuration file by opening it in a text editor using the command:
Hit the “i” button to go into edit mode, find the “[master]” section, and add new parameters for PuppetDB to work correctly:
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
Now let’s create a configuration file “routes.yaml” so that information from PuppetDB can be used in Puppet using the command:
Hit the “i” button to go into edit mode, then insert the following configuration:
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
Assign the correct permissions to files and directories for Puppet to work correctly using the command:
Launch PuppetDB and enable it to autostart when the operating system starts up using the command:
Restart Puppet Server to apply the changes made using the command:
Check that Puppet Server has started successfully using the command:
Next, we connect to the server on which the Puppet Agent is installed.
Now you need to make changes to the Puppet configuration file by opening it in a text editor using the command:
Press the “i” button to switch to edit mode and add a new “[agent]” section with the following parameters:
Now press the “Esc” button to exit edit mode, then type “:x” and press the “Enter” button to save your changes and exit the editor.
Restart Puppet to apply the changes, using the command:
Let’s check that Puppet has started successfully using the command:
Now you need to check that the Puppet Agent will receive the configuration from the Puppet server and correctly connect to PuppetDB using the command:
The Puppet Agent ran without errors and successfully received the configuration from the Puppet server and also successfully connected to PuppetDB.
Now you can check that PuppetDB is actually receiving data from the client-server.
We return to the server with Puppet Server and PuppetDB installed.
Open the Puppet Server log to check the correctness of Puppet and PuppetDB using the command:
On the keyboard, press the “Shift” and “f” keys to start monitoring changes in the Puppet log in real-time.
The Puppet log should show a record that the information has been sent and saved.
Please note that in this tutorial Puppet Agent is installed on the puppet-agent.heyvaldemar.net server.
On the keyboard, press the key combination “Ctrl” and “c”, then “q” to close the Puppet log.
Next, open the PuppetDB log to check the correctness of Puppet and PuppetDB using the command:
On the keyboard, press the key combination “Shift” and “f” to start monitoring changes in the PuppetDB log in real-time.
The PuppetDB log should show a record that the information has been sent and saved.
Please note that in this tutorial Puppet Agent is installed on the puppet-agent.heyvaldemar.net server.
On the keyboard, press the key combination “Ctrl” and “c”, then “q” to close the PuppetDB log.
Now you can verify that the data from the client-server has been successfully transferred to the “puppetdb” database.
This tutorial uses “puppetdb” as the database username for PuppetDB.
This tutorial uses “puppetdb” as the database name for PuppetDB.
Connect to the “puppetdb” database using the command:
Specify the password assigned to the user “puppetdb” and press the “Enter” button.
Turn on the expanded table output mode using the command:
Let’s extract data from the “catalogs” table to make sure that information about the client-server is present in the table using the command:
The client-server information is indeed present in the database.
My Courses
🎓 Dive into my comprehensive IT courses designed for enthusiasts and professionals alike. Whether you’re looking to master Docker, conquer Kubernetes, or advance your DevOps skills, my courses provide a structured pathway to enhancing your technical prowess.
My Services
💼 Take a look at my service catalog and find out how we can make your technological life better. Whether it’s increasing the efficiency of your IT infrastructure, advancing your career, or expanding your technological horizons — I’m here to help you achieve your goals. From DevOps transformations to building gaming computers — let’s make your technology unparalleled!
Refill My Coffee Supplies
💖 PayPal
🏆 Patreon
💎 GitHub
🥤 BuyMeaCoffee
🍪 Ko-fi
Follow Me
🎬 YouTube
🐦 Twitter
🎨 Instagram
🐘 Mastodon
🧵 Threads
🎸 Facebook
🧊 Bluesky
🎥 TikTok
💻 LinkedIn
📣 daily.dev Squad
🧩 LeetCode
🐈 GitHub
Is this content AI-generated?
Nope! Each article is crafted by me, fueled by a deep passion for Docker and decades of IT expertise. While I employ AI to refine the grammar—ensuring the technical details are conveyed clearly—the insights, strategies, and guidance are purely my own. This approach may occasionally activate AI detectors, but you can be certain that the underlying knowledge and experiences are authentically mine.