CentOS 上安装puppet 教程

安装puppet主要方式,有两种通过包管理器,以及源码安装,源码安装puppet不推荐,在CentOS上推荐通过yum来安装。

安装puppet之前确保服务器能连网,添加puppet 官方yum源,地址为https://yum.puppetlabs.com/。

CentOS 6 安装puppet 3.x 示例

sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-el- 6.noarch.rpm
sudo yum -y install puppet-server 
sudo yum -y install puppet

默认配置文件都在/etc/puppet目录下:

CentOS 6 安装puppet 4.x 示例

sudo rpm -ivh https://yum.puppetlabs.com/puppetlabs-release-pc1-el-6.noarch.rpm
sudo yum -y install puppetserver 
sudo yum -y install puppet 

puppet 4.x  所有bin文件都保存在/opt/puppetlabs/bin目录下,需要注意 添加可执行文件路径到$PATH变量,不然会报找不到puppet命令。配置文件保存在/etc/puppetlabs/puppet/puppet.conf

 

puppet 配置文件示例:

vardir = /opt/puppetlabs/server/data/puppetserver
logdir = /var/log/puppetlabs/puppetserver
rundir = /var/run/puppetlabs/puppetserver
pidfile = /var/run/puppetlabs/puppetserver/puppetserver.pid
codedir = /etc/puppetlabs/code

Puppet 默认使用JVM内存大小2G,如需调整,步骤如下:

编辑 /etc/sysconfig/puppetserver文件

修改如下参数值:

JAVA_ARGS="-Xms2g -Xmx2g"

更多JVM参数调整,可参阅Orace官方文档

 

日志路径:/var/log/puppet

查看所有配置参数

puppet config print all