Building Puppet from source is easy

This post is part of a blog series which tries to simplify the adoption of configuration management frameworks.

As mentioned in the last post, software dependencies can be a blocker for the adoption of configuration management frameworks. In complex or legacy environments where one has several different and antique operating systems versions, even the installation of this frameworks can be painful. Easily too painful for a time saving tool.

About a year ago, I was trying to install the Puppet agent on Solaris 10, Solaris 11 and RHEL 5.x. And it took longer than 5 minutes …
Basically the most install tutorials require to have a current operating system and/or a connection to the Internet from your target systems. These requirements were just not realistic for my target servers at my work place.

We just did not want to upgrade the whole data center, before we can install a small piece of ruby software, which maybe helps us in the future. We rather wanted to use the time to write Puppet manifests to automate our tasks, to get some effort savings which we can re-invest in upgrading old operating systems.

After some struggling I tried to compile everything from source and I was surprised how easy it was, also on Solaris. The following build guide works at least for Solaris 10, Solaris 11, RHEL 5/6, CentOS 5/6.

The idea is to build the Puppet stack and all libraries which could cause some problems to an own directory, in this example: /opt/mypuppet. So the Ruby installation of the Puppet agent does not interfere with your systems Ruby.

So if you like to “uninstall” the Puppet agent you can do it easily with:

# rm -r /opt/mypuppet

Prepare build environment

You will need systems with installed developer tools like compiliers, it makes sense to use dedicated systems for that.

Solaris 10

If you use Solaris 10, you very likely customize the distribution heavily. Take care that at least the following packages are installed on the build system:

# pkgadd -d // SUNWbinutils SUNWarc SUNWgcc SUNWgccruntime \
SUNWhea SUNWlibmr SUNWlibm SUNWopensslr SUNWopenssl-libraries \
SUNWopenssl-include SUNWopenssl-commands SUNWsprot SUNWxcu4t

Additionally some build scripts are only tested with the gnu-tools, you can avoid some trouble if you just make “grep” and “sed” resolve to the gnu versions (e.g. overwrite the path to grep and sed with a symlink to ggrep and gsed)

Solaris 11

With Solaris 11 it is easier:

# pkg install group/feature/developer-gnu

Centos 6.x

# yum install openssh-clients gcc openssl-devel

Ruby + libraries


# wget
# ./configure --prefix=/opt/mypuppet
# make ; make install


Always check the supported Ruby versions in the documentation. Since Puppet 3.2 also Ruby 2.0 should be supported.

# wget
# ./configure --prefix=/opt/mypuppet --enable-shared --with-opt-dir=/opt/mypuppet --disable-install-doc --enable-rpath
# make; make install

Puppet, facter and hiera


# wget
# /opt/mypuppet/bin/ruby install.rb


# wget
# /opt/mypuppet/bin/ruby install.rb --configdir=/opt/mypuppet/etc


# wget
# /opt/mypuppet/bin/ruby install.rb --configdir=/opt/mypuppet/etc

As long as the bug PUP-1567 is not fixed, you need to apply the following patch, to make “puppet apply” work with the alternate installation directory.

--- /opt/mypuppet/lib/ruby/site_ruby/1.9.1/puppet/util/run_mode.rb    2013-12-26 18:48:18.000000000 +0100
+++ /opt/mypuppet/lib/ruby/site_ruby/1.9.1/puppet/util/ 2014-01-25 15:46:47.025501551 +0100
@@ -55,11 +55,11 @@

class UnixRunMode < RunMode
def conf_dir
- which_dir("/etc/puppet", "~/.puppet")
+ which_dir("/opt/mypuppet/etc", "~/.puppet")

def var_dir
- which_dir("/var/lib/puppet", "~/.puppet/var")
+ which_dir("/opt/mypuppet/var", "~/.puppet/var")


To ship the build agent to the target systems, pack the files e.g. in a RPM, Solaris package or just a tar-archive:

build-server:  # tar cvf puppet-v1.tar /opt/mypuppet

target-server: # cd /opt ; tar xvf puppet-v1.tar


Building from source has definitely some disadvantages, e.g. the building effort. If the pre-build packages from your OS vendor or Puppetlabs are good for you, USE them.

Although we are building the agent now for almost a year from source, we always had the plan to migrate to pre-build packages. Especially after the Solaris 11.2 release, which will ship with full Puppet integration.

Also the excellent Pro Puppet book has a good coverage of the many ways to install Puppet, which you should read to save a lot of time.

Share Comments