Puppet is an open-source and automation admin engine. It’s used to manage server remotely and do administrative tasks. This tool is available on cross platform like Linux, Unix, and Windows. In this tutorial we will show you how to install Puppet on master and client nodes on Ubuntu 20.04 systems.
Prerequisites
- You need two or more Ubuntu systems for master and client nodes
- Should have sudo access of all the systems.
- All systems should connected over public or private network.
Install Puppet on Ubuntu
Perform the following steps to install puppet on Ubuntu 20.04 system:
Step 1 – Update Package List
Before starting the installation process, you should update the list of available packages by typing:
sudo apt-get update -y
Step 2 – Configure Hosts
With Puppet, master and client nodes communicate using hostnames. Before installing Puppet, you need to set up a unique hostname on each node.
- Edit the hosts file on each node by using:
sudo nano /etc/hosts
2. Add the following lines to the each file:
106.16.14.230 puppetmaster puppet
106.16.18.104 puppetclient
Here,
- 106.16.14.230 is the IP address of the master node.
- 106.16.18.104 is the IP address of the client node.
Make sure, you should change IP address which your system have.
You can also add more client nodes by adding ip address as above.
3. Save and close the file.
Step 3 – Install Puppet Server on Master Node
Login to your master node with root or user with sudo privileges.
- Download the latest Puppet version on the master node:
wget https://apt.puppetlabs.com/puppet7-release-focal.deb
2. Install the downloaded package by using
sudo dpkg -i puppet7-release-focal.deb
3. Once you added the PPA, update Apt cache and install the Puppet server with the following command:
sudo apt update
sudo apt install puppetserver -y
4. Install the Puppet server with the following command:
sudo apt-get install puppetserver -y
5. On successful installation of all the Puppet packages. Edit the puppet server file by using:
sudo nano /etc/default/puppetserver
The default puppet server file configured to use 2GB of memory. In case your server doesn’t have enough memory. Reduce the memory size to 1GB or any other value:
JAVA_ARGS="-Xms1g -Xmx1g -Djruby.logger.class=com.puppetlabs.jruby_utils.jruby.Slf4jLogger"
6. Save and close file. To save file with nano editor press Ctrl + X and then type Y to save the changes.
7. Start the Puppet service and set it to launch on system boot by using:
sudo systemctl start puppetserver
sudo systemctl enable puppetserver
8. Verify the service status using:
sudo systemctl status puppetserver
You will see that the service status as running.
Now, we will start configuration of all client node.
Step 4 – Install Puppet Agent on Client Node
Once again, make sure that you have configured the hosts file as per step 1.
- Download and install the latest version of Puppet on a client node:
wget https://apt.puppetlabs.com/puppet7-release-focal.deb
sudo dpkg -i puppet7-release-focal.deb
2. Once you configured the PPA, Install the Puppet agent package on all client servers.
sudo apt update
sudo apt install puppet-agent -y
3. Open the Puppet configuration file once the installation finished:
sudo nano /etc/puppetlabs/puppet/puppet.conf
Add the following lines at the end of the Puppet configuration file to define the Puppet master node details:
[main]
certname = puppetclient
server = puppetmaster
Save your file and close it.
4. Next, start the Puppet agent service on all the client nodes and set it to auto-start on system boot:
sudo systemctl start puppet
sudo systemctl enable puppet
5. Verify the Puppet agent service is running properly:
sudo systemctl status puppet
You will see a running status on all the agent systems.
Step 5 – Sign Puppet Agent Certificate
- At this stage, you have completed all the configuration. Now, login to the master node and execute the following commands to get list of all available certificates:
sudo /opt/puppetlabs/bin/puppetserver ca list --all
2. Sign the certificates with:
sudo /opt/puppetlabs/bin/puppetserver ca sign --all
3. Finally, use the following command to test the communication between the master and client nodes:
sudo /opt/puppetlabs/bin/puppet agent --test
Conclusion
You have successfully installed Puppet on Ubuntu 20.04 system. In this tutorial you learned how to install and configure Puppet on master and client nodes.
Visit Puppet official documentation to know more about Puppet server node configuration and client node configuration.