Puppet – How to install Puppet Agent in Linux

After Puppet and Foreman Installation we will continue with “How to install Puppet Agent in Linux” post.

Puppet agent installation is very easy. It has basically three steps:
1. Add the Puppet repos
2. Install Puppet agent
3. Make its configuration so it connects to server.

Now lets begin with the first step.

1. Add the Puppet repos:

$ wget https://apt.puppetlabs.com/puppetlabs-release-trusty.deb
$ sudo dpkg -i puppetlabs-release-trusty.deb
$ sudo apt-get update

2. Install Puppet agent:

$ sudo apt-get install -y puppet

3. Make its configuration so it connects to server:

$ sudo sed -i '/\/var\/log\/puppet/a \server=puppetmaster.example.com' /etc/puppet/puppet.conf
$ sudo sed -i s/START=no/START=yes/g /etc/default/puppet
$ sudo service puppet restart

– 1st line:  Defines the server details: server=puppetmaster.example.com.  You can use also an IP instead of FQDN.
– 2nd line: Enables the service with START=yes.
– 3rd line: restarts the puppet agent.

Finally you can use the code below to see if everything works fine:

$ sudo puppet agent --test

First run will create a key for the client. After that you need to goto Foreman and in Smart Proxy details. Sign the certificate.

How to install Puppet Agent in Linux

After signing the certificate run the “sudo puppet agent --test” command and you will see a message like in the example below:

$ sudo puppet agent --test
Info: Retrieving pluginfacts
Info: Retrieving plugin
Info: Caching catalog for ubuntutest
Info: Applying configuration version '1413483628'
Notice: Finished catalog run in 0.01 seconds

As a last info: if you want to use terminal for signing certificates. You can login to your server with ssh and can use the commands below:

$ sudo puppet cert list
$ sudo puppet cert sign <name>

For more info check https://docs.puppetlabs.com/guides/install_puppet/pre_install.html

Next post: How to install Puppet Agent in Windows