New Script – Install Puppet on CentOS

As I’m now using Puppet also with CentOS I’d like to share the script I use to install Puppet on my CentOS VM. The script installs Ruby as well since you need it to run Puppet.

At the moment I’ve been using Puppet on CentOS without a puppetmaster so it’s properly tested only as serverless Puppet, but there’s shouldn’t be any problems even if you’re using a puppetmaster. I’m actually combining the use of Fabric and serverless Puppet to do some quick tests on multiple virtual machines but maybe I’ll write a bit about that in another post some day. Anyway, here’s the script:

CentOS 6.2
Tested and confirmed working on fresh CentOS 6.2 LiveCD running on VirtualBox.

#!/bin/bash

sudo sh -c \
'sudo cat > /etc/yum.repos.d/puppet.repo << EOF
[puppetlabs]
name=Puppet Labs Packages
baseurl=http://yum.puppetlabs.com/el/\$releasever/products/\$basearch/
enabled=1
gpgcheck=1
gpgkey=http://yum.puppetlabs.com/RPM-GPG-KEY-puppetlabs
EOF'

sudo sh -c \
'sudo cat > /etc/yum.repos.d/ruby.repo << EOF
[ruby]
name=ruby
baseurl=http://repo.premiumhelp.eu/ruby/
gpgcheck=0
enabled=0
EOF'

sudo sh -c \
'sudo cat > /etc/yum.repos.d/epel.repo << EOF
[epel]
name=Extra Packages for Enterprise Linux 5 - \$basearch
#baseurl=http://download.fedoraproject.org/pub/epel/5/\$basearch
mirrorlist=http://mirrors.fedoraproject.org/mirrorlist?repo=epel-5&arch=\$basearch
failovermethod=priority
enabled=0
gpgcheck=0

[epel-puppet]
name=epel puppet
baseurl=http://tmz.fedorapeople.org/repo/puppet/epel/5/\$basearch/
enabled=0
gpgcheck=0
EOF'

sudo yum install -y ruby
sudo yum --enablerepo="ruby" update ruby

sudo rpm -Uvh http://download.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-5.noarch.rpm
#sudo yum update

sudo yum --enablerepo=epel,epel-puppet install -y puppet

#yum --enablerepo=epel,epel-puppet install -y puppet-server
#sudo yum install -y puppet-server

sudo sh -c 'echo "    server = master.local" >> /etc/puppet/puppet.conf'
sudo service puppet restart
sudo chkconfig puppet on

I have a few lines commented in my script as I currently don’t need the puppetmaster server. So if you want to use you CentOS as the master, you need to uncomment those lines. Then also the puppet-server will be installed.

On the third line from the bottom you can see that my server is ‘master.local’. You can change that to match your puppetmaster server if you have one.

How to use
Just download the script from our git to your CentOS:
wget https://raw.github.com/awaseroot/awaseroot/master/scripts/puppet/centospuppet.sh
Make it executable:
chmod +x centospuppet.sh
Run it:
./centospuppet.sh

That’s all. Now you have Puppet running on your CentOS.

Sources

http://www.how2centos.com/centos-6-puppet-install/
http://www.craigdunn.org/2010/08/part-1-installing-puppet-2-6-1-on-centos-with-yumrpm/

About these ads

2 responses to “New Script – Install Puppet on CentOS

  1. claudiu September 20, 2012 at 9:48 pm

    Awesome script, thank you, i tested and it’s working on Centos 6.3 X64.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: