How to install Puppet on Ubuntu

Puppet is a powerful tool to automate server configuration, deploy updates or other configuration, and manage multiple systems at once. Puppet also has its own programming language, which is easy to understand even for inexperienced programmrs. The application is free, open source, and can be installed on Ubuntu Linux.

In this tutorial, we will take you through the step by step instructions of installing Puppet on Ubuntu Linux via the command line. Then, we will create a Hello World script to ensure proper installation and that Puppet works as intended.

In this tutorial you will learn:

  • How to download and install Puppet on Ubuntu
  • How to create a Hello World script in Puppet
How to install Puppet on Ubuntu
How to install Puppet on Ubuntu
Software Requirements and Linux Command Line Conventions
Category Requirements, Conventions or Software Version Used
System Any Ubuntu Linux based system
Software Puppet
Other Privileged access to your Linux system as root or via the sudo command.
Conventions # – requires given linux commands to be executed with root privileges either directly as a root user or by use of sudo command
$ – requires given linux commands to be executed as a regular non-privileged user

How to install Puppet on Ubuntu step by step instructions



  1. Start by opening a command line terminal and typing the following two commands to install Puppet and its dependencies.
    $ sudo apt update
    $ sudo apt install puppet
    
  2. After a successful execution of the above command check the puppet version to get a first indication of working puppet manager on your system.
    $ puppet --version
    
  3. Next, let’s run a simple Hello World script by executing the following one liner.
    $ puppet apply -e 'file { "/tmp/puppet-test": content => "Hello World!\n" }'
    

    You should get some output that looks like this:

    Notice: Compiled catalog for linuxconfig.localdomain in environment production in 0.01 seconds
    Notice: /Stage[main]/Main/File[/tmp/puppet-test]/ensure: defined content as '{md5}8ddd8be4b179a529afa5f2ffae4b9858'
    Notice: Applied catalog in 0.01 seconds
    
  4. You can then verify that the file has been generated.
    $ cat /tmp/puppet-test
    Hello World!
    
  5. Congratulations, your Puppet installation is working as expected. See what other commands are available in Puppet by executing:
    $ puppet help
    

Closing Thoughts




In this tutorial, we saw how to install the Puppet automation and delivery tool on an Ubuntu Linux system. Puppet is an ideal tool for complex deployments and large environments. Puppet features its own declarative language which will require a small time investment to learn but proves very worth it for the power you get in return.