- HX Club
- July 15, 2021
How to Install & Configure Puppet on Ubuntu 20.04.
Puppet is free & open source software configuration management tool & automated administrative engine.It is used to perform administrative tasks and server management taks remotely.
Using puppet,we can communicate between client & master server.It helps in performing administrative tasks and centralizing the server management process.It supports Linux, Unix, and Windows operating systems.
Install Puppet on ubuntu
Update the system.
apt-get update
Install Java.
apt-get install default-jdk
Set the Hostname.
vim /etc/hosts
Add the following lines.
[puppet master-server-ip] puppetmaster puppet
[puppet client-server-ip] puppetclient
Download Puppet Server on Master Node.
wget https://apt.puppetlabs.com/puppet6-release-focal.deb
Here is the command output.
https://apt.puppetlabs.com/puppet6-release-focal.deb
Resolving apt.puppetlabs.com (apt.puppetlabs.com)...
65.8.205.123, 65.8.205.120, 65.8.205.110, ...
Connecting to apt.puppetlabs.com (apt.puppetlabs.com)|
65.8.205.123|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 11752 (11K) [application/x-debian-package]
Saving to: ‘puppet6-release-focal.deb’
puppet6-release-focal.deb 100%[====================>] 11.48K --.-KB/s in 0s
‘puppet6-release-focal.deb’ saved [11752/11752]
Install the required package.
dpkg -i puppet6-release-focal.deb
Here is the command output.
Selecting previously unselected package puppet6-release.
(Reading database ... 60149 files and directories currently installed.)
Preparing to unpack puppet6-release-focal.deb ...
Unpacking puppet6-release (6.0.0-14focal) ...
Setting up puppet6-release (6.0.0-14focal) ...
Update the package.
apt-get update
Install the Puppet server.
apt-get install puppetserver
Open the puppetserver
file.
vim /etc/default/puppetserver
Modify the memory size to 1GB.
JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"
Start & Enable the Puppet service.
systemctl start puppetserver
&
systemctl enable puppetserver
Check Puppet service.
systemctl status puppetserver
Here is the command output.
● puppetserver.service - puppetserver Service
Loaded: loaded (/lib/systemd/system/puppetserver.service; enabled; vendor preset: enabled)
Active: active (running); 3min 50s ago
Main PID: 6389 (java)
Tasks: 42 (limit: 4915)
Memory: 423.0M
CGroup: /system.slice/puppetserver.service
└─6389 /usr/bin/java --Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger
Install Puppet Agent on Client Node
Download Puppet on a client node.
wget https://apt.puppetlabs.com/puppet6-release-focal.deb
Install the required package.
dpkg -i puppet6-release-focal.deb
Update the package.
apt-get update
Install the Puppet agent.
apt-get install puppet-agent
Configure the Puppet file.
vim /etc/puppetlabs/puppet/puppet.conf
Add the following lines.
[main]
certname = puppetclient
server = puppetmaster
Start & Enable the Puppet service.
systemctl start puppet
systemctl enable puppet
Check Puppet service.
systemctl status puppet
Here is the command output.
● puppet.service - Puppet agent
Loaded: loaded (/lib/systemd/system/puppet.service; enabled; vendor preset: enabled)
Active: active (running); 8s ago
Main PID: 183959 (puppet)
Tasks: 2 (limit: 18859)
Memory: 53.6M
CGroup: /system.slice/puppet.service
└─183959 /opt/puppetlabs/puppet/bin/rub
Show all the certificates.
/opt/puppetlabs/bin/puppetserver ca list --all
Here is the command output.
Requested Certificates:
puppetclient (SHA256) A4:9A:E9:87:8B:54:0A:4F:A0:78:65:1A:3C:99:B5:EC:3
puppetmaster (SHA256) E9:25:4C:51:4E:47:D7:44:11:1F:C5:A9:4E:96:D9:E8:3A
Sign the certificates.
/opt/puppetlabs/bin/puppetserver ca sign --all
Here is the command output.
Successfully signed certificate request for puppetclient
Successfully signed certificate request for puppetmaster
Test the communication interface between the master and client nodes.
/opt/puppetlabs/bin/puppet agent --test
Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for puppetclient
Info: Applying configuration version '1599398'
Notice: Applied catalog in 0.02 seconds