Building a LAMP system using Puppet

I have always been interested in sysadmin, however the thing that annoyed me was trying to remember the config file contents. Back in the day when I used to work for Boss Pacific Information Systems, I would find the idea of setting up servers very interesting. In the mean time, the tedious task of remembering which config file to change and what to change was a bit daunting.

Recently, I have been introduced to Puppet script which has been used in my work environment has proven its importance.

“Puppet manages your servers: you describe machine configurations in an easy-to-read declarative language, and Puppet will bring your systems into the desired state and keep them there.”

This tutorial will show you how to create a simple puppet script to build a LAMP system which is the base for any web system. The components required for a web system such as apache, mysql etc are all available as modules from Puppet Forge

First things first, install puppet using yum

yum install puppet-server puppet

By default puppet is installed in /etc/puppet path.

Now onto installing web server components, you have to be in /etc/puppet/modules path and run the following commands.

puppet module install puppetlabs/apache
puppet module install puppetlabs/mysql
puppet module install rabinshr/rabinshr_phpmyadmin_1_0

The above commands will install puppet modules for apache and mysql. To learn more about installing modules, visit the documentation here.

We now have the modules ready, its now time to create a manifest file that will use these modules and create a web server. My manifest file has the following code:

node puppet{
    $db_password = 'db_password_here'
    include apache
    include apache::mod::php
        config_hash => {'root_password' => $db_password}

    class { 'phpmyadmin':
        db_user     => '',
        db_password => '',
        blowfish    => 'abcedf1234true',

To create a new database you can add the following code to your manifest:

	user => 'root',
	password => 'db_password_here'

To run this manifest, simply execute the following command.

puppet apply path_to_your_manifest_file

2 thoughts on “Building a LAMP system using Puppet

  1. Excellent beat ! I wish to apprentice whilst you amend your web site, how can i subscribe for a blog web site? The account helped me a applicable deal. I had been tiny bit familiar of this your broadcast offered bright transparent concept

  2. Good web site! I really love how it is simple on my eyes and the data are well written. I am wondering how I might be notified when a new post has been made. I have subscribed to your RSS which must do the trick! Have a great day!

Leave a Reply

Your email address will not be published. Required fields are marked *