Linux

Install Puppet 3 on CentOS 6.4

How to install Puppet 3 including the Dashboard on CentOS 6.4

Install the Puppet Packages

  • Add the Puppet Labs Yum Repo to your CentOS 6.4 installation
  • rpm -ivh https://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm

  • Add the EPEL Yum Repo to your CentOS 6.4 installation
  • rpm -ivh http://ftp.nluug.nl/pub/os/Linux/distr/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm

  • Install the Puppet Master and the puppet client
  • yum -y install puppet-server puppet

Configure Puppet Master

  • After installation, edit the config file /etc/puppet/puppet.conf and add a master entry
  • [master]
    certname = puppetmaster
    autosign = true

    (change puppetmaster to the FQDN of your puppetmaster server)

  • Install the Puppet Client

Configure Puppet Client

  • After installation, edit the config file /etc/sysconfig/puppet and uncomment the PUPPET_LOG and PUPPET_SERVER lines. specifying the servers address.
  • # The puppetmaster server
    PUPPET_SERVER=puppet
     
    # If you wish to specify the port to connect to do so here
    #PUPPET_PORT=8140
     
    # Where to log to. Specify syslog to send log messages to the system log.
    PUPPET_LOG=/var/log/puppet/puppet.log
     
    # You may specify other parameters to the puppet client here
    #PUPPET_EXTRA_OPTS=--waitforcert=500

    (Don’t forget to change PUPPET_SERVER=puppet to your puppetmaster servers address)

  • Once installed, start the services and make sure they startup at boot
  • service puppetmaster start
    service puppet start

    chkconfig puppetmaster on
    chkconfig puppet on

Install and Configure the Puppet Dashboard

Puppet Dashboard is a Ruby on Rails web app that interfaces with Puppet.

  • Install Puppet Dashboard Packages
  • yum -y install puppet-dashboard

  • Install MySQL
  • yum -y install mysql-server
    service mysqld start

  • set the MySQL root user’s password
  • /usr/bin/mysqladmin -u root password 'new-password'

  • Create a database and database user:
  • mysql -u root -p
    mysql> CREATE DATABASE dashboard CHARACTER SET utf8;
    mysql> CREATE USER 'dashboard'@'localhost' IDENTIFIED BY 'secret_password';
    mysql> GRANT ALL PRIVILEGES ON dashboard.* TO 'dashboard'@'localhost';

  • Edit the config file /usr/share/puppet-dashboard/config/database.yml
  • production:
    database: dashboard
    username: dashboard
    password: secret_password
    encoding: utf8
    adapter: mysql
     
    development:
    database: dashboard
    username: dashboard
    password: secret_password
    encoding: utf8
    adapter: mysql

  • Populate the database
  • cd /usr/share/puppet-dashboard
    rake db:migrate

  • Start the Dashboard
  • service puppet-dashboard start
    service puppet-dashboard-workers start

  • Open a browser, go to http://<your_puppet_master:3000> and check if it’s working:

Install Puppet 3 client

  • Add the Puppet Labs Yum Repo to your CentOS 6.4 installation
  • rpm -ivh https://yum.puppetlabs.com/el/6/products/i386/puppetlabs-release-6-7.noarch.rpm

  • Install the Puppet Client
  • yum -y install puppet

  • Edit the config file /etc/puppet/puppet.conf and add ‘report = true’ to the [agent] section
  • [agent]
    # The file in which puppetd stores a list of the classes
    # associated with the retrieved configuratiion. Can be loaded in
    # the separate ``puppet`` executable using the ``--loadclasses``
    # option.
    # The default value is '$confdir/classes.txt'.
    classfile = $vardir/classes.txt
     
    # Where puppetd caches the local configuration. An
    # extension indicating the cache format is added automatically.
    # The default value is '$confdir/localconfig'.
    localconfig = $vardir/localconfig
    report = true

  • Start the service and make sure it starts up at boot
  • service puppet start
    chkconfig puppet on

Serving Dashboard With Passenger and Apache

Install Apache and Passenger.
Passenger (mod_rails) is a Apache module which lets you run Rails or Rack applications inside a web server, like Apache.Passenger is the recommended deployment method for puppet masters.

  • Install the apache and ruby packages
  • yum -y install httpd mod_ssl rubygems rubygem-rack rubygem-passenger-native-libs rubygem-passenger-native rubygem-passenger rubygem-fastthread libev

  • Install the Passenger apache module
  • yum install mod_passenger -y

  • Create a virtual host: puppetmaster.conf
  • vim /etc/httpd/conf.d/puppetmaster.conf
    Listen 8140
    LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-4.0.5/libout/apache2/mod_passenger.so
    PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-4.0.5
    PassengerDefaultRuby /usr/bin/ruby
     
    # And the passenger performance tuning settings:
    PassengerHighPerformance On
    # Set this to about 1.5 times the number of CPU cores in your master:
    PassengerMaxPoolSize 2
    # Recycle master processes after they service 1000 requests
    PassengerMaxRequests 1000
    # Stop processes if they sit idle for 10 minutes
    PassengerPoolIdleTime 600
     
    <VirtualHost *:8140>
    ServerName YOUR.DOMAIN.COM
    SSLEngine on
    SSLCipherSuite SSLv2:-LOW:-EXPORT:RC4+RSA
    #ensure the certfiles are correct for puppet master
    SSLCertificateFile /var/lib/puppet/ssl/certs/hostname.domainname.com.pem
    SSLCertificateKeyFile /var/lib/puppet/ssl/private_keys/hostname.domainname.com.pem
    SSLCertificateChainFile /var/lib/puppet/ssl/ca/ca_crt.pem
    SSLCACertificateFile /var/lib/puppet/ssl/ca/ca_crt.pem
    # CRL checking should be enabled; if you have problems with Apache complaining about the CRL, disable the next line
    SSLCARevocationFile /var/lib/puppet/ssl/ca/ca_crl.pem
    SSLVerifyClient optional
    SSLVerifyDepth 1
    SSLOptions +StdEnvVars
    # The following client headers allow the same configuration to work with Pound.
    RequestHeader set X-SSL-Subject %{SSL_CLIENT_S_DN}e
    RequestHeader set X-Client-DN %{SSL_CLIENT_S_DN}e
    RequestHeader set X-Client-Verify %{SSL_CLIENT_VERIFY}e
     
    DocumentRoot /usr/share/puppet/rack/puppetmasterd/public/
    <Directory /usr/share/puppet/rack/puppetmasterd/>
    Options None
    AllowOverride None
    Order allow,deny
    allow from all
    </Directory>
    </VirtualHost>

    (Change the path/filenames for the SSLCertificateFile and SSLCertificateKeyFile and the ServerName.)

  • Copy the Ruby application to the correct directory
  • cp /usr/share/puppet/ext/rack/files/config.ru /usr/share/puppet-dashboard/

  • Change the owner of the config.ru file to puppet
  • chown puppet /usr/share/puppet-dashboard/config.ru

  • Create the following directory, to avoid some connection errors
  • mkdir /var/lib/puppet/.puppet
    chown puppet.puppet /var/lib/puppet/.puppet

  • Disable the WEBrick puppet master service startup at boot and enable apache service.
  • Edit puppet.conf, add to you master section:
  • [master]
    reports = puppet_dashboard,store
    reportdir = /var/lib/puppet/reports
    reporturl = http://your.domain.com:4000/reports

  • Add the dashboard apache config file to the conf.d dir.
  • vi /etc/httpd/conf.d/dashboard.conf
    Listen 4000
    <VirtualHost *:4000>
    ServerName PUPPET.DOMAIN.COM
    DocumentRoot /usr/share/puppet-dashboard/public/
    <Directory /usr/share/puppet-dashboard/public/>
    Options None
    Order allow,deny
    allow from all
    </Directory>
    ErrorLog /var/log/httpd/dashboard.DOMAIN.COM_error.log
    LogLevel warn
    CustomLog /var/log/httpd/dashboard.DOMAIN.COM_access.log combined
    ServerSignature On
    </VirtualHost>

    Don’t forget to edit the Servername

    chkconfig puppetmaster off
    chkconfig httpd on
    service httpd restart

  • Open a browser, go to http://<your_puppet_master:3000> and check if it’s working:

3 Responses to “Install Puppet 3 on CentOS 6.4”

  1. nicetry

    doesnt work. nice try though.

  2. Stephan

    when running

    rake db:migrate

    it tells me

    Access denied for user ‘dashboard’@’localhost’ to database ‘dashboard_development’

    password is set in config/database.yaml

  3. Al Cord

    >doesnt work. nice try though.

    What doesn’t work? When the browser opens you do get the Puppet Dashboard. :{

Leave a Reply


}) _0- O-) ;) ;( :{ :o :Y :X :P :N :D :@ :? :9~ :) :(