KeyWords:
SysAdmin,
CfEngine,
Solaris
Compiling and installing CfEngine 2.2.8 on Solaris 10
Alerted by a
thread on the help-cfengine mailing list![](/twiki/pub/TWiki/TWikiDocGraphics/external-link.gif)
,
I set forth to compiling
cfengine
from sources on our Solaris boxes,
as the
Blastwave.org![](/twiki/pub/TWiki/TWikiDocGraphics/external-link.gif)
repositories
still provide the ancient version 2.1.20![](/twiki/pub/TWiki/TWikiDocGraphics/external-link.gif)
.
Compiling from source is not as straightforward as it should be;
some issues have been found (and
reported to the mailing-list![](/twiki/pub/TWiki/TWikiDocGraphics/external-link.gif)
,
to no reaction at present).
Workarounds are recorded here for future reference.
Compilation
This is a detailed walkthrough from downloading the sources to
installing the cfengine 2.2.8 binaries.
- Download and extract the sources:
cd /tmp
wget http://www.cfengine.org/downloads/cfengine-2.2.8.tar.gz
gzcat cfengine-2.2.8.tar.gz | tar xvf -
- Install neeed development tools: assuming you have Blastwave's pkg-get
installed, you can have them all with:
cd cfengine-2.2.8
# freshen the package cache contents
pkg-get -U
# install needed packages
pkg-get install binutils bison gcc4core flex openssl_devel berkeleydb4
# ensure they are found by the shell
export PATH=$PATH:/opt/csw/bin
- Run the usual
./configure; make
procedure.
./configure --prefix=/opt/cscs --with-openssl=/opt/csw/ --with-berkeleydb=/opt/csw/bdb4/ --with-gnu-ld CC=/opt/csw/gcc4/bin/gcc
Note:
- The path to CSW OpenSSL and BerkeleyDB libraries needs to be explicitly passed to
./configure
;
- CSW's
gcc4
package installs the gcc
binary in a non-standard location; you need to either add /opt/csw/gcc4/bin
to PATH, or explicitly set the full path to the compiler via the CC=/opt/csw/gcc4/bin/gcc
argumento to ./configure
;
- The prefix has been changed from the default
/usr/local
(we collect all local software in /opt/cscs
).
- Option
--with-gnu-ld
tells ./configure
that we are using an all-GNU toolchain.
- Before issuing
make
, a few workarounds need to be put in place:
- First:
gcc
does not understand the -pthread
option; removing it from the =Makefile='s works around this bug:
find . -name Makefile | (while read file; do gsed -i -e 's/-pthread//g;' $file; done)
make clean all
-
- Second: CSW installs the
ar
binary outside of the standard PATH, need to add it:
# need ar, non-std path
export PATH=$PATH:/opt/csw/i386-pc-solaris2.8/bin
- Use gnutopkg
to compile the sources and make a Solaris binary package. Note: gnutopkg
requires that we run ./configure
with any non-standard options before invocation of gnutopkg
.
# compile and create a Sun package (see http://www.bolthole.com/solaris/gnutopkg)
gnutopkg
- Install the generated package and test the installed
cfengine
:
# install
pkgadd -d cfengine-i386.pkg
# check version and functionality
/opt/cscs/sbin/cfagent --version
/opt/cscs/sbin/cfagent -q -v -n | less
Installation
Deployment of the package on all SE's assumes that the package created
above has been copied to the shared package repository as
CSCS-cfengine-2.2.8.pkg
, and that
pdsh
is installed.
# install on all hosts in one run
pdsh -R ssh -w "se[01-11]" "yes | pkgadd -d /net/adm00.lcg.cscs.ch/local2/lcg-nfs/packages/solaris/CSCS-cfengine-2.2.8-i386.pkg all 2>&1" | dshbak | less
# install symlink for cfexecd
pdsh -R ssh -w "se[01-12]" "ln -f -s /opt/cscs/sbin/cfagent /var/cfengine/bin/cfagent" | sort
# check it :-)
pdsh -R ssh -w "se[01-12]" "ls -l /var/cfengine/bin/cfagent" | sort
--
RiccardoMurri - 06 Oct 2008
Readers' comments