CentOS 6 install & configure Cfengine

简介:

1、安装软件包

#yum install openssl openssl-devel db4 db4-devel flex pcre pcre-devel openldap tokyocabinet tokyocabinet-devel gcc  -y

2、下载source包

#wget https://cfengine.com/source-code/download?file=cfengine-3.5.1-3.tar.gz

#tar xvzf cfengine-3.5.1-3.tar.gz; cd cfengine-3.5.1-3

#./configure

#make && make install

3、/var/cfengine 默认工作目录

#cp -rp  cfengine-3.5.1-3/masterfiles/*.cf  /var/cfengine/masterfiles

#cp -rp cfengine-3.5.1-3/masterfiles/*.cf /var/cfengine/inputs

#cp -rp cfengine-3.5.1-3/masterfiles/controls /var/cfengine/inputs

#cp -rp cfengine-3.5.1-3/masterfiles/services /var/cfengine/inputs

#cp -rp cfengine-3.5.1-3/masterfiles/lib /var/cfengine/inputs

#cp -rp cfengine-3.5.1-3/masterfiles/libraries/cfengine_stdlib.cf /var/cfengine/inputs

4、测试配置是否成功

#/var/cfengine/bin/cf-promises -v

5、实例:创建一个新文件" /tmp/cftest " , 文件权限 774

# cat /var/cfengine/inputs/cftest.cf

body common control 

# Define a bundle sequence 
bundlesequence => { "checkperms" }; 
# Include cfengine_stdlib.cf 
inputs => { "cfengine_stdlib.cf" }; 
version => "1.0.0"; 

bundle agent checkperms         

files:                    
"/tmp/cftest" 
create => "true",                              
perms => m("744"); 
}

6、检测配置语法

#/var/cfengine/bin/cf-promise -f /var/cfengine/inputs/cftest.cf

#ls -l /tmp/cftest 
ls: 无法访问/tmp/cftest: 没有那个文件或目录

7、运行

#/var/cfengine/bin/cf-agent -f /var/cfengine/inputs/cftest.cf

#ls -l /tmp/cftest

-rwxr--r-- 1 root root 0 7月  23 14:24 /tmp/cftest

注意:文件创建成功和权限是正确的,这只是一个简单的实例,待后续讲解。。。










本文转自 Art_Hero 51CTO博客,原文链接:http://blog.51cto.com/curran/1255326,如需转载请自行联系原作者
目录
相关文章
|
2月前
|
Linux Shell Python
centos执行pip3 install etcd3报错
centos执行pip3 install etcd3报错
|
4月前
|
关系型数据库 MySQL Linux
Linux部署实战前言,MySQL在CentOS安装【单机软件】,MySQL的安装需要root权限,yum install mysql,systemctl enable mysqld开机自启的意思
Linux部署实战前言,MySQL在CentOS安装【单机软件】,MySQL的安装需要root权限,yum install mysql,systemctl enable mysqld开机自启的意思
|
6月前
|
Linux Docker 容器
CentOS7 Install Docker Compose
CentOS7 Install Docker Compose
153 0
|
缓存 网络协议 Linux
CentOS8 yum install 报错Cannot prepare internal mirrorlist: No URLs in mirrorlist解决(替换yum源)
CentOS8 yum install 报错Cannot prepare internal mirrorlist: No URLs in mirrorlist解决(替换yum源)
CentOS8 yum install 报错Cannot prepare internal mirrorlist: No URLs in mirrorlist解决(替换yum源)
|
Linux Docker 容器
|
Linux
Centos下pip3 install pycrypto安装失败的解决办法
Centos下pip3 install pycrypto安装失败的解决办法
1576 0
Centos下pip3 install pycrypto安装失败的解决办法
|
弹性计算 关系型数据库 Linux
How to Install CMS Made Simple v2.2 on LAMP in CentOS 7.2
In this tutorial, we will be setting up CMS Made Simple on a LAMP stack with an Alibaba Cloud ECS instance (CentOS 7.2).
3911 0
How to Install CMS Made Simple v2.2 on LAMP in CentOS 7.2
|
弹性计算 网络协议 Linux
How to Install and Configure Docker Swarm Mode on CentOS 7
In this tutorial, we will learn how to set up Docker Swarm on an Alibaba Cloud ECS CentOS 7 instance.
2147 0
How to Install and Configure Docker Swarm Mode on CentOS 7
|
Web App开发 关系型数据库 PHP
Install WordPress on Centos
Before beginning, a domain, an ESC or a VPS is needed. Once the ECS or the VPS and the domain are prepared, the following procedures can be conducted.
1115 0
|
Web App开发 Java Linux