Install Puppet on CentOS and RHEL

It’s easy to setup Puppet server and a client in CentOS and RHEL by following the easy-to-follow steps given in this guide. You will need ROOT access for the install and setup.

Pre-requisites (minimal):

Hardware & Software

CPU: 2 vCPU

RAM: 2GB

Hard Disk : 30GB

OS: CentOS, Red Hat Enterprise Linux v 6.x.x

Architecture : x64

Packages: puppet-server and puppet

Note: Make sure the Linux host is patched before install and config of Puppet

# yum update

Puppet Server Config

First start off with enabling the Repo for Puppetlabs.

# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm 

Then install Puppet on the host via yum

# yum -y install puppet-server

And then edit puppet.conf and add these lines in [main] section

# vi /etc/puppet/puppet.conf

server = puppet.server.com
dns_alt_names = puppet,puppet.server.com


NOTE: puppet.server.com would be replaced by your server hostname

Then start up Puppetmaster service and enable it at runtime

# service puppetmaster start
# chkconfig puppetmaster on

Puppet Client Config

First start off with enabling the Repo for Puppetlabs.

# rpm -ivh http://yum.puppetlabs.com/puppetlabs-release-el-6.noarch.rpm

Then install Puppet on the host via yum

# yum -y install puppet 

And then edit puppet.conf and add this line in [main] section

# vi /etc/puppet/puppet.conf

server = puppet.server.com

NOTE: puppet.server.com would be replaced by your server hostname

Then start up Puppet  service and enable it at runtime

# service puppet start
# chkconfig puppet on

Once you are done with starting the puppet service on the client, go onto the Puppet server and type this command for listing the puppet sign request from client.

Run this on your Puppet Server

# puppet cert list 

And then sign the cert request

# puppet cert sign puppet.client.com

Now as you are done with configuring Puppet let’s start with configuring a simple manifest which will make sure that apache is installed on the client host and install it if its missing.

Create a manifest file for Apache on Puppet Server at “/etc/puppet/manifests/site.pp”

# vi /etc/puppet/manifests/site.pp
node ‘puppet.client.com’ {
         package { ‘httpd’ :
         ensure => installed,
                 }
   }

And then run puppet agent on the client host

# puppet agent -t -vv

That’s it you should now have apache installed on the client host. This was a simple setup on Puppet between a server and a client.

I will be adding an article soon explaining how to puppetize/automate Nagios and enable NRPE monitoring.

Infra Related Articles....