Skip to content

Instantly share code, notes, and snippets.

@toshikaz55
Last active December 17, 2015 18:39
Show Gist options
  • Save toshikaz55/5654326 to your computer and use it in GitHub Desktop.
Save toshikaz55/5654326 to your computer and use it in GitHub Desktop.
Install Vagrant, Knife-solo and Chef-solo
/Users/toshikaz% sudo gem install vagrant
Password:
Fetching: archive-tar-minitar-0.5.2.gem (100%)
Fetching: ffi-1.8.1.gem (100%)
Building native extensions. This could take a while...
Fetching: childprocess-0.3.9.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: i18n-0.6.4.gem (100%)
Fetching: log4r-1.1.10.gem (100%)
Fetching: net-ssh-2.2.2.gem (100%)
Fetching: net-scp-1.0.4.gem (100%)
Fetching: vagrant-1.0.7.gem (100%)
Successfully installed archive-tar-minitar-0.5.2
Successfully installed ffi-1.8.1
Successfully installed childprocess-0.3.9
Successfully installed erubis-2.7.0
Successfully installed i18n-0.6.4
Successfully installed log4r-1.1.10
Successfully installed net-ssh-2.2.2
Successfully installed net-scp-1.0.4
Successfully installed vagrant-1.0.7
9 gems installed
Installing ri documentation for archive-tar-minitar-0.5.2...
Installing ri documentation for ffi-1.8.1...
Installing ri documentation for childprocess-0.3.9...
Installing ri documentation for erubis-2.7.0...
Installing ri documentation for i18n-0.6.4...
Installing ri documentation for log4r-1.1.10...
Installing ri documentation for net-ssh-2.2.2...
Installing ri documentation for net-scp-1.0.4...
Installing ri documentation for vagrant-1.0.7...
Installing RDoc documentation for archive-tar-minitar-0.5.2...
Installing RDoc documentation for ffi-1.8.1...
Installing RDoc documentation for childprocess-0.3.9...
Installing RDoc documentation for erubis-2.7.0...
Installing RDoc documentation for i18n-0.6.4...
Installing RDoc documentation for log4r-1.1.10...
Installing RDoc documentation for net-ssh-2.2.2...
Installing RDoc documentation for net-scp-1.0.4...
Installing RDoc documentation for vagrant-1.0.7...
add base vm from http://www.vagrantbox.es/
/Users/toshikaz% cp Downloads/centos-6.3-chef-10.14.2.box .
/Users/toshikaz% vagrant box add base centos-6.3-chef-10.14.2.box
[vagrant] Downloading with Vagrant::Downloaders::File...
[vagrant] Copying box to temporary location...
[vagrant] Extracting box...
[vagrant] Verifying box...
[vagrant] Cleaning up downloaded box...
/Users/toshikaz% mkdir vagrantDir
/Users/toshikaz% cd vagrantDir/
/Users/toshikaz/vagrantDir% vagrant init
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.
/Users/toshikaz/vagrantDir% ls
Vagrantfile
edit Vagrantfile
uncomment config.vm.network :hostonly. "192.168.50.12"
/Users/toshikaz/vagrantDir% vagrant up
[default] Importing base box 'base'...
[default] Matching MAC address for NAT networking...
[default] Clearing any previously set forwarded ports...
[default] Forwarding ports...
[default] -- 22 => 2222 (adapter 1)
[default] Creating shared folders metadata...
[default] Clearing any previously set network interfaces...
[default] Preparing network interfaces based on configuration...
[default] Booting VM...
[default] Waiting for VM to boot. This can take a few minutes.
[default] VM booted and ready for use!
[default] The guest additions on this VM do not match the install version of
VirtualBox! This may cause things such as forwarded ports, shared
folders, and more to not work properly. If any of those things fail on
this machine, please update the guest additions and repackage the
box.
Guest Additions Version: 4.1.22
VirtualBox Version: 4.2.12
[default] Configuring and enabling network interfaces...
[default] Mounting shared folders...
[default] -- v-root: /vagrant
install knife-0.3 or newer
/Users/toshikaz/vagrantDir% sudo gem install knife-solo
Password:
Fetching: mixlib-config-1.1.2.gem (100%)
Fetching: mixlib-cli-1.3.0.gem (100%)
Fetching: mixlib-log-1.6.0.gem (100%)
Fetching: mixlib-authentication-1.3.0.gem (100%)
Fetching: mixlib-shellout-1.1.0.gem (100%)
Fetching: systemu-2.5.2.gem (100%)
Fetching: ipaddress-0.8.0.gem (100%)
Fetching: ohai-6.16.0.gem (100%)
Fetching: mime-types-1.23.gem (100%)
Fetching: rest-client-1.6.7.gem (100%)
Fetching: net-ssh-2.6.7.gem (100%)
Fetching: net-ssh-gateway-1.2.0.gem (100%)
Fetching: net-ssh-multi-1.1.gem (100%)
Fetching: chef-11.4.4.gem (100%)
Fetching: librarian-0.0.26.gem (100%)
Fetching: knife-solo-0.2.0.gem (100%)
Thanks for installing knife-solo!
install newer knife-solo from github
/Users/toshikaz/vagrantDir/tmp% git clone git://github.com/matschaffer/knife-solo.git
Cloning into 'knife-solo'...
remote: Counting objects: 4516, done.
remote: Compressing objects: 100% (2363/2363), done.
remote: Total 4516 (delta 2047), reused 4268 (delta 1826)
Receiving objects: 100% (4516/4516), 899.18 KiB | 200 KiB/s, done.
Resolving deltas: 100% (2047/2047), done.
/Users/toshikaz/vagrantDir/tmp% cd knife-solo/
/Users/toshikaz/vagrantDir/tmp/knife-solo% ls
CHANGELOG.md LICENSE README.md Rakefile lib/ test/
Gemfile Manifest.txt README.rdoc knife-solo.gemspec script/
/Users/toshikaz/works/chef-repo% sudo gem install bundler
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
1 gem installed
Installing ri documentation for bundler-1.3.5...
Installing RDoc documentation for bundler-1.3.5...
/Users/toshikaz/vagrantDir/tmp/knife-solo% rake install
knife-solo 0.3.0.pre5 built to pkg/knife-solo-0.3.0.pre5.gem.
knife-solo (0.3.0.pre5) installed.
* chef設定ファイルを作成する
/Users/toshikaz/vagrantDir/tmp/knife-solo% knife configure
* 作成された設定ファイルを修正
add to ~/.chef/knife.rb
knife[:solo_path] = '/tmp/chef-solo'
※ knife 0.2.0が優先されて、knife solo prerare でエラー0になる
※ 古いknifeをアンインストールする
/Users/toshikaz/vagrantDir% gem uninstall knife-solo
Select gem to uninstall:
1. knife-solo-0.2.0
2. knife-solo-0.3.0.pre5
3. All versions
> 1
Successfully uninstalled knife-solo-0.2.0
knife prepareでChef Readyにする
/Users/toshikaz/vagrantDir% knife solo prepare 192.168.50.12
Bootstrapping Chef...
Enter the password for [email protected]:
ERROR: Net::SSH::AuthenticationFailed: toshikaz
※ User -> vagrant PW -> vagrant
/Users/toshikaz/vagrantDir% knife solo prepare [email protected]
Bootstrapping Chef...
Enter the password for [email protected]:
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 6510 100 6510 0 0 1092 0 0:00:05 0:00:05 --:--:-- 34627
Downloading Chef 11.4.4 for el...
Installing Chef 11.4.4
warning: /tmp/tmp.2mvNjceh/chef-11.4.4.x86_64.rpm: Header V4 DSA/SHA1 Signature, key ID 83ef826a: NOKEY
Preparing... ########################################### [100%]
1:chef ########################################### [100%]
Thank you for installing Chef!
Generating node config 'nodes/192.168.50.12.json'...
ERROR: Errno::ENOENT: No such file or directory - nodes/192.168.50.12.json
※ chef-repo以下でないと、JSONエラーが出るが気にしなくていい?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment