Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Sign up for free
Menu
Search
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Features
All features
Private URLs
Password Protection
Custom URLS
Scheduled publishing
Remove Branding
Restrict embedding
Deck Collections
Notes
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Explore
Featured decks
Featured speakers
Programming
Technology
Storyboards
Pricing
Search
Sign in
Sign up for free
Vagrant+Chef Hands-on
Search
Kenichi Takahashi
May 27, 2013
Technology
340
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Vagrant+Chef Hands-on
2013/05/23に開催した60min.での資料です。
Kenichi Takahashi
May 27, 2013
More Decks by Kenichi Takahashi
See All by Kenichi Takahashi
Claude Code全社展開のためにやったことn選~プラグイン302個・コミッター271人を支えるために~
kenchan
5
2k
実践、マルチクラウド環境でのコスト管理の現状と未来
kenchan
0
230
エンジニアリング 💰Moneyジャー / Engineering Money-ger
kenchan
3
1.1k
Lv1,2の開発生産性を経営と繋ぐ
kenchan
4
2.2k
「トップ10プランナー」からはじめる目標設定
kenchan
5
4.6k
負債と言わないことが負債と向き合うこと
kenchan
5
4.8k
可用性No.1へ!「カラーミーショップ」のリ・アーキテクティング
kenchan
0
210
カラーミーショップは私たちが作っています
kenchan
0
1.8k
カラーミーショップ 2022 / COLORME SHOP 2022
kenchan
0
770
Other Decks in Technology
See All in Technology
Deep Data Security 機能解説
oracle4engineer
PRO
2
640
企業の現実世界をグラフで写し取る
sansantech
PRO
0
250
HacobuにおけるFDEとは/登壇資料(戸井田 裕貴)
hacobu
PRO
1
730
検証フェーズはAIの回答を判断するための学習機会
toru_kubota
2
440
AI 時代の Azure エンジニアリング ~ 私たちは何を磨き、何を任せるのか ~
chack411
1
390
2026-09-26 Platform Engineering Kaigi 2026 インフラとアプリの境界線と委譲の設計 / Drawing the Infra and App Line
masasuzu
0
610
20260930_Gemma4_Hands-on
tsho
0
210
AgentCoreで実践するハーネスエンジニアリング
yakumo
1
250
[2026 Oracle Technical Deep Dive] エンタープライズAIエージェントを支えるOCIソリューション。ラインナップと特徴を理解しよう! (2026年9月17日開催)
oracle4engineer
PRO
0
310
Google Cloud Next Tokyo 26登壇時のスクリプト
recruitengineers
PRO
0
140
ファミコンでPHPを動かす / PHP on the Famicom side b
tomzoh
0
110
生成AIと進める探索的データ分析(2026.10.03 第122回Tokyo.R勉強会)
tatamiya
2
1.3k
Featured
See All Featured
Fantastic passwords and where to find them - at NoRuKo
philnash
52
3.9k
AI Search: Where Are We & What Can We Do About It?
aleyda
0
8k
The State of eCommerce SEO: How to Win in Today's Products SERPs - #SEOweek
aleyda
2
12k
Efficient Content Optimization with Google Search Console & Apps Script
katarinadahlin
PRO
1
900
The Curious Case for Waylosing
cassininazir
1
550
Building AI with AI
inesmontani
PRO
1
1.3k
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
508
140k
Side Projects
sachag
456
43k
Ten Tips & Tricks for a 🌱 transition
stuffmc
1
250
Site-Speed That Sticks
csswizardry
13
1.5k
Measuring & Analyzing Core Web Vitals
bluesmoon
9
1k
XXLCSS - How to scale CSS and keep your sanity
sugarenia
250
1.3M
Transcript
Vagrant & Chef ハンズオン @kenchan
今日のゴール Vagranの使い方がなんとなくわかる knifesoloの使い方がなんとなくわかる おまけで screen と apache がインストールされたCentOSの VMをお持ち替えりいただけます。
事前の準備
各種インストール VirtualBox のインストール Vagrant のインストール
BaseBox の登録 $ vagrant box add opscode-centos-64 \ https://opscode-vm.s3.amazonaws.com/vagrant/opscode_centos-6.4_chef-11.4.4.box $
vagrant box list opscode-centos-64 (virtualbox)
ハンズオン開始
vagrant init $ mkdir vagrant-handson $ cd vagrant-handson $ vagrant
init opscode-centos-64 Vagrantfile というものができていますね。
Vagrantfileを見てみよう config.vm.box config.vm.box_url vm.box はBase Boxの名前、 vm.box_url は Base Box
がな いときのダウンロードURL。名前の衝突は注意。
VMの作成と起動 vagrant up VirtualBoxの画面を開いておくと、VMができあがって起動する 様子を確認できます。
SSHで繋いでみよう vagrant ssh ユーザはvagrant。パスワード無しで sudo できる。
普通にSSHしてみよう $ vagrant ssh-config --host melody $ vagrant ssh-config --host
melody >> ~/.ssh/config $ ssh melody
knifesolo のインストール Gemfileを書いて bundle install しましょう。 source 'https://rubygems.org' gem 'knife-solo',
'~> 0.3.0.pre3'
knifesoloのセットアップ(1) $ bundle exec knife configure $ bundle exec knife
solo init . $ bundle exec knife solo prepare melody configureはchefの設定します。(今回は不要かも?) initはcookbookなどを置くディレクトリの作成します。
knifesoloのセットアップ(2) prepareは、以下の2ステップを行うので、chefが入っている VMで、nodesのjsonを自分で書けば不要です。 nods/melody.json を作る sshでVMに入り chef をインストールする
knifeを実行してみよう $ bundle exec knife solo cook melody エラーが出ないこと確認しましょう。
VMにscreenをインストール $ bundle exec knife cookbook create screen -o site-cookbooks
sitecookbooksに入れるべきかは議論の余地がありますが、今 回はsitecookbooksとします。
レシピの書き方 sitecookbooks/screen/recipes/default.rb package 'screen' do action :install end ふつうにRubyが書けますよ。
melodyにscreenを入れる nodes/melody.json { "run_list": [ "screen" ] } インストールしてみよう $
bundle exec knife solo cook melody
動作確認 $ vagrant ssh $ screen screenの中でscreenにならないように注意してね。
外部のcookbookを使う cookbookの管理ツールはいろいろありますが、今回 は Berkshelf を使ってみましょう。 Gemfileに gem 'berkshelf' を追加し て
bundle install します。
apache2のcookbookを利用 Berksfile site :opscode cookbook 'apache2' install $ bundle exec
berks install -p cookbooks
困っていること(1) berks install だけだ と、 ~/.berksfile/cookbooks に入ってしま い、 .chef/knife.rb のcookbookにpathを入れても見つけ
てくれない…
困っていること(2) berks install -p すると、ディレクトリ空っぽにしてか らインスールするので、実は vendor/cookbook とかにした ほうがいい? (たとえば自作のscreenのcookbook
を cookbooks に入れるとここで消されてしまう)
apache2をインストール nodes/melody.json { "run_list": [ "screen", "apache2" ] } $
bundle exec knife solo cook melody
起動しているか確認 $ vagrant ssh $ curl localhost > 404 Not
Found!!!
ホストからアクセス(1) VMを停止します。 $ vagrant halt Vagrantfileでコメントアウトされている箇所を戻します。 config.vm.network :private_network, ip: "192.168.33.10"
ホストからアクセス(2) $ vagrant up $ curl http://192.168.33.10/ > 404 Not
Found!!!
おわり なにかご質問は
おまけ VMの消し方 $ vagrant destroy
おまけ バージョン管理について .vagrant は環境依存なのでignoreに。 あとは全部管理した ほうがいいのでは。
おまけ VMのスナップショットでどうするの? VirtualBox上でやってもいいけど、Vagrantのプラグインがある よ。