Help us understand the problem. What is going on with this article?

MacにVagrant、Cent OS、apacheをインストール(Chefでインストール編)

More than 5 years have passed since last update.

chefを使ってapacheをインストールします。

chefクックブックについて

MacにVagrant、Cent OS、apacheをインストール(Chefクックブック作成編)のクックブックを使います。
上記クックブックはgithubに公開しています。
https://github.com/pakiln/chef-repo

VagrantとCentOS

本投稿はMacにVagrant、Cent OS、apacheをインストールvagrant upを実行できた状態からの手順です。
CentOSのipアドレスは192.168.33.10としています。

chef(knife)の実行

Macのターミナルからknife solo prepareを実行します。
これはCentOSのchef環境を整えてくれる便利なコマンドです。
一度だけ実行してください。
なお、実行時のディレクトリはクックブックのディレクトリです。

$ ls
Cheffile  Cheffile.lock  cookbooks/  data_bags/  nodes/  roles/  site-cookbooks/

$ knife solo prepare 192.168.33.10 --ssh-user vagrant --identity-file ~/.vagrant.d/insecure_private_key
Bootstrapping Chef...
Enter the password for vagrant@192.168.33.10: 
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
101  6790  101  6790    0     0    992      0  0:00:06  0:00:06 --:--:-- 11040
Downloading Chef 11.6.0 for el...
Installing Chef 11.6.0
warning: /tmp/tmp.aSjAYKHN/chef-11.6.0.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
Preparing...                ########################################### [100%]
   1:chef                   ########################################### [100%]
Thank you for installing Chef!

続けてMacのターミナルからknife solo cookを実行します。
192.168.33.10のCentOSに対して、nodes/192.168.33.10.jsonに従いchefを実行させます。
「nodes/192.168.33.10.json」の部分を省略することも可能です。

$ knife solo cook 192.168.33.10 nodes/192.168.33.10.json --ssh-user vagrant --identity-file ~/.vagrant.d/insecure_private_key
Running Chef on 192.168.33.10...
Checking Chef version...
Installing Librarian cookbooks...
Uploading the kitchen...
Generating solo config...
Running Chef...
Starting Chef Client, version 11.6.0
Compiling Cookbooks...
[2013-09-22T03:49:31+00:00] FATAL: No cookbook found in ["/home/vagrant/chef-solo/cookbooks-1", "/home/vagrant/chef-solo/cookbooks-2", "/home/vagrant/chef-solo/cookbooks-3"], make sure cookbook_path is set correctly.
Converging 3 resources
Recipe: iptables_stop::default
  * service[iptables] action disable
    - disable service service[iptables]

  * service[iptables] action stop
    - stop service service[iptables]

Recipe: httpd::default
  * package[httpd] action install
    - install version 2.2.15-29.el6.centos of package httpd

  * service[httpd] action enable
    - enable service service[httpd]

  * service[httpd] action start
    - start service service[httpd]

Chef Client finished, 5 resources updated

Macのブラウザから192.168.33.10にアクセスすると、Apacheのテストページが表示されます。

pakiln
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした