月別アーカイブ: 2015年4月

Ubuntu chef-solo cook エラー ERROR: RuntimeError: chef-solo failed. See output above.

仮想マシン Ubuntu環境

$ knife solo cook vagrant@host名

すると、エラーが出る

ERROR: RuntimeError: chef-solo failed. See output above.

Ubuntuは一番はじめにパッケージを更新しないといけないらしい。

仮想マシンにsshログイン後、

$ sudo apt-key update

$ sudo apt-get update

 

でもいろいろやってるうちに、なぜがエラーが消えてた・・

実行してないけど、一応メモ

 

参考ありがとう:

http://togattti.hateblo.jp/entry/2014/02/12/082227

mac osx10.9 treeコマンド使いたい

グーグル先生がよく使っている、「tree」

でも自分の環境で打つと、使えない。

$ tree

-bash: tree: command not found

インストールしないとダメみたい。

ググる先生の指示にしたがい、インストール

$ sudo brew install tree

Password:

sudo: brew: command not found

あれ orz

そもそも、Homebrewがインストールされてないか。。

使ったことなかったからなぁ。。

ということで、まずはHomebrewをインストール

$ ruby -e “$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)”

Whoops, the Homebrew installer has moved! Please instead run:

 

ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

 

Also, please ask wherever you got this link from to update it to the above.

Thanks!

なんか、取得元が変わってるらしい。

 やり直し。

途中で処理続行にはEnterキーを入力と出るので、Enterで続行

$ ruby -e “$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)”

==> This script will install:

/usr/local/bin/brew

/usr/local/Library/…

/usr/local/share/man/man1/brew.1

==> The following directories will be made group writable:

/usr/local/.

/usr/local/bin

==> The following directories will have their group set to admin:

/usr/local/.

/usr/local/bin

 

Press RETURN to continue or any other key to abort

==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/. /usr/local/bin

==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/. /usr/local/bin

==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew

==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew

==> Downloading and installing Homebrew…

remote: Counting objects: 240516, done.

remote: Total 240516 (delta 0), reused 0 (delta 0), pack-reused 240516

Receiving objects: 100% (240516/240516), 33.68 MiB | 2.32 MiB/s, done.

Resolving deltas: 100% (179062/179062), done.

From https://github.com/Homebrew/homebrew

 * [new branch]      master     -> origin/master

HEAD is now at 175a15d Switch PkgVersion to use composition

==> Installation successful!

==> Next steps

Run `brew help` to get started

無事入ったっぽい。

$ brew -v

Homebrew 0.9.5

 状態をチェックするコマンドがあるみたいなので、実行してみる。

$ brew doctor

Your system is ready to brew.

問題なさそう。

Homebrewのアップデート実行も時々やるといいらしい。

$ brew update

Already up-to-date.

 

そこで、本題に戻って、treeインストールを再度実行

$ sudo brew install tree

Error: Cowardly refusing to `sudo brew install`

You can use brew with sudo, but only if the brew executable is owned by root.

However, this is both not recommended and completely unsupported so do so at

your own risk.

エラーが・・

sudoじゃ実行出来ないみたい。。

sudo を外して実行しちゃう

$ brew install tree

==> Downloading https://homebrew.bintray.com/bottles/tree-1.7.0.mavericks.bottle.tar.gz

######################################################################## 100.0%

==> Pouring tree-1.7.0.mavericks.bottle.tar.gz

Chef インストール

インストールでエラーが出ていたけど、 Command Line Developer Toolsのインストールで無事エラー解消

$ sudo gem install chef

Building native extensions.  This could take a while…

Successfully installed ffi-1.9.8

Fetching: libyajl2-1.2.0.gem (100%)

Building native extensions.  This could take a while…

Successfully installed libyajl2-1.2.0

Fetching: ffi-yajl-1.4.0.gem (100%)

Building native extensions.  This could take a while…

Successfully installed ffi-yajl-1.4.0

Fetching: ipaddress-0.8.0.gem (100%)

Successfully installed ipaddress-0.8.0

Fetching: wmi-lite-1.0.0.gem (100%)

Successfully installed wmi-lite-1.0.0

Fetching: rake-10.4.2.gem (100%)

rake’s executable “rake” conflicts with /usr/bin/rake

Overwrite the executable? [yN]  y ⇐y入力 

Successfully installed rake-10.4.2

Fetching: ohai-8.2.0.gem (100%)

Successfully installed ohai-8.2.0

Fetching: net-ssh-2.9.2.gem (100%)

Successfully installed net-ssh-2.9.2

Fetching: net-ssh-gateway-1.2.0.gem (100%)

Successfully installed net-ssh-gateway-1.2.0

Fetching: net-ssh-multi-1.2.0.gem (100%)

Successfully installed net-ssh-multi-1.2.0

Fetching: highline-1.7.1.gem (100%)

Successfully installed highline-1.7.1

Fetching: erubis-2.7.0.gem (100%)

Successfully installed erubis-2.7.0

Fetching: diff-lcs-1.2.5.gem (100%)

Successfully installed diff-lcs-1.2.5

Fetching: hashie-2.1.2.gem (100%)

Successfully installed hashie-2.1.2

Fetching: uuidtools-2.1.5.gem (100%)

Successfully installed uuidtools-2.1.5

Fetching: rack-1.6.0.gem (100%)

Successfully installed rack-1.6.0

Fetching: chef-zero-4.1.0.gem (100%)

Successfully installed chef-zero-4.1.0

Fetching: coderay-1.1.0.gem (100%)

Successfully installed coderay-1.1.0

Fetching: slop-3.6.0.gem (100%)

Successfully installed slop-3.6.0

Fetching: method_source-0.8.2.gem (100%)

Successfully installed method_source-0.8.2

Fetching: pry-0.10.1.gem (100%)

Successfully installed pry-0.10.1

Fetching: plist-3.1.0.gem (100%)

Successfully installed plist-3.1.0

Fetching: rspec-support-3.2.2.gem (100%)

Successfully installed rspec-support-3.2.2

Fetching: rspec-core-3.2.2.gem (100%)

Successfully installed rspec-core-3.2.2

Fetching: rspec-expectations-3.2.0.gem (100%)

Successfully installed rspec-expectations-3.2.0

Fetching: rspec-mocks-3.2.1.gem (100%)

Successfully installed rspec-mocks-3.2.1

Fetching: rspec-3.2.0.gem (100%)

Successfully installed rspec-3.2.0

Fetching: builder-3.2.2.gem (100%)

Successfully installed builder-3.2.2

Fetching: rspec_junit_formatter-0.2.0.gem (100%)

Successfully installed rspec_junit_formatter-0.2.0

Fetching: rspec-its-1.2.0.gem (100%)

Successfully installed rspec-its-1.2.0

Fetching: multi_json-1.11.0.gem (100%)

Successfully installed multi_json-1.11.0

Fetching: net-scp-1.2.1.gem (100%)

Successfully installed net-scp-1.2.1

Fetching: specinfra-2.27.1.gem (100%)

Successfully installed specinfra-2.27.1

Fetching: serverspec-2.14.0.gem (100%)

Successfully installed serverspec-2.14.0

Fetching: chef-12.2.1.gem (100%)

Successfully installed chef-12.2.1

Parsing documentation for ffi-1.9.8

Installing ri documentation for ffi-1.9.8

Parsing documentation for libyajl2-1.2.0

unable to convert “\xCA” from ASCII-8BIT to UTF-8 for lib/libyajl2/vendored-libyajl2/lib/libyajl.bundle, skipping

Installing ri documentation for libyajl2-1.2.0

Parsing documentation for ffi-yajl-1.4.0

unable to convert “\x90” from ASCII-8BIT to UTF-8 for lib/ffi_yajl/benchmark/subjects/ohai.marshal_dump, skipping

unable to convert “\xCA” from ASCII-8BIT to UTF-8 for lib/ffi_yajl/ext/encoder.bundle, skipping

unable to convert “\xCA” from ASCII-8BIT to UTF-8 for lib/ffi_yajl/ext/parser.bundle, skipping

Installing ri documentation for ffi-yajl-1.4.0

Parsing documentation for ipaddress-0.8.0

Installing ri documentation for ipaddress-0.8.0

Parsing documentation for wmi-lite-1.0.0

Installing ri documentation for wmi-lite-1.0.0

Parsing documentation for rake-10.4.2

Installing ri documentation for rake-10.4.2

Parsing documentation for ohai-8.2.0

Installing ri documentation for ohai-8.2.0

Parsing documentation for net-ssh-2.9.2

Installing ri documentation for net-ssh-2.9.2

Parsing documentation for net-ssh-gateway-1.2.0

Installing ri documentation for net-ssh-gateway-1.2.0

Parsing documentation for net-ssh-multi-1.2.0

Installing ri documentation for net-ssh-multi-1.2.0

Parsing documentation for highline-1.7.1

Installing ri documentation for highline-1.7.1

Parsing documentation for erubis-2.7.0

Installing ri documentation for erubis-2.7.0

Parsing documentation for diff-lcs-1.2.5

Installing ri documentation for diff-lcs-1.2.5

Parsing documentation for hashie-2.1.2

Installing ri documentation for hashie-2.1.2

Parsing documentation for uuidtools-2.1.5

Installing ri documentation for uuidtools-2.1.5

Parsing documentation for rack-1.6.0

Installing ri documentation for rack-1.6.0

Parsing documentation for chef-zero-4.1.0

Installing ri documentation for chef-zero-4.1.0

invalid options: -SNw2

(invalid options are ignored)

Parsing documentation for coderay-1.1.0

Installing ri documentation for coderay-1.1.0

Parsing documentation for slop-3.6.0

Installing ri documentation for slop-3.6.0

Parsing documentation for method_source-0.8.2

Installing ri documentation for method_source-0.8.2

Parsing documentation for pry-0.10.1

Installing ri documentation for pry-0.10.1

Parsing documentation for plist-3.1.0

Installing ri documentation for plist-3.1.0

Parsing documentation for rspec-support-3.2.2

Installing ri documentation for rspec-support-3.2.2

Parsing documentation for rspec-core-3.2.2

Installing ri documentation for rspec-core-3.2.2

Parsing documentation for rspec-expectations-3.2.0

Installing ri documentation for rspec-expectations-3.2.0

Parsing documentation for rspec-mocks-3.2.1

Installing ri documentation for rspec-mocks-3.2.1

Parsing documentation for rspec-3.2.0

Installing ri documentation for rspec-3.2.0

Parsing documentation for builder-3.2.2

Installing ri documentation for builder-3.2.2

Parsing documentation for rspec_junit_formatter-0.2.0

Installing ri documentation for rspec_junit_formatter-0.2.0

Parsing documentation for rspec-its-1.2.0

Installing ri documentation for rspec-its-1.2.0

Parsing documentation for multi_json-1.11.0

Installing ri documentation for multi_json-1.11.0

Parsing documentation for net-scp-1.2.1

Installing ri documentation for net-scp-1.2.1

Parsing documentation for specinfra-2.27.1

Installing ri documentation for specinfra-2.27.1

Parsing documentation for serverspec-2.14.0

Installing ri documentation for serverspec-2.14.0

Parsing documentation for chef-12.2.1

Installing ri documentation for chef-12.2.1

35 gems installed 

続いてknife-soloインストール

$ sudo gem install knife-solo

Password:

Fetching: knife-solo-0.4.2.gem (100%)

Thanks for installing knife-solo!

 

If you run into any issues please let us know at:

  https://github.com/matschaffer/knife-solo/issues

 

If you are upgrading knife-solo please uninstall any old versions by

running `gem clean knife-solo` to avoid any errors.

 

See http://bit.ly/CHEF-3255 for more information on the knife bug

that causes this.

Successfully installed knife-solo-0.4.2

Parsing documentation for knife-solo-0.4.2

Installing ri documentation for knife-solo-0.4.2

1 gem installed

インストール確認

$ gem list

 

*** LOCAL GEMS ***

 

bigdecimal (1.2.0)

builder (3.2.2)

CFPropertyList (2.2.0)

chef (12.2.1)

chef-zero (4.1.0)

coderay (1.1.0)

diff-lcs (1.2.5)

erubis (2.7.0)

ffi (1.9.8)

ffi-yajl (1.4.0)

hashie (2.1.2)

highline (1.7.1)

io-console (0.4.2)

ipaddress (0.8.0)

json (1.7.7)

knife-solo (0.4.2)

libxml-ruby (2.6.0)

他のもいろいろ入ったっぽい。とりあえずOK

knifeコマンドの設定ファイル作成

$ knife configure

WARNING: No knife configuration file found

Where should I put the config file? [/Users/Ma/.chef/knife.rb] 

Please enter the chef server URL: [https://mini.local:443] 

Please enter an existing username or clientname for the API: [Ma] 

Please enter the validation clientname: [chef-validator] 

Please enter the location of the validation key: [/etc/chef-server/chef-validator.pem] 

Please enter the path to a chef repository (or leave blank): 

*****

 

You must place your client key in:

  /Users/Ma/.chef/Ma.pem

Before running commands with Knife!

 

*****

 

You must place your validation key in:

  /etc/chef-server/chef-validator.pem

Before generating instance data with Knife!

 

*****

Configuration file written to /Users/Ma/.chef/knife.rb

リターンを押してすすんでいく。

これで準備OK

 

追記:

個人開発環境用なので、chef soloを勉強していこうと思っていたのに、どうやらそのうちなくなるらしい・・

その代わりになるのが、Chef Zero だそう。

最初からこっちを勉強しよう。。

 

 

参考ありがとう:

http://qiita.com/TsuyoshiUshio@github/items/89030baca68b05a9783d

https://github.com/CocoaPods/CocoaPods/issues/1564

Mac OSX10.9 Chefインストール失敗 ERROR: Failed to build gem native extension.

Chefのインストールをしたいのだけど、どうやらエラーになっている。

$ ruby -v

ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin13]

 

$ gem -v

2.0.14

ruby ,gemはインストールされている状態なので、

$ sudo gem install chef

Password:

Fetching: mixlib-config-2.1.0.gem (100%)

Successfully installed mixlib-config-2.1.0

Fetching: mixlib-cli-1.5.0.gem (100%)

Successfully installed mixlib-cli-1.5.0

Fetching: mixlib-log-1.6.0.gem (100%)

Successfully installed mixlib-log-1.6.0

Fetching: mixlib-authentication-1.3.0.gem (100%)

Successfully installed mixlib-authentication-1.3.0

Fetching: mixlib-shellout-2.0.1.gem (100%)

Successfully installed mixlib-shellout-2.0.1

Fetching: mime-types-2.4.3.gem (100%)

Successfully installed mime-types-2.4.3

Fetching: systemu-2.6.5.gem (100%)

Successfully installed systemu-2.6.5

Fetching: ffi-1.9.8.gem (100%)

と順調にいっているとおもいきや、

Building native extensions.  This could take a while…

ERROR:  Error installing chef:

ERROR: Failed to build gem native extension.

 

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb

checking for ffi.h… *** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary

libraries and/or headers.  Check the mkmf.log file for more details.  You may

need configuration options.

 

Provided configuration options:

–with-opt-dir

–without-opt-dir

–with-opt-include

–without-opt-include=${opt-dir}/include

–with-opt-lib

–without-opt-lib=${opt-dir}/lib

–with-make-prog

–without-make-prog

–srcdir=.

–curdir

–ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby

–with-ffi_c-dir

–without-ffi_c-dir

–with-ffi_c-include

–without-ffi_c-include=${ffi_c-dir}/include

–with-ffi_c-lib

–without-ffi_c-lib=${ffi_c-dir}/

–with-libffi-config

–without-libffi-config

–with-pkg-config

–without-pkg-config

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do’: The compiler failed to generate an executable file. (RuntimeError)

You have to install development tools first.

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for’

from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header’

from extconf.rb:16:in `<main>’

 

 

Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.8 for inspection.

Results logged to /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.8/ext/ffi_c/gem_make.out

デベロップツールを先にインストールしないとダメ?

グーグル先生の指示に従い、下記コマンドにてCommand Line Developer Toolsインストール

$ xcode-select –install

xcode-select: note: install requested for command line developer tools

 

Macintosh HD bash 177×54

インストールをクリックして、画面に従いインストール

インストールが無事完了したので、Xcodeのライセンスに同意

$ sudo xcodebuild -license

ひたすらスペースキーを押して文章を読んで(?)最後に「agree」を入力

 

By typing ‘agree’ you are agreeing to the terms of the software license agreements. Type ‘print’ to print them or anything else to cancel, [agree, print, cancel]  agree

 

You can view the license agreements in Xcode’s About Box, or at /Applications/Xcode.app/Contents/Resources/English.lproj/License.rtf

 

もう一度Chefのインストールに挑戦!

成功!

 

参考ありがとう:

http://kernhack.hatenablog.com/entry/2013/12/21/193927

http://qiita.com/yuku_t/items/30015dba2b6497b80074

Shared folders that Chef requires are missing on the virtual machine.This is usually due to configuration changing after already booting themachine. The fix is to run a `vagrant reload` so that the proper sharedfolders will be prepared and mounted on the VM.

なんかいろいろいじってたら、壊れた

$ vagrant provision

==> default: Running provisioner: chef_solo…

==> default: Detected Chef (latest) is already installed

Shared folders that Chef requires are missing on the virtual machine.

This is usually due to configuration changing after already booting the

machine. The fix is to run a `vagrant reload` so that the proper shared

folders will be prepared and mounted on the VM.

どうやら、さっきいじっていた、フォルダー同期が原因っぽい。

{vagrantディレクトリ}/machines/default/virtualbox配下にある、

synced_foldersファイルを削除

$ vagrant reload –provision

いじる前の動きに戻った!

まだ何個かエラーらしきものはあるけど・・

 

参考ありがとう:http://stackoverflow.com/questions/27975541/vagrant-chef-error-in-provision-shared-folders-that-chef-requires-are-missin

vagrant boxダウンロード〜起動まで

http://www.vagrantbox.es/ からboxをダウンロード

今回は、参考サイトにあったURLで

$ vagrant box add ubuntu http://files.vagrantup.com/lucid64.box

完了したら、ダウンロード確認

$ vagrant box list

precise64 (virtualbox, 0)

ubuntu    (virtualbox, 0)

セットアップディレクトリ作成を作成し、移動。

$ mkdir hoge

$ cd hoge

仮想マシン初期化

$ vagrant init ubuntu

A `Vagrantfile` has been placed in this directory. You are now

ready to `vagrant up` your first virtual environment! Please read

the comments in the Vagrantfile as well as documentation on

`vagrantup.com` for more information on using Vagrant.

hogeフォルダの中に、Vagrantfileが出来ているはず。

仮想マシン起動

$ vagrant up

VirtualBox マネージャーで見ると、追加されて実行中になっている

 

 

 

vagrant ホームディレクトリ 変更

vagrant 1.7.2

デフォルトのホームディレクトリ

/Users/ユーザー名/.vagrant.d

 

環境変数に「VAGRANT_HOME」を指定することで変更出来る。

環境変数確認

$ echo $VAGRANT_HOME

まだ設定されていないので、何も表示されない。

ユーザーフォルダ配下で、.bash_profileを編集

$ vi .bash_profile

任意の場所を設定(追記)

export VAGRANT_HOME=/Users/ユーザー名/Dropbox/VM/vagrant/.vagrant.d

ターミナルで使えるように、反映させる。

$ source .bash_profile

これでもう一度環境変数確認をして、反映確認。

新しい配置先ディレクトリに、既存の/Users/ユーザー名/.vagrant.dフォルダを移動

 

参考ありがとう:

http://qiita.com/sugard12/items/85b2e70c87a354675a0e

http://qiita.com/kzhrk/items/9668a0b1a6af47bab31b

 

 

VirtualBox 仮想マシンフォルダ 変更

VirtualBox 仮想マシンフォルダ 変更

VirtualBox ver4.3.26

mac OS X 10.9.5

 

メニュー > VirtualBox > 環境設定

「一般」タブ

「デフォルトの仮想マシンフォルダー」を任意の場所に変更

OKボタンで確定。

 

これで新規作成する仮想マシンのフォルダが変更される。

既に作成済みの仮想マシンフォルダの変更は、フォルダを移動したりするので、

上記の他にもう少し作業がありそう。

 

参考ありがとう:http://qiita.com/sugard12/items/8b4f420b3afed79fe003