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
- Having installed Virtual Box – Create a new image:
- On the next screen configure the amount of memory – I’d go for 1024 to get started with /li>
- On the hard drive screen select “Create Hard Drive now”
- On the hard drive type screen leave the default VDI
- On the storage type screen you can leave the default “dynamic”
- On the storage size screen allocate some space – I go for 20gb
- Create the drive.
- Start the new image
- You will be prompted to select a startup disk:
- Browse to your downloaded Centos ISO file and click “Start”
- You will be presented with the Centos start Screen:
- Choose “Install or upgrade an existing system”
- Once the system reboots and starts you’ll be prompted to check the disks, skip the checks:
- 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:
- Continue through the prompts, select your timezone and use the defaults for all other screens
- 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!
- 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.
- 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
- The first thing I do is do make sure everything is up to date:
# su –
# yum update
- Double check that the internet is working:
# ping www.google.com
- Ensure you can ping the host, in my example I’ve used hostname puppet.master:
# ping puppet.host
- The puppet.local address probably won’t resolve so add this to the hosts file:
# nano /etc/hosts
- Add the following line
- Disable the firewall:
# service iptables stop
# chkconfig iptables off
- Set SELinux to permissive:
# nano /etc/sysconfig/selinux
Set SELINUX = permissive
- Reboot the server
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.
- 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
- Install Puppet
# yum install -y puppet-server
- Start Puppet
# service puppetmaster start
- Ensure Puppet is set to auto start
# puppet resource service puppetmaster ensure=running enable=true
Configure the Puppet Master
- 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
- 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:
- Install the Puppet agent:
# yum install -y puppet
- Configure the agent:
# nano /etc/puppet/puppet.conf
- Add the following to the [agent] section:
report = true
pluginsync = true
- Set the puppet agent to auto start
# chkconfig puppet on
# puppet agent –daemonize
- Restart the agent just incase!
# service puppet restart
- 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