DevOps Monkey Goodness

Install Puppet Open Source on Virtual Box – How To Series 1

There are lots of guides out there and the official Puppet documentation is a bit all over the place so I thought I’d try and put something a bit more concise together to install Puppet Open Source and Puppet Dashboard onto Virtual Box.

This series will start with the basics of installing Puppet Master onto Centos and move onto setting up Vagrant Puppet Agents.

Pre-requistes (Based on Windows 7):

– Install latest Virtual Box (https://www.virtualbox.org/wiki/Downloads)
– Download Centos 6.5 DVD 1 (http://centos.serverspace.co.uk/centos/6.5/isos/x86_64/CentOS-6.5-x86_64-bin-DVD1.iso)

Step 1 – How To Setup Centos On Virtual Box

  1. Having installed Virtual Box –  Create a new image:

  2. On the next screen configure the amount of memory – I’d go for 1024 to get started with /li>
  3. On the hard drive screen select “Create Hard Drive now”
  4. On the hard drive type screen leave the default VDI
  5. On the storage type screen you can leave the default “dynamic”
  6. On the storage size screen allocate some space – I go for 20gb
  7. Create the drive.
  8. Start the new image
     
  9. You will be prompted to select a startup disk:
     
  10. Browse to your downloaded Centos ISO file and click “Start”
  11. You will be presented with the Centos start Screen:
     
  12. Choose “Install or upgrade an existing system”
  13. Once the system reboots and starts you’ll be prompted to check the disks, skip the checks:
     
  14. You’ll be prompted at the Centos start screen, just continue through the prompts as they are self explanatory and choose the defaults until you get to the host name screen:
     
  15. Continue through the prompts, select your timezone and use the defaults for all other screens 
  16. When you get to select the type of server for testing and general useage you can select “
    NOTE: This is creating a local developer testing server, you wouldn’t select this option for a production server!
     
  17. Once Centos has been installed follow the on screen prompts to create a user and set a timezone
 

Step 2 – Configure Web Access on The Centos Virtual Box Server

At this point we have a base Centos installation but by default it won’t have access to the Internet which we will need to install Puppet.

  1.  See my previous post on How To Configure an Internet Connection for Centos

Step  3 – Centos Basic Prerequisite Checks and Setup

Before we delve into the puppet master installation we need to make sure some basics are in place.
NOTE: ensure you are running these commands with elevated (i.e. root) privileges

  1. The first thing I do is do make sure everything is up to date:
    # su –
    # yum update
  2. Double check that the internet is working:
    # ping www.google.com 
  3. Ensure you can ping the host, in my example I’ve used hostname puppet.master:
    # ping puppet.host
  4. The puppet.local address probably won’t resolve so add this to the hosts file:
    # nano /etc/hosts
  5. Add the following line
    127.0.0.1    puppet.local 
  6. Disable the firewall:
    # service iptables stop
    # chkconfig iptables off
  7. Set SELinux to permissive:
    # nano /etc/sysconfig/selinux
    Set SELINUX = permissive
  8. Reboot the server
    # reboot 

Step 4 – Install and Configure Puppet Master Open Source

Now that the base server has been configured we are ready to start installing Puppet Open Source on our Centos Virtual Box Server.

In this example for testing I’m not going to configure Apache but use the built in WEBrick setup.  In production this isn’t scaleable but for this purpose it’s quick and easy to get started.
NOTE:  We are running this as root.

  1. We need to add the Puppet repos:
    # su –
    # rpm -ivh https://yum.puppetlabs.com/el/6/products/x86_64/puppetlabs-release-6-7.noarch.rpm
    # rpm -ivh http://ftp.nluug.nl/pub/os/Linux/distr/fedora-epel/6/x86_64/epel-release-6-8.noarch.rpm
  2. Install Puppet
    # yum install -y puppet-server 
  3. Start Puppet
    # service puppetmaster start
  4. Ensure Puppet is set to auto start
    # puppet resource service puppetmaster ensure=running enable=true 
     
    Configure the Puppet Master 
  5. Puppets main configuration is located in /etc/puppet/puppet.conf.  Most Puppet masters are also agents so you’ll find the agent configuration here as well.  Anything you add to [MAIN] will be shared by the master and the agent:
    # nano /etc/puppet/puppet.conf 
  6. Add the following to the [main] section:
    server = puppet.local  

 

Step 4 – Install and Configure a Puppet Agent

Now we have a very basic puppet master setup lets install and configure the agent on the same server:

  1. Install the Puppet agent:
    # yum install -y puppet
  2. Configure the agent:
    # nano /etc/puppet/puppet.conf  
  3. Add the following to the [agent] section:
    report = true
    pluginsync = true
     
  4. Set the puppet agent to auto start
    # chkconfig puppet on
    # puppet agent –daemonize  
  5. Restart the agent just incase!
    # service puppet restart 
  6. At this point with our very basic setup we should be able to test the agent and ensure it’s connecting to the master:
    # puppet agent –test
     

 

No Comments Yet

Leave a Reply