Install Puppet and Run Your First Manifest: puppet apply, Resources and Lab Setup

Puppet Training Course 22 min min read Updated: Nov 17, 2026 Beginner
Install Puppet and Run Your First Manifest: puppet apply, Resources and Lab Setup
Beginner Topic 2 of 3

Lab Setup Options

OptionNotes
Docker container (easiest)Disposable Linux machine. Services may be limited (no systemd by default), so use it for files, packages and users
VM (VirtualBox, VMware, cloud VM)Closest to real servers. Needed for service management practice
VagrantScripted VMs, great for multi-node labs
Cloud free tierRealistic, remember to delete when done
Safety: Puppet changes the system it runs on (packages, users, files). Practice in a VM or container, not on your main laptop. Use --noop first to preview changes.

Install the Agent

Which packages? Puppet packages from Perforce (Puppet Core) are distributed from a private, authenticated repository and require registration. The community OpenVox packages are public and free, and give you the same puppet command. Check the OpenVox and Puppet documentation for the current repository setup. The examples below show the typical pattern for OpenVox on Ubuntu.
bash # Start a clean Ubuntu container to practice docker run -it --name puppetlab ubuntu:24.04 bash # Inside the container: install helper tools apt-get update && apt-get install -y curl wget gnupg lsb-release # Install the OpenVox release package for your OS from the OpenVox download page # (check https://voxpupuli.org/openvox/ for the current repo package URL), then: apt-get update apt-get install -y openvox-agent # The agent installs under /opt/puppetlabs export PATH=/opt/puppetlabs/bin:$PATH puppet --version facter --versio
bash # RHEL / Rocky / Alma (pattern) sudo dnf install -y https://yum.voxpupuli.org/...-release-el9.noarch.rpm # use the exact URL from the docs sudo dnf install -y openvox-agent source /etc/profile.d/puppet-agent.sh puppet --versio
Docker note: The agent package puts commands in /opt/puppetlabs/bin, which is not in PATH by default. Add it with export PATH=/opt/puppetlabs/bin:$PATH, or put it in ~/.bashrc.

Important Paths

PathPurpose
/opt/puppetlabs/bin/Commands: puppet, facter, hiera
/etc/puppetlabs/puppet/puppet.confMain settings
/etc/puppetlabs/code/environments/production/Code for the production environment: manifests/, modules/, data/, hiera.yaml
/etc/puppetlabs/puppet/ssl/Certificates
/opt/puppetlabs/puppet/cache/Cached catalogs, state, reports
/var/log/puppetlabs/Logs of the agent, server and PuppetDB

Your First Manifest

bash mkdir -p ~/puppet-lab && cd ~/puppet-lab cat > hello.pp <<'EOF' file { '/tmp/hello.txt': ensure => file, content => "Hello from Puppet\n", mode => '0644', } EOF puppet apply hello.pp --noop # preview only: nothing changes puppet apply hello.pp # apply for real cat /tmp/hello.txt puppet apply hello.pp # run again: no changes, because it is idempotent
Result

First run: Notice: /Stage[main]/Main/File[/tmp/hello.txt]/ensure: defined content as .... Second run: no change messages. That is idempotency.

Reading Puppet Output

PrefixMeaning
Notice:Information, including changes made
Warning:Something is deprecated or suspicious
Error:A resource failed or the code is wrong
Info: / Debug:More detail with --verbose or --debug
bash puppet apply hello.pp --noop --verbose puppet apply hello.pp --debug 2>&1 | tail -30 puppet apply -e 'notice("quick test: ${facts["os"]["name"]}")' # run a one-liner

Inspect and Change Resources from the Command Line

bash puppet resource user root # show the current state of the root user as Puppet code puppet resource package curl puppet resource service ssh puppet resource file /etc/hostname puppet resource host # all host entries puppet resource package tree ensure=installed # install a package using a one-liner puppet describe package # documentation of the package type puppet describe user --providers # which providers exist puppet resource --types # list all resource types
puppet resource: It is a quick way to read state and to write code from reality. For example puppet resource user alice prints a complete user { 'alice': ... } block you can paste into a manifest.

Check Settings

bash puppet config print environment puppet config print server puppet config print codedir puppet config print --section agent runinterval puppet config set environment production --section agent

A Slightly Bigger First Manifest

puppet # site-setup.pp $app_user = 'appuser' group { $app_user: ensure => present, } user { $app_user: ensure => present, gid => $app_user, home => "/home/${app_user}", managehome => true, shell => '/bin/bash', require => Group[$app_user], } file { '/opt/myapp': ensure => directory, owner => $app_user, group => $app_user, mode => '0750', require => User[$app_user], } file { '/opt/myapp/README.txt': ensure => file, owner => $app_user, content => "Managed by Puppet. Do not edit by hand.\n", } package { ['curl', 'htop', 'tree']: ensure => installed, }
bash puppet parser validate site-setup.pp # syntax check puppet apply site-setup.pp --noop # preview puppet apply site-setup.pp id appuser; ls -ld /opt/myapp

Common Problems

ProblemFix
puppet: command not foundAdd /opt/puppetlabs/bin to PATH
Could not find declared class or Unknown resource typeCheck spelling, or that the module is installed
Evaluation Error: Syntax errorCheck commas, braces and quotes. Run puppet parser validate
Service resource fails in DockerNo init system. Use a VM, or skip service tests in containers
Could not retrieve catalog from remote serverThat is an agent talking to a server. For learning use puppet apply

Practice Tasks

  1. Create a Docker or VM lab and install the agent
  2. Write a manifest that creates /tmp/info.txt and run it twice. Compare the outputs
  3. Use puppet resource to print the state of a user and then reproduce it in a manifest
  4. Run with --noop and then --debug and read the extra output
  5. Delete the file by hand and run again to watch Puppet repair it

Conclusion

You installed the agent, ran manifests with puppet apply, previewed with --noop and explored resources with puppet resource. Everything later in the course builds on these commands.

Quick Summary: puppet apply file.pp; --noop first; puppet parser validate; puppet resource to read state; PATH /opt/puppetlabs/bin.

Get Newsletter

Subscibe to our newsletter and we will notify you about the newest updates on Edugators