Veewee ã«ãã Vagrant ã® Box ä½æç°å¢æ§ç¯ Windows ç ãã®2
Veewee による Vagrant の Box 作成環境構築 Windows 版 その1 ã®ç¶ãã«ãªãã¾ãã
ååæ§ç¯ããç°å¢ã使ã£ã¦ãVeewee ã§å®éã« Box ãä½æãã¦ããã¾ãã
Box ã®ä½æ
ã¾ãã¯ä»¥ä¸ãå®è¡ã㦠Veewee ã対å¿ãã¦ãã box ã®ãã³ãã¬ã¼ãã表示ãã¾ãã
>bundle exec veewee vbox templates
沢山åºã¦ãã¦è¦ã¥ããå ´åã¯ä»¥ä¸ã®ãã¼ã¸ã§ã確èªã§ãã¾ãã
https://github.com/jedi4ever/veewee/tree/master/templates
ãã³ãã¬ã¼ããé¸ãã ããé¸ãã ãã³ãã¬ã¼ãã®ååãæå®ã㦠veewee vbox define ãå®è¡ãã¾ãã
ããã§ã¯ãCentOS-6.4-x86_64-minimalãã使ç¨ãã¦ãcentos64ãã¨ããååã® box ã®éå½¢ãä½æãã¾ããã
>bundle exec veewee vbox define centos64 'CentOS-6.4-x86_64-minimal'
ããã«ãã veewee\definitions ã®ä¸ã«ãã¡ã¤ã«ãçæããã¾ãã
veewee/definitions/centos64 ââ base.sh ââ chef.sh ââ cleanup.sh ââ definition.rb ââ ks.cfg ââ puppet.sh ââ vagrant.sh ââ virtualbox.sh ââ vmfusion.sh ââ zerodisk.sh
ä½æãã box ã®è¨å®ãã«ã¹ã¿ãã¤ãºããå ´åã¯ãããã®ãã¡ã¤ã«ãç·¨éãã¾ãã
ããã§ã¯ã¾ã㯠ks.cfg ãç·¨éãã以ä¸ã®é
ç®ãå¤æ´ãã¦æ¥æ¬èªç°å¢ã«ãã¾ããã
- ks.cfg
lang ja_JP.UTF-8 keyboard jp106 timezone Asia/Tokyo
次㫠definition.rb ãç·¨éãã以ä¸ãªã©ãç°å¢ã«åããé©å®å¤æ´ãã¾ãã
# CPU æ° :cpu_count => '1', # ã¡ã¢ãªå®¹é :memory_size=> '1024', # HDD 容é :disk_size => '30420', ã» ã» ã» # iso ã¤ã¡ã¼ã¸åå¾å ãæå¯ã®ãã©ã¼ã«è¨å® :iso_src => "http://ftp.jaist.ac.jp/pub/Linux/CentOS/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso",
å¤æ´ãå®äºããã veewee vbox build ãå®è¡ãã¾ãã
>bundle exec veewee vbox build centos64
éä¸ã以ä¸ã®ããã« ISO ãã¡ã¤ã«ããã¦ã³ãã¼ããããèãããã®ã§ã Yes ãå ¥åã Enter ãæ¼ãã¾ãã
ã» ã» ã» We did not find an isofile here : C:/Documents and Settings/akishin/src/ruby/veewee/iso/CentOS-6.4-x86_64-minimal.iso. The definition provided the following download information: - Download url: http://yum.singlehop.com/CentOS/6.4/isos/x86_64/CentOS-6.4-x86_64-minimal.iso - Md5 Checksum: 4a5fa01c81cc300f4729136e28ebe600 Download? (Yes/No) Yes
ISO ãã¡ã¤ã«ããã¦ã³ãã¼ããããèªåçã« VirtualBox ã®ã¦ã¤ã³ãã¦ãèµ·åã㦠OS ã®ã¤ã³ã¹ãã¼ã«ãé²ãã§ããã¾ãã
æ«ãå¾ ã¡ã以ä¸ã®ãããªã¡ãã»ã¼ã¸ã表示ãããã° OS ã®ã¤ã³ã¹ãã¼ã«ã¯å®äºã§ãã
ã» ã» ã» The box centos64 was built successfully! You can now login to the box with: ssh -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no -p 7222 -l veewee 127.0.0.1
ããããã¾ã§ã§ã¤ã³ã¹ãã¼ã«ãéä¸ã§å¤±æããããããç´ããããªã£ã¦å¼·å¶çã«æ¢ããå ´åãå度 vbox build ãå®è¡ããã«ã¯ --force ãªãã·ã§ã³ãæå®ããå¿ è¦ãããã¾ãã
vbox build å®äºå¾ã VirtualBox ã®ã¦ã¤ã³ãã¦ã¯éãã£ã±ãªãã§ãã²ã¹ããèµ·åããã¾ã¾ã«ãªã£ã¦ãã¾ãã
ãããã vagrant ç¨ã® box ã«å¤æãããããä¸æ¦ããã§ä»®æ³ãã·ã³ãã·ã£ãããã¦ã³ãã¾ãã
ã²ã¹ãã«ã¯ä»¥ä¸ã®ã¦ã¼ã¶ãä½æããã¦ããã®ã§ãããããã§ãã°ã¤ã³ã㦠shutdown ã³ãã³ããå®è¡ãã¦ãã ããã
ã¦ã¼ã¶ | ãã¹ã¯ã¼ã |
---|---|
vagrant | vagrant |
veewee | veewee |
root | vagrant |
ä¸è¬ã¦ã¼ã¶ã sudo ã許å¯ããã¦ããã®ã§ãsudo shutdown -h now ãªã©ãå®è¡å¯è½ã§ãã
ä»®æ³ãã·ã³ãåæ¢ããããã³ãã³ãããã³ãããã以ä¸ãå®è¡ããä½æããä»®æ³ãã·ã³ã box ãã¡ã¤ã«ã¸ã¨ã¨ã¯ã¹ãã¼ããã¾ãã
>bundle exec veewee vbox export centos64
å®äºãã㨠veewee ãã£ã¬ã¯ããªã®ä¸ã«æ¡å¼µå box ã®ãã¡ã¤ã«ãä½æããã¦ããã®ã§ãé©å½ãªãã£ã¬ã¯ããªã«ç§»åããã¦ããã¾ãã
>mv centos64.box D:\vagrant\box
ãã㧠box ãä½æã§ãã¾ããã
box ã使ã
ä½æãã box ã使ç¨ããã«ã¯ãå¤é¨ã® box ã使ãæã¨åæ§ãã¾ã㯠vagrant ã« box add ããå¿
è¦ãããã¾ãã
æ©éä½æãã box ãã¡ã¤ã«ã vagrant ã«è¿½å ãã¦ã¿ã¾ãã
>vagrant box add centos64 D:\vagrant\box\centos64.box
åé¡ãªã追å ã§ããããä»®æ³ãã·ã³ç¨ã®ãã£ã¬ã¯ããªãä½æããvagrant init ãå®è¡ãã¾ãã
>md centos64-01 >cd centos64-01 >vagrant init centos64
ãã㧠vagrant ç¨ã®æ°ããªä»®æ³ãã·ã³ãä½æããã¾ããã
vagrant up ããã°ä»®æ³ãã·ã³ãèµ·åã§ãã¾ãã
>vagrant up
msysgit ãå ¥ãã¦ã³ãã³ãããã³ãã㧠ssh ã³ãã³ãã使ããç¶æ ã«ãªã£ã¦ããå ´åãä»®æ³ãã·ã³èµ·åå¾ã« vagrant ssh ã§ã³ãã³ãããã³ãããã SSH æ¥ç¶ãããã¨ãåºæ¥ã¾ãã
>vagrant ssh
以å¾ã¯ä»®æ³ãã·ã³ãå¿ è¦ã«ãªã度ã«ã
- é©å½ãªãã£ã¬ã¯ããªä½æ
- vagrant init
- vagrant up
ã§ä½æãããã¨ãåºæ¥ãããã«ãªãã¾ããã
以ä¸ã§ Windows ã§ã® Vagrant + Veewee ç°å¢ã®æ§ç¯ã¯å®äºã§ãã
Windows ä¸ã§æ°è»½ã« Linux ç°å¢ãä½ã£ããæ¶ãããã§ããããã«ãªã£ãã®ã§ãããããã¨æ¤è¨¼ãªã©ãã¯ãã©ãããã§ããã
åè
veeweeã使ã£ã¦Vagrantç¨ã®boxãèªåã§ä½ãæ¹æ³ | Ryuzee.com
http://www.ryuzee.com/contents/blog/6614