Skip to content

puppet server command not found error fix

setup puppet server and puppet agent on ubuntu 16.04 docker container

We are going to learn here how to setup puppetserver (puppetmaster) and puppet agent (puppet) on ubuntu 16.04

Environment setup for puppet

Lets not create a virtual box which is quite heavier than docker so here I will be using the docker container with Ubuntu 16.04 images and all necessary packages like curl, vim installed. If you don’t know about docker please refer about it first or optionally you can setup the environment using virtualbox. The problem with virtual box is as they takes a lot of memory size and hardware, you need a good configuration system with enough memory to allocate the resources to newly created virtual box .

Here the environment for our puppet master and agent will be something like bellow

  1. a docker container with ubuntu 16.04 images used as puppet master
  2. a docker container with ubuntu 16.04 images used as puppet agent

You can also use some other operating system of your choice like centos and create your lab environment. if you are using the docker container than you may need to add the curl and whatever does not comes  build in with docker.

How to setup puppet master in ubuntu 16.04

Assuming we are inside the first docker container where we will set up the puppet master. Type the following commands where we are just adding the puppetlab packages there after we will be installing the puppet master (puppetserver)

curl -O
sudo dpkg -i puppetlabs-release-pc1-xenial.deb
sudo apt-get update

Note same will be used for the puppet agent initial package setup

Now we are ready to install puppet master.

apt-get install puppetserver

This will install the puppetserver in our first docker container.

Verify the puppetserver is installed properly

To verify if the puppetserver is installed properly type

puppetserver --version

which should return a puppetserver version.

if you get the problem like puppetserver command not found though your puppetserver was installed successfully, the reason can be that your puppetserver is not being setup in the environment path and hence you are not able to run the command. So to set it up in the environment path follow these guide. how to fix puppetserver not found error.

We have successfully added the puppetserver now need few setup to be done which will be the way to define this is the puppetserver(puppetmaster).

open the puppet configuration file /etc/puppetlabs/puppet/puppet.conf


Setting up the puppet agent in ubuntu 16.04

follow the above process of installing the puppet labs package ,we will be adding the same package in the puppet agent too and than create an agent. After finishing the above method now time to add the puppet agent.

installing puppet agent in ubuntu 16.04

$ sudo apt-get install puppet

verify to see if it is installed or not

type puppet which should result in showing some descriptions

configure puppet agent conf file

the puppet agent config file is located here /etc/puppet/puppet.conf


Here we are letting the puppet agent know that the puppet master machine with the name we assigned for the puppet master

set the host name of puppet master in /etc/hosts

put the ip address of the puppet master followed by its name. Suppose the ip address of puppet master machine is So the /etc/hosts will have    puppetmaster

Summarizing The puppet master and puppet agent installation process

  1. get the package from the puppetlabs
  2. install the puppetserver
  3. configure the puppetserver conf file in /etc/puppetlabs/puppet/puppet.conf  adding the dns_alt_names setting
  4. Repeat step-1 in puppet agent machine
  5. install the puppet ,which is the puppet agent for us
  6. configure the puppetagent conf file located in /etc/puppet/puppet.conf adding the servername setting
  7. add the puppet master machine ip address and name in /etc/hosts

This is the overall steps required in puppet master and puppet agent setup in ubuntu 16.04 machine.

Note: Some path may vary depending upon the version of puppet you are using. This has been tested on new version of puppet.

Fixing the puppetserver command not found ERROR

I recently installed a puppetserver successfully following the official guides. My setup was something like this. A docker container with ubuntu 16.04.3 LTS. The puppetserver was installed successfully and when trying to run the command puppetserver came through this error ” Puppetserver command not Found “.

The problem was in the latest puppetserver version the puppetserver path is not added to the $PATH so added and the problem got solved.

Here is how to add the program path to the $PATH


This will add the new path to the $PATH. To verify it use this command

echo $PATH which should show the recently added path

Extra tips on puppetserver certificate generation:

As we know this command puppet master –no-daemonize –verbose will generate a certificate in puppet server (master) but remember to stop the puppet master before running this else you might come up with some error message like bellow

Error: Could not run: Could not create PID file: /var/run/puppetlabs/puppetserver/

stop the puppetserver and run the puppet certificate generation in master node again.