CentOS puppet foreman 安装方法

puppet是一种Linux、Unix平台的集中配置管理系统,,可管理配置文件、用户、cron任务、软件包、系统服务等。puppet的设计目标是简化对这些资源的管理以及妥善处理资源间的依赖关系。

foreman是一个puppet的生命周期管理系统,类似puppet-dashboard,通过它可以很直观的查看puppet所有客户端的同步状态与facter参数。下面就有关CentOS puppet foreman 安装方法做出具体介绍。

foreman 和 dashboard 一样。可以直观地查看puppet client 同步状态等。详细情况看官方的截图:

http://theforeman.org/projects/foreman/wiki/Screenshots

简单说下安装的顺序:

1. 安装puppet

2. 升级ruby 至 1.8.6

3. 安装相关的依赖 gem rake rails i18n

4. 创建库和用户并授权

5. 安装foreman

6. 修改database.yml

7. 创建foreman表

8. 配置 foreman.rb 文件,并放至puppet reports目录

9. 配置 puppet server client 配置文件

10. 启动

注意版本的要求。特别是ruby 只能是1.8 升级ruby 参考: http://bubbyroom.com/2011/01/centos-yum-update-ruby/

Ruby 1.9 is not supported yet. You have to use Ruby 1.8.x as stated above.

RubyGems 1.3.1 or higher is requiredRake 0.8.3 or higher is requiredRack 1.0.1 is required.

If you don't have this exact version, database migration would fail.I18n 0.4.2 is required for Redmine >= 1.0.5

rpm -Uvh http://download.fedora.redhat.com/pub/epel/5/i386/epel-release-5-3.noarch.rpm
yum install -y mysql mysql-devel mysql-server ruby ruby-devel ruby-irb ruby-mysql ruby-rdoc ruby-ri

如果MYSQL 是源码包安装则:

yum install -y ruby ruby-devel ruby-irb ruby-mysql ruby-rdoc ruby-ri

安装rubygem 1.3.5

http://production.cf.rubygems.org/rubygems/rubygems-1.3.5.tgztar xfz rubygems-1.3.5.tgzcd rubygems-1.3.5ruby setup.rb

安装rails 和rack

gem install rails -v=2.3.5
gem install rack -v=1.0.1
gem install -v=0.4.2 i18n

下载foreman

地址:http://www.redmine.org/projects/redmine/wiki/Download

我喜欢用GIT下载:

有人问过我git 怎么安装:

yum -y install git
git clone git://github.com/edavis10/redmine.git

源码包地址:

wget http://rubyforge.org/frs/download.php/73900/redmine-1.1.0.tar.gz

下载 后解压。可以放在/usr/local/redmine 目录

Mysql 配置: 创建库和用户

create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'my_password';
grant all privileges on redmine.* to 'redmine'@'localhost';

mysql 5 以上

grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';

进去foreman配置 database.yml

config/database.yml

production:adapter: mysqldatabase: redminehost: localhostusername: redmine
password: my_password

建表:

RAILS_ENV=production rake db:migrate

启动:

ruby script/server webrick -e production

库备份:

/usr/bin/mysqldump-u -p
|gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz

puppet master配置

reports=log, foreman

puppet client 配置

report = true

配置puppet 提交至foreman

# cp extras/puppet/foreman/files/foreman-report.rb /usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb
# chmod 644 /usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb
# vim /usr/lib/ruby/site_ruby/1.8/puppet/reports/foreman.rb
# URL of your Foreman installation$foreman_url="http://" + `hostname`.strip + ":8000"

cron 清数据:

rake reports:expire days=7 RAILS_ENV="production"

###########################################################

foreman 可以采用yum 安装

配置源:

cat > /etc/yum.repos.d/foreman.repo << EOF[foreman]name=Foreman Repo
baseurl=http://theforeman.org/repogpgcheck=0enabled=1EOF
yum install foreman

使用yum 安装后会产生/etc/init.d/foreman 配置文件也在/etc/foreman 目录 。其它的配置一样。

相关推荐