21
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

CentOS 6.4 minimal の環境に Chef-solo を入れる。(必然的にRubyもインストール)

Last updated at Posted at 2013-08-12

注意

現在は、ChefDKのrpmで簡単にChef及びknifeをインストール可能です。
以下の手順は、昔のやり方ですので参考にしないでください。

#想定環境
CentOS release 6.4 (Final) (minimumインストール)

#コンパイル等に必要なmoduleのインストール
yum groupinstall "Development Tools"

yum install libffi-devel openssl-devel readline-devel zlib-devel git subversion gdbm-devel httpd-devel libcurl-devel ncurses-devel openssl-devel readline-devel sqlite-devel zlib-devel 

#libyaml-devel を 導入するために、epel レポジトリを導入。(通常epelを使わない設定に変更)
rpm -Uvh http://ftp-srv2.kddilabs.jp/Linux/distributions/fedora/epel/6/x86_64/epel-release-6-8.noarch.rpm
sed -i "s%enabled=1%enabled=0%g" /etc/yum.repos.d/epel.repo
yum --enablerepo=epel install libyaml-devel

#Rubyインストール
cd
wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz
tar xvzf ruby-1.9.3-p327.tar.gz
cd ruby-1.9.3-p327
./configure --prefix /opt/ruby
make;make install

#Chefのインストール
/opt/ruby/bin/gem install chef
/opt/ruby/bin/gem install knife-solo

#Chefで使うオペレーションアカウントの作成
useradd chef-ope

sudo su  - chef-ope

#/opt/ruby/bin に Pathを通す。

echo "PATH=\"$PATH\":/opt/ruby/bin/" >> ~chef-ope/.bashrc

source ~chef-ope/.bashrc

#Knife 設定
knife configure

#Chefのレポジトリ作成
knife solo init chef-repo

#Chefレシピを作成して、うまくツールが動かなかったら、
~/.chef/knife.rb に対して、下記のように追記してパスを通す。

cookbook_path [
  "/home/chef-ope/chef-repo/cookbooks",
  "/home/chef-ope/chef-repo/site-cookbooks"
]
role_path		'/home/chef-ope/chef-repo/roles'
data_bag_path		'/home/chef-ope/chef-repo/data_bags'
21
21
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
21
21

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?