CentOS6.3に最速の方法でChef serverを入れる

Post date: 2013/01/07 4:40:10

chef server 11でインストールがかわったのでこの情報は古いです。

CentOS6に、CentOSにChef Serverを最速でインストールする #automation ... - Qiitaの方法でchef serverを入れるをもう一度やり直した。

Vagrantで作成したVMで、chef clientとして使った後で入れたため、自分の首をしめた。以下、トラブル、原因と解決策。

1. chef-server-webuiの起動に失敗する

require 'chef/solr'したところで、

Gem::LoadError: can't activate chef (= 0.10.6, runtime) for ["chef-solr-0.10.6"], already activ\

ated chef-10.12.0 for []

原因: chef gemの10.12.0が入っていた

解決策: gem uninstall chef -v=10.12.0

(最初、わけもわからずbundle initしてしまい、requireできなくなり困ったが、bundlerの概要を理解して解決。Gemfileを消した。see Bundlerを使ったRuby環境構築 « tam's blog )

2. まだ起動できない

INFO: HTTP Request Returned 401 Unauthorized: Failed to authenticate. Ensure that your client key is valid.

/usr/lib/ruby/1.8/net/http.rb:2105:in `error!': 401 "Unauthorized" (Net::HTTPServerException)

原因: /etc/chef/validation.pemか、webui.pemか両方が古い?

解決策: Recreating the Opscode Chef validation key « btm.geek を参考に、pemを作りなおす。

要は rm /etc/chef/validation.pemとwebui.pemし、chef-serverを再起動すれば、作られる

3. port forwardingできない

VMでは、iptablesが動いている(間抜けだが、iptablesは、ps auwxで見えるわけではない!)

とりあえずは、/etc/init.d/iptables stop