This brief tutorial shows students and new users how to install and manage the Puppet automation server and agent on Ubuntu 20.04 | 18.04 LTS.
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.
By installing Puppet on Ubuntu Linux, IT admins can manage and automate their infrastructure more efficiently and effectively. This helps to reduce manual effort and minimize the risk of errors.
Additionally, installing Puppet on Ubuntu Linux provides a standardized approach to infrastructure management, which can lead to better security, compliance, and performance.
To get started with Puppet in Ubuntu, follow the steps below:
Prepare Ubuntu
For this tutorial, we will use Ubuntu as our Puppet master or Puppet server. In this case, you’ll want to prepare Ubuntu to get Puppet working correctly.
Run the commands below to open the Ubuntu hosts file.
sudo nano /etc/hosts
Then, define or add the Puppet server and client IP in the file. For this tutorial, our Puppet server IP is 192.168.1.1, and the Puppet client IP is 192.168.1.2.
192.168.1.1 puppetmaster puppet 192.168.1.2 puppetclient
Save the file and exit.
Add Puppet Repository
Now that the Ubuntu server has IP defined run the commands below to add the Puppet 7 release repository.
cd /tmp wget https://apt.puppetlabs.com/puppet7-release-focal.deb
After that, run the commands below to install the repository.
sudo apt install ./puppet7-release-focal.deb
Install Puppet Server
Now that the repository is installed, run the commands below to install Puppet Server.
sudo apt update sudo apt install puppetserver
That should install the server on Ubuntu. After installation, the commands below can stop, start, and enable the server to start up automatically when the server boots up.
sudo systemctl stop puppetserver sudo systemctl start puppetserver sudo systemctl enable puppetserver
To validate that Puppet is installed and ready, run the commands below.
sudo systemctl status puppetserver
That should display similar lines to the ones below.
● puppetserver.service - puppetserver Service
Loaded: loaded (/lib/systemd/system/puppetserver.service; enabled; vendor >
Active: active (running) since Sun 2021-04-11 20:03:05 CDT; 21s ago
Main PID: 5746 (java)
Tasks: 44 (limit: 4915)
Memory: 980.8M
CGroup: /system.slice/puppetserver.service
└─5746 /usr/bin/java -Xms2g -Xmx2g -Djruby.logger.class=com.puppet>
Apr 11 20:02:19 ubuntu2004 systemd[1]: Starting puppetserver Service…
Apr 11 20:03:05 ubuntu2004 systemd[1]: Started puppetserver Service.
If you enable the Ubuntu firewall, allow this port through the firewall.
sudo ufw allow 8140/tcp
Install Puppet Agent
Now that the server is installed, switch to the client node and install the Puppet client version on the node. We will use a Ubuntu machine as our client node for this tutorial.
Puppet agents and the master servers communicate over an encrypted tunnel (HTTPS) with client verification. To install the Puppet client on Ubuntu, use the commands below to download and install the Puppet client repository.
cd /tmp/ wget https://apt.puppetlabs.com/puppet7-release-focal.deb sudo apt install ./puppet7-release-focal.deb
After installing the repository above, run the commands below to install the Puppet agent.
sudo apt update sudo apt install puppet-agent
Run the commands below to open the Puppet configuration file on the client.
sudo nano /etc/puppetlabs/puppet/puppet.conf
Then, add the highlighted lines below to define the Puppet master server. You should ensure these hostnames are defined in the /etc/hosts file on the client.
# 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 the exit.
After installation, the commands below can stop, start, and enable the Puppet agent to start when the client boots automatically.
sudo systemctl stop puppet sudo systemctl start puppet sudo systemctl enable puppet
To verify that the Puppet agent is installed and running, run the commands below:
sudo systemctl status puppet
That should display similar lines as shown below:
● puppet.service - Puppet agent
Loaded: loaded (/lib/systemd/system/puppet.service; enabled; vendor preset>
Active: active (running) since Mon 2021-04-12 08:41:39 CDT; 1min 22s ago
Main PID: 2562 (puppet)
Tasks: 1 (limit: 4648)
Memory: 78.2M
CGroup: /system.slice/puppet.service
└─2562 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/>
Apr 12 08:41:39 Ubuntu2010 systemd[1]: Started Puppet agent.
Sign Puppet Agent Certificates
Now switch back to the back to the server node and run the commands below to list all available certificates on the server.
sudo /opt/puppetlabs/bin/puppetserver ca list --all
That should display lists of certificates found. Now run the commands below to sign all the certificates listed.
sudo /opt/puppetlabs/bin/puppetserver ca sign --all
That should do it!
Now, go back to the Puppet client node and run the commands below to test communication between client and server nodes.
sudo /opt/puppetlabs/bin/puppet agent --test
If communication is successful, then your job is done. You can now start configuring your server tasks.
Conclusion:
This post showed you how to install Ubuntu’s Puppet server and client nodes. If you find any error above, please use the form below to report.
You may also like the post below:
Leave a Reply