13.8 C
Texas

How To Install Puppet On Ubuntu 20.04

Today we are going to learn that how to install Puppet On Ubuntu 20.04. Puppet is an open source based upon automated admin engine to help you perform admin tasks smoothly. Puppet consists of Master & Agent used for deploying, configuring & managing the servers & perform administrative tasks. For instance, to add new users, to install different packages and many more. So, it helps the system admins to save time and automate the functions.

So, here we’ll see that how we can install Puppet on our Ubuntu system.

Step 1: Update Your System

First of all update your system to have the latest updates installed.

sudo apt update -y
- Advertisement -

Once the update finished, move towards the next step.

Step 2: Setup Hostname

Edit the /etc/hosts file on both nodes (master,client)

sudo nano /etc/hosts

Paste the below data.

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

Then save the file and exit.

Step 3: Install Puppet Server On Ubuntu

To install Puppet server on Ubuntu, you’ve to add it’s repository in Ubuntu system and then install it from there. To download the latest version of Puppet run the following command.

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

Once it is downloaded, install it by typing

dpkg -i puppet6-release-focal.deb

When the installation is finished, update the repo & then install the Puppet server by running.

apt update -y
apt install puppetserver -y

Now, edit the file /etc/default/puppetserver & set the memory size to 1g like below:

JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"

Then, save & exit the file.

To start the Puppet services type

systemctl start puppetserver

To enable the puppet services on boot hit

systemctl enable puppetserver

Make sure that the service is in running condition.

systemctl status puppetserver
Loaded: loaded (/lib/systemd/system/puppetserver.service; disabled; vendor preset: enabled) Active: active (running) since Sat 2020-09-05 09:33:55 UTC; 3s ago Process: 3673 ExecStart=/opt/puppetlabs/server/apps/puppetserver/bin/puppetserver start (code=exited, status=0/SUCCESS) Main PID: 3715 (java) Tasks: 42 (limit: 4915) Memory: 962.3M CGroup: /system.slice/puppetserver.service ??3715 /usr/bin/java -Xms2g -Xmx2g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger -XX:OnOutOfMemoryError="kill> Dec 01 09:33:08 puppetmaster systemd[1]: Starting puppetserver Service... Dec 01 09:33:55 puppetmaster systemd[1]: Started puppetserver Service.

Step 4: Install & Configure Puppet Agent

To install Puppet agent on Ubuntu 20.04, you’ve to add the repository. Run the below command to do so

wget https://apt.puppetlabs.com/puppet6-release-focal.deb
dpkg -i puppet6-release-focal.deb

Update the repo & install the puppet agent by typing

apt-get update -y
apt-get install puppet-agent -y

Once it is installed, edit the /etc/puppetlabs/puppet/puppet.conf file.

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

Then paste the below content:

[main]
certname = puppetclient
server = puppetmaster

Finally run the below commands to start & enable the puppet.

systemctl start puppet
systemctl enable puppet

Fire the below command to verify the status of Puppet.

systemctl status puppet
puppet.service - Puppet agent
Loaded: loaded (/lib/systemd/system/puppet.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2020-09-05 09:43:15 UTC; 22s ago
Main PID: 1435 (puppet)
Tasks: 2 (limit: 2353)
Memory: 52.8M
CGroup: /system.slice/puppet.service
??1435 /opt/puppetlabs/puppet/bin/ruby /opt/puppetlabs/puppet/bin/puppet agent --no-daemonize
Dec 01 09:43:15 puppetagent systemd[1]: Started Puppet agent.

Step 5: Sign Puppet Agent Node Certificate

Type the below command on Master node.

/opt/puppetlabs/bin/puppetserver ca list

Output:

Requested Certificates:
puppetclient (SHA256) A4:9A:E9:87:8B:54:0A:4F:A0:78:65:1A:3C:99:B5:EC:31:9E:BB:4C:17:8A:50:16:E9:1E:3D:D6:27:74:89:85
puppetmaster (SHA256) E9:25:4C:51:4E:47:D7:44:11:1F:C5:A9:4E:96:D9:E8:3A:EB:A0:01:48:06:B5:EF:3F:C4:09:03:90:3E:D8:2D

Hit the below command to sign all certs.

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

Output:

Successfully signed certificate request for puppetclient
Successfully signed certificate request for puppetmaster
Verify the communication by typing
/opt/puppetlabs/bin/puppet agent --test

Output:

Info: Using configured environment 'production'
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Retrieving locales
Info: Caching catalog for puppetclient
Info: Applying configuration version '1599300398'
Notice: Applied catalog in 0.02 seconds

So, this is how you can install puppet on Ubuntu 20.04

- Advertisement -
Everything Linux, A.I, IT News, DataOps, Open Source and more delivered right to you.
Subscribe
"The best Linux newsletter on the web"

LEAVE A REPLY

Please enter your comment!
Please enter your name here



Latest article