Need to set up a Puppet server on AlmaLinux 9?
I have you covered.
Puppet empowers people with automation software to scale infrastructures. Installing and configuring a Puppet server could be tricky. In this comprehensive guide, I’ll walk you through step-by-step setting up your server on AlmaLinux 9.
Let’s dive in.
What You’ll Need
Before going into the steps, let’s have a quick look at the things you’ll require to follow this tutorial:
- Two AlmaLinux 9 servers are installed and running (guide)
- Familiarity with the Command Line Interface (CLI) and CLI commands (guide)
- Root account or sudo privileges (guide)
- Your registered domains
- A stable internet connection
Let’s now jump into the steps of installing Puppet on AlmaLinux.
How to Install Puppet on AlmaLinux 9: Step-By-Step
Step 1: Enable the Puppet Platform Repository
The first thing you need to do is add Puppet’s repository to the repository list on your system.
Doing this will allow your system to install packages from that repository.
- First, identify the package URL you intend to enable on your device. You can find the list here. For this tutorial, I’m going to go with Puppet 7. So the URL for that package is as follows:
https://yum.puppet.com/puppet7-release-el-9.noarch.rpm
- Next, enable that package URL using the below command:
sudo rpm -Uvh https://yum.puppet.com/puppet7-release-el-9.noarch.rpm
Doing so should enable the targeted URL to allow installations on your system.
- To ensure that the process was successful, run the below command:
sudo dnf repolist
If you notice Puppet in this list, then it means the repository was enabled successfully.
Step 2: Install and Configure Puppet Server
If you’ve enabled the Puppet repository, then you’re ready to start installing it.
- Update your system so that you have access to the latest packages using the command below:
sudo dnf update
- Next, install the Puppet server on one AlmaLinux system using this command:
sudo yum install puppetserver
- During the installation, you’ll be asked to confirm whether you want to import the GPG key. Enter y (as shown in the above screenshot) and press the Enter button.
- After that, you must add the Puppet server’s binary directory to your system so that you can start using the commands related to the package. For this, run the below commands:
source /etc/profile.d/puppet-agent.sh
echo $PATH
- To ensure the installation was successful, you can check the current version of Puppet using this command:
puppetserver -v
- If you’re done installing Puppet, then you need to start its service in case it’s not active by default:
sudo systemctl start puppetserver
- Lastly, find the exact binary Puppet file with this command:
which puppetserver
The output shows the directory of the said binary file.
Step 3: Install Puppet Agent
Puppet agents are packages that transform code into executable commands. You will install the agent on the remaining AlmaLinux system.
- Go into the device where you want to install the agent package.
- Install Puppet agent with this command:
sudo yum install puppet-agent
When prompted to use the GPG key, enter y to confirm.
- Similar to what you did with the Puppet server package, you should load the Puppet agent system profile to your system. Do that by running the below commands:
source /etc/profile.d/puppet-agent.sh
echo $PATH
- Next, find the binary file for the Puppet agent and check its version with the following commands:
which puppet
puppet --version
- If everything goes well, start the Puppet agent service and enable it using the below commands:
sudo systemctl start puppet
sudo systemctl enable puppet
- You can also check the service status to confirm it’s active. Check the status with the below command:
sudo systemctl status puppet
As you can see from the above screenshot, it’s active and running. So that takes care of setting up the Puppet agent on the agent machine.
Step 4: Connect the Server Machine to the Agent Machine
I’ve installed and configured the Puppet server on the primary machine and the agent on the secondary machine. In this last step, I will connect both so that they can communicate with each other.
For easier recognition, let’s call the primary server machine Alma1 and the agent machine Alma2. Let’s name the primary domain as primarydomain.com and the agent one as agentdomain.com.
Let’s proceed.
- First, you need to set Alma1 as the primary machine that the agent can connect to. Do that with this command:
puppet config set server primarydomain.com --section agent
- You also must set it as the Certification server so that you can verify the agents that want to connect. Set it as a CA server with the following command:
puppet config set ca_server primarydomain.com --section agent
- Make sure that the setup is correct from the configuration file. To open the config file, run the below command:
cat /etc/puppetlabs/puppet/puppet.conf
- After that, you need to restart the Puppet service to have the changes take effect:
sudo systemctl restart puppet
- To verify, check Puppet’s status with the following command:
sudo systemctl status puppet
- Let’s now start the connection between the primary server and the agent:
puppet ssl bootstrap
Note: If you’re using a Puppet 5 agent, the command for that will be: puppet agent –test
- Go back to Alma1 and sign the certificate. To sign it, run the below command:
sudo puppetserver ca sign --certname agentdomain.com
- After signing the certificate, the screen should display a success message. If you want to be sure that the signing was successful, list all the signed certificates with this command:
puppetserver ca list --all
- Lastly, go to Alma2, which is the agent machine. Run the agent once more with this command:
puppet ssl bootstrap
That’s pretty much it! You now should have a fully configured Puppet server running on AlmaLinux 9 with a connected agent.
Conclusion
This tutorial guides you through the process of installing Puppet on AlmaLinux 9.
I’ve covered how to install a Puppet server and a Puppet agent before proceeding to connect both machines to establish communication. If you’re interested in other Puppet products, check out their free trial.
Want to know more about setting up servers on Linux? Learn how you can install Lighttpd Server on Ubuntu or install Froxlor Server Management on Debian.
If this guide helped you, please share it.