Install and Configure Puppet 5

Last Update: Sep 05, 2024 | Published: Aug 02, 2018

1725496402 Servers Hero

SHARE ARTICLE

 

As a companion to my series on managing Windows Server with Puppet Enterprise, this short two-part article will guide you through installing your own Puppet 5 server on Red Hat Linux in Hyper-V.

If you are wondering why I’m writing about Linux on Petri, you might have missed my series of articles on managing Windows Server using Puppet. So far, there are seven parts and you can find the links below. Puppet is a more mature configuration management solution than Microsoft’s PowerShell Desired State Configuration (DSC) and natively manages both Windows and Linux.

Managing Windows Server with Puppet Part 1: Configure Puppet Master and Bootstrap the Puppet Agent in Windows Server
Managing Windows Server with Puppet Part 2: Log in to Puppet Master, Accept Node Certificate, and Test Connectivity
Managing Windows Server with Puppet Part 3: Install Modules and Edit the Site Manifest
Managing Windows Server with Puppet Part 4: Working with Files and ACLs
Managing Windows Server with Puppet Part 5: Managing Local Users and Groups
Managing Windows Server with Puppet Part 6: Installing, Updating, and Removing Software
Managing Windows Server with Puppet Part 7: Installing Active Directory

In the articles, I have been using a Puppet Master server automatically deployed in the Azure cloud using a template provided by Microsoft. But what if you want to install your own Puppet Master locally or in a virtual machine? That’s what I’m going to show you how to do in this article.

Download Red Hat Linux Enterprise

I must confess that I’m not a Linux expert. For the purposes of this article I’m going to use Red Hat Linux Enterprise (RHEL). There are several different Linux distributions that you could use for your Puppet Master server but I know that RHEL is officially supported by Puppet, that it works with Hyper-V, and that it is a commonly deployed Linux distribution. For more information on supported Linux distributions, see Puppet’s website here. The instructions that follow have been tested in RHEL and Hyper-V. I can’t promise that they will work with any other Linux distribution or hypervisor.

Unlike Windows, which will work for a time-limited period without activation, before you can do anything useful with RHEL, you’ll need to register and subscribe the OS. And before you can do that, you must have an active Red Hat Developer Program account and accept Red Hat’s T&Cs. If you don’t already have an account, sign up here. As part of the registration process, you’ll need to confirm your account by clicking on a link sent to you via email.

Once you have registered, logged in to your developer account and accepted the T&Cs, download the latest version of RHEL DVD ISO here. Save it to your local hard drive in the C:UsersPublicDownloads folder.

Create a New Hyper-V Virtual Machine

Now you have a registered developer account and have downloaded the RHEL DVD ISO, we can install Linux in Hyper-V on Windows 10 or Windows Server.

  • Open Hyper-V Manager. Type Hyper-V in the search box on the taskbar and select Hyper-V Manager from the search results. If your user account isn’t a member of the Hyper-V Administrators group, you’ll need to run Hyper-V Manager with an account that has local administrator privileges.

Note that if you are running the latest version of Windows 10 and you have compatible hardware, Hyper-V should already be installed. If not, you can install it by running the following command in an elevated PowerShell prompt:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Hyper-V -All
  • In Hyper-V Manager, create a new virtual machine. Make sure that your Hyper-V host is selected under Hyper-V Manager in the pane on the left and then select Quick Create from the Action menu. You may be required to enter an administrator username and password before you can continue.
  • In the Create a Virtual Machine dialog, click Local installation source.
  • Click Change installation source on the right and select the RHEL DVD ISO that you downloaded from Red Hat’s website.
  • Uncheck This virtual machine will run Windows (enables Windows Secure Boot).
  • Click More options in the bottom right corner.
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
  • Give the new VM a name and then click Create Virtual Machine.
  • After a few seconds, the VM should be ready for use. Click Connect to open a connection to the VM.
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)

Note that you will need Internet connectivity to download the components required for Puppet and to register and subscribe the OS. If you need to change any of the VM’s default settings, you can click Edit settings before connecting to the VM.

Install Red Hat Linux

Now we are ready to begin the Linux installation process.

  • Click Start in the virtual machine window.
  • On the boot screen, select Install Red Hat Enterprise Linux 7.4 and press ENTER.
  • On the welcome screen, select a language and click Continue.
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
  • On the INSTALLATION SUMMARY screen, click SOFTWARE SELECTION.
  • On the left below Base Environment, check Infrastructure Server.
  • On the right below Add-Ons for Selected Environment, check Guest Agents.
  • Click Done.
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
  • On the INSTALLATION SUMMARY screen, click INSTALLATION DESTINATION.
  • Click Done.
  • Click NETWORK & HOST NAME. Click the slider to the right of the Ethernet (eth0) adapter and set it to ON. The status of the adapter should change to Connected.
  • In the Host name box in the bottom left corner, give the OS a DNS name and then click Apply.
  • Click Done.
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
  • Back on the INSTALLATION SUMMARY screen, click Begin Installation.
  • On the CONFIGURATION screen under USER SETTINGS, click ROOT PASSWORD. Type and confirm a strong password for the root user account. If the password isn’t deemed strong enough, you’ll either need to change it or click Done twice to confirm you want to use a weak password.
  • Click Done.

Note that in a production environment, you should create at least one user account and use SUDO to elevate to root when required. To keep things simple, I will just use the root account in this demonstration.

Now sit back and wait for Linux to install. Don’t forget to click Reboot once the install has completed.

Register and Subscribe Red Hat Linux Enterprise Server

Once the server has rebooted, you’ll need to log in, register, and subscribe your copy of Red Hat.

  • At the login prompt, type root and press ENTER.
  • Enter the password for the root account that you set during the installation process, and press ENTER.
  • At the command prompt, type sudo -i and press ENTER. This will make sure that the following commands run with root privilege.
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
Install Red Hat Linux Enterprise in a Hyper-V virtual machine (Image Credit: Russell Smith)
  • Optionally, run ping google.com to check you have Internet connectivity. To stop ping on Linux, press CTRL+C.
  • Type subscription-manager register and press ENTER. When prompted, enter the username and password for your Red Hat Developer Program account.
  • Type subscription-manager attach and press ENTER.

As a companion to my series on managing Windows Server with Puppet 5, this short two-part article will guide you through installing your own Puppet 5 server on Red Hat Linux in Hyper-V.

In the final part of this two-part article, I’m going to show you how to install Puppet 5 on Red Hat Linux. In the first part, I installed Red Hat Enterprise Linux (RHEL) in a Hyper-V virtual machine running on Windows 10. I also registered and subscribed RHEL using my Red Hat Developer Program account.

If you missed my series of articles on managing Windows Server using Puppet, here are the links to the pieces published so far.

Managing Windows Server with Puppet Part 1: Configure Puppet Master and Bootstrap the Puppet Agent in Windows Server
Managing Windows Server with Puppet Part 2: Log in to Puppet Master, Accept Node Certificate, and Test Connectivity
Managing Windows Server with Puppet Part 3: Install Modules and Edit the Site Manifest
Managing Windows Server with Puppet Part 4: Working with Files and ACLs
Managing Windows Server with Puppet Part 5: Managing Local Users and Groups
Managing Windows Server with Puppet Part 6: Installing, Updating, and Removing Software
Managing Windows Server with Puppet Part 7: Installing Active Directory

Download and Install Puppet

Let’s get started and install Puppet. The VM will need Internet connectivity to complete the steps below.

  • Boot the Red Hat VM using Hyper-V manager.
  • Log in to Red Hat using root. Type root at the login prompt. Type the password for the root account when prompted and press ENTER.
  • Type sudo -i and press ENTER to make sure the following commands run with elevated privilege.
  • Download the Puppet 5 repository using the rpm command as shown here:
rpm -Uvh https://yum.puppetlabs.com/puppet5/puppet5-release-el-7.noarch.rpm
  • Install Puppet server using yum:
yum install -y puppetserver
Install Puppet Enterprise in Red Hat Linux (Image Credit: Russell Smith)
Install Puppet 5 in Red Hat Linux (Image Credit: Russell Smith)

Configure Puppet

The next step is optional. I want to configure Puppet to use a maximum of 512MB of RAM because I want to assign the VM just 1GB of RAM. If you have enough available memory, you can skip this step and leave the default RAM assignment.

vi /etc/sysconfig/puppetserver
  • Change the JAVA_ARGS parameter so that it reads -Xms512m -Xmx512m
  • Quit vi and write the file to disk.
Install Puppet Enterprise in Red Hat Linux (Image Credit: Russell Smith)
Install Puppet 5 in Red Hat Linux (Image Credit: Russell Smith)
  • Edit the puppet.conf file to add the server name and certificate name.
vi $confdir/etc/puppetlabs/puppet/puppet.conf
  • Add the certname parameter to the existing [master] section of the file. The certname should be the same as the name of the Puppet Master server you will provide when installing agents. If the names don’t match, Puppet agents will fail to connect to the master.

certname = petripuppetmaster

  • Add the server parameter to the [master] section of the file. If the section doesn’t exist, add it to the file. The parameter is used to give the server a name.

[master]
server = petripuppetmaster

  • Quit vi and write the file to disk.
Install Puppet Enterprise in Red Hat Linux (Image Credit: Russell Smith)
Install Puppet 5 in Red Hat Linux (Image Credit: Russell Smith)
  • Configure the firewall using firewall-cmd to allow inbound tcp connections on port 8140:
firewall-cmd --permanent --zone=public --add-port=8140/tcp
firewall-cmd –reload
  • Now start and enable the Puppet Master service using systemctl. Enabling the service sets it to start automatically.
systemctl start puppetserver
systemctl enable puppetserver
Install Puppet Enterprise in Red Hat Linux (Image Credit: Russell Smith)
Install Puppet 5 in Red Hat Linux (Image Credit: Russell Smith)
  • Finally, restart the server to get access to the Puppet commands in the VM console.

Troubleshooting

That’s it! The Puppet Master is now ready to receive incoming requests from agents. You can check the status of your server using the following commands. Use puppet status to check the version number and whether the server is active. Netstat can be used to check that Puppet is listening on port 8140. Puppet is a Java application, so you’ll see Java and not Puppet listed in the command’s output.

Install Puppet Enterprise in Red Hat Linux (Image Credit: Russell Smith)
Install Puppet 5 in Red Hat Linux (Image Credit: Russell Smith)
systemctl status puppetserver
puppet status
netstat -anpl | grep 8140

Puppet relies on DNS, so make sure that you can access agents and servers by domain name. You can add entries to the hosts file on Linux using vi if necessary:

vi /etc/hosts

Additionally, the Puppet Master time and date must be in-sync with your Puppet agents. You can check the time, date, and time zone using the date command.

date

Don’t forget to follow my series on managing Windows Server using Puppet for more information on how to work with Puppet 5.

 

SHARE ARTICLE