1    安装步骤

1.1    安装berkeley
wget http://download.oracle.com/berkeley-db/db-5.0.21.tar.gz
tar xzvf db-5.0.21.tar.gz
cd db-5.0.21
cd build_unix/
../dist/configure --prefix=/opt/Berkeley
sudo make && sudo make install

1.2    安装cfengine
cd ~
wget http://www.cfengine.org/tarballs/cfengine-2.2.10.tar.gz
tar xzvf cfengine-2.2.10.tar.gz
cd cfengine-2.2.10
sudo ./configure --prefix=/usr/local/cfengine --with-berkeleydb=/opt/Berkeley/
sudo make
sudo make install
sudo mkdir /var/cfengine
sudo mkdir /var/cfengine/bin
sudo mkdir /var/cfengine/inputs
sudo cp /usr/local/cfengine/sbin/cfagent /var/cfengine/bin
sudo cp /usr/local/cfengine/sbin/cfexecd /var/cfengine/bin
sudo cp /usr/local/cfengine/sbin/cfservd /var/cfengine/bin
sudo chown -R root:0 /var/cfengine
sudo chmod -R 755 /var/cfengine
可能需要
echo "/opt/Berkeley/lib/">~/Berkeley.conf
sudo cp ~/Berkeley.conf /etc/ld.so.conf.d/
sudo /sbin/ldconfig

1.3    测试
编辑文件
/var/cfengine/inputs/cfagent.conf
=================================
Control:
actionsequence = ( shellcommands )
shellcommands:
"/bin/echo Hello World!"
=================================

>Sudo /usr/local/cfengine/sbin/cfkey    #生成密钥
    >sudo /var/cfengine/bin/cfagent -f /var/cfengine/inputs/cfagent_doc.conf
cfengine:gateway:/bin/echo Hello: Hello World!