Ok, so you’re interested in this whole Puppet thing, and you want to get a full install in your test environment, or on a set of VMs to work and play with the product. PuppetLabs has a ton of really cool documentation, and you should certainly avail yourself of it, but I wanted to give you a quick “cookbook” style set of instructions to get you rolling.
There is a lot of documentation surrounding the Puppet Master installation at Puppet Labs, but I find a bit of obfuscation when trying to parse through the huge pile of meat that is there, when all we’re looking for is the best of it… you know, the bacon. :)
Puppet Code Repository & Package Source
Puppet Labs provides a myriad of repositories and methods by which to install Puppet. I tend to stick with the main PuppetLabs repository whenever possible. I also tend to like RedHat derivatives, so I’ll be talking about RHEL here, but the same applies to CentOS, Scientific Linux, and other RHEL “children” in the ecosystem. In short, if you’re using something else other than RHEL, you may find yourself hunting packages and repos that contain packages you’ll need that the repositories I list here have by default. As with any web-based documentation, YMMV.
Installing the Puppet Master
First, you’ll need a functioning Installation of RHEL upon which to install and configure Puppet. I like to include only the “Base Install” and take the “Defaults” when doing a “special purpose” server, as it doesn’t muddy the waters and it gives you the cleanest slate possible upon which to build your Puppet platform.
Enabling the RHEL Yum Repo
As I’m sure you’re aware, to use RedHat’s repositories, you have to register and have active a subscription with RedHat. To do a simple connection/attachment to the RedHat repositories, I’ve found a mixture of success with the Subscription Manager. However, by performing the following commands (some are redundant), I’ve been able to get the configuration working with 100% reliability:
sudo subscription-manager register
sudo subscription-manager auto-attach
sudo subscription-manager attach –auto
sudo subscription-manager refresh
Obviously, this is a RedHat topic, and not a Puppet one, so if you’re having issues with this process, contact Redhat for help. The crux of this, however, is to just register your instance.
Installing the Puppet Labs Software Repository
Since I’m working with the current 6.10 release of Puppet, the package you need to install can be added by running:
_**sudo rpm -ivh https://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-10.noarch.rpm**_
This will install the current 6.10 release of the Puppet repo from which we can continue with the Puppet Master installation.
Enabling Additional Packages
Next, we need to have the “optional” set of packages from RedHat and the development packages from Puppet Labs. There are two ways to do this. First, you can edit each repo file in /etc/yum.repos.d (red hat.repo and puppet labs.repo respectively) and change the “enable” flag on each repository from “0” to “1”, or you can simply run the provided RedHat Yum configuration manager tool to do it for you as follows.
sudo yum -y install yum-utils
sudo yum-config-manager –enable rhel-6-server-optional-rpms
sudo yum-config-manager –enable puppetlabs-devel
Bring your current host completely up to date by querying the repositories and running the yum updater:
sudo yum -y update
As I’m sure you’re aware, depending on the updates released since the current major version of your repositories, the update time can vary from very short to quite some time. Just be patient and get up to date before proceeding.
Install the Puppet Prerequisite Packages
This step name is a bit of a misnomer in that I am including a ton of packages that aren’t necessary for a “base” install of Puppet Server, but they do support later installations you may wish to do (like PuppetDB, Dashboard, Passenger, etc.). I just wanted to give a complete list so there’s no after-installation required just to get moving with the next component. Simply install the following via Yum:
sudo yum -y install gcc libcurl-devel gcc-c++ openssl openssl-devel ruby-devel httpd httpd-devel mod_ssl policycoreutils-python apr-devel apr-utils-devel
Prep Your Firewall
You may or may not be using the IPTables Firewall, but you’ll want the following rule in place to support the Puppet Master port. Simply insert the following line into your /etc/sysconfig/iptables file.
-A INPUT -m state –state NEW -m tcp -p tcp –dport 8140 -j ACCEPT
Note that if you intend to install the Puppet Dashboard as well, you can add that port here too.
-A INPUT -m state –state NEW -m tcp -p tcp –dport 3000 -j ACCEPT
Make sure you place your firewall rules in the appropriate place in the file. While outside the scope of this article, IPTables has an order and a format you should follow. You can find out more here.
Lastly, restart your firewall to pick up the new rules:
sudo service iptables reload
Install Puppet Server
After all the above work, if you’ve had no repository or package errors, your system should be ready to install Puppet Server. Simply run the following:
yum -y install puppet-server
And that should be it. All packages installed, base RedHat updated with all the latest Ruby & RedHat goodness, and the bad Puppet Server installed and ready for action.
Next time: Installing the Puppet Client.