How to Install Puppet on Ubuntu Server

Puppet is a configuration management tool commonly used by system administrators to automate the provisioning and configuration of servers. In this tutorial, we will show you how to install Puppet on Ubuntu Server and get started with its usage.

Prerequisites

To install Puppet on your Ubuntu Server, you need to have the following prerequisites:

Step 1: Installing Puppet Repository

Puppet provides a repository to make it easy to install and update. Follow these steps to add the Puppet repository to your Ubuntu Server:

  1. Log in to your Ubuntu Server.
  2. Open the terminal application.
  3. Run the following command to download and add the Puppet repository:
$ wget https://apt.puppetlabs.com/puppet6-release-bionic.deb
$ sudo dpkg -i puppet6-release-bionic.deb

Step 2: Installing Puppet Server and Agent

After adding the Puppet repository, you can now go ahead and install the Puppet server and agent. Here is how to do it:

  1. Run the following command to update the local repository:
$ sudo apt update
  1. To install the Puppet server and agent, run the following command:
$ sudo apt install puppetserver puppet-agent
  1. After the installation is complete, start the Puppet server by running the following command:
$ sudo systemctl start puppetserver

Step 3: Configuring the Puppet Agent

Now that you have installed the Puppet server and agent, you need to configure the agent to connect to the server. Here is how to do it:

  1. Open the /etc/puppetlabs/puppet/puppet.conf file using your favorite text editor.
$ sudo nano /etc/puppetlabs/puppet/puppet.conf
  1. Add the following lines to the file to set up the Puppet server:
[agent]
server = <PUPPET_SERVER_IP_ADDRESS>
  1. Save the file and exit.

  2. Restart the puppet agent by running the following command:

$ sudo systemctl restart puppet-agent

Step 4: Performing a Test Run

To verify that the Puppet server and agent are set up properly, you can perform a test run. Here is how to do it:

  1. On the Puppet server, run the following command to create a test manifest file.
$ sudo nano /etc/puppetlabs/code/environments/production/manifests/site.pp
  1. Add the following lines to the file:
node default {
  file { '/tmp/testfile.txt':
    content => "Hello Puppet!\n",
  }
}
  1. Save the file and exit.

  2. On the agent machine, run the following command to trigger a Puppet run:

$ sudo /opt/puppetlabs/bin/puppet agent --test
  1. After the Puppet run is complete, check the /tmp/testfile.txt file on the agent machine to confirm that it was created.

Conclusion

You have successfully installed Puppet on your Ubuntu Server and performed a test run. You can now configure more complex configurations and automate your infrastructure. Refer to the official Puppet documentation for more information on how to use Puppet.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!