Debian wheezyï¼Debian 7.4ï¼ã®Vagrant Boxãä½æãã
åºæ¬çãªæé ã¯Creating a Base Box - Vagrant Documentationãåç §ã
Debuan wheezyã®ã¤ã³ã¹ãã¼ã«ã¤ã¡ã¼ã¸ãåå¾
- amd64çã®netinst CDããã¦ã³ãã¼ãã
- Debian -- Network install from a minimal CD
VirtualBoxã§VMãä½æï¼Debianã®ã¤ã³ã¹ãã¼ã«ï¼
ä»®æ³ãã·ã³ä½ææã®ãã¤ã³ãã¨ãã¦ã¯ã
- VMä½ææã®ååã¯ãªãã§ãOKãæçµçãªBoxåã¨ã¯é¢ä¿ããªãï¼ããã§ã¯debian_wheezy_x64ã¨ããï¼
- ãªã¼ãã£ãªã¨USBã³ã³ããã¼ã©ãç¡å¹åï¼Vagrantæ¨å¥¨ï¼
- ã¡ã¢ãªã¯512MBã«ããï¼Vagrantæ¨å¥¨ï¼
- ä»®æ³ãã£ã¹ã¯ã¯vmdkã«ããï¼ãããVagrantçéã§ã¯æ®éã£ã½ãï¼
ã¨ãªãããã ãèªåã®å¥½ã¿ã®åé¡ï¼ã©ããå¾ããå¢ããã®ã§ï¼ãã¡ã¢ãªã¯1024MBã¨ããããã¨ãä»®æ³ãã£ã¹ã¯ã¯ãã¨ããããå¯å¤32GBã«ãã¦ãããããã®ä»ã®VirtualBoxä¸ã®è¨å®ã¯åæè¨å®ã®ã¾ã¾ã
次ã«ãDebianã¤ã³ã¹ãã¼ã«æã®è¨å®ã ãã
- æ¥æ¬èªç°å¢åãã«è²ã é¸æ
- rootãã¹ã¯ã¼ã㯠vagrant ã«ãã
- ãã°ã¤ã³ã¢ã«ã¦ã³ãã« vagrantï¼ãã¹ã¯ã¼ã㯠vagrantï¼ãä½æ
- åæã¤ã³ã¹ãã¼ã«ããã±ã¼ã¸ã¯ãæ¨æºã·ã¹ãã ã¦ã¼ãã£ãªãã£ãã¨ãSSHãµã¼ããã®ã¿ãé¸æ
ãããããæ°ã«ããã¨ããã¯ãªãã£ãã
VirtualBox NATãä»®è¨å®
Debianãã¤ã³ã¹ãã¼ã«ãå®äºããæç¹ã§SSHæ¥ç¶ã§ãããåæã»ããã¢ããæã®ä½æ¥ã楽ã«ãªãã®ã§ãæ«å®çã«SSHæ¥ç¶ã§ããããã«VirtualBoxã®NATãå¤æ´ãããã¨ããããã次ã®ããã«è¨å®ããã
ããã§ãlocalhost:10022ã«sshæ¥ç¶ããã¨ãVMã®æ¹ã«ç¹ããããã«ãªãã
GRUBã®è¨å®
VMãèµ·åãããã³ã«ãã¼ããã¼ãã表示ããã¦ãéªéãããã®ã§ã表示ããªãããã«ããã
/etc/default/grub ã次ã®ããã«è¨å®ããã
GRUB_DEFAULT=0 GRUB_HIDDEN_TIMEOUT=0 GRUB_HIDDEN_TIMEOUT_QUIET=true GRUB_TIMEOUT=10 GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian` GRUB_CMDLINE_LINUX_DEFAULT="quiet splash" GRUB_CMDLINE_LINUX=""
è¨å®ãã§ãããã
$ update-grub
grub2 - How do I hide the GRUB menu showing up in the beginning of boot? - Ask Ubuntu
ããã±ã¼ã¸ã®ã¢ãããã¼ã
念ã®ããã¢ãããã¼ããããnetinst CDãå©ç¨ãã¦ããã®ã§ããã¶ãæ´æ°ã¯ãªãã¯ãã
$ apt-get update $ apt-get upgrade
VirtualBox Guest Additionsã®ã¤ã³ã¹ãã¼ã«
ã¾ãã¯VirtualBoxå´ã§Guest Additonsã®ã¤ã³ã¹ãã¼ã«ã¡ãã£ã¢ããã¦ã³ãããã
æä½ãã§ãããã次ã®ã³ãã³ããå®è¡ãã¦ã¤ã³ã¹ãã¼ã«ã
$ mount /media/cdrom $ sh /media/cdrom/VBoxLinuxAdditions.run
IPv6ç¡å¹å
Vagrantç°å¢ã§ã¯ä½¿ããã¨ã¯ãªãã®ã§OFFã«ããã
/etc/sysctl.conf ã®æ«å°¾ã«æ¬¡ã追å ã
net.ipv6.conf.all.disable_ipv6 = 1
è¨å®ãåæ ããã
$ sysctl -p
sudoã®è¨å®
Vagrantã®è¨å®è¦ä»¶ã¨ãã¦ããã¹ã¯ã¼ãç¡ãã®sudoãè¨å®ããå¿ è¦ãããã
ã¾ãã¯sudoã®ã¤ã³ã¹ãã¼ã«ã
$ apt-get install sudo
sudoãã¤ã³ã¹ãã¼ã«ããããvagrantã¦ã¼ã¶ç¨ã«è¨å®ã追å ããã
$ visudo
ã§ãã¨ãã£ã¿ãéãã®ã§ãæ«å°¾ã«ä»¥ä¸ã追å ã
vagrant ALL=(ALL) NOPASSWD: ALL
SSHã®è¨å®
ã¨ãããããVagrantã®ããã¥ã¢ã«ã§ã¯ãsshdã®è¨å®ã§ãUseDNS noãã«ãã¦ããã¹ãï¼ã©ãããã¼ã«ã«ããããç¹ããªãã®ã§ï¼ã¨æ¸ãã¦ããã®ã§ãããã«å¾ãã
/etc/ssh/sshd_configãéãã¦ã次ãæ«å°¾ã«è¿½å ããã
UseDNS no
æ®éã«sshdãè¨å®ããã¨ãããã§ãPermitRootLogin noããæ¸ããããªããã©ãä»ã®ã¤ã¡ã¼ã¸ã確èªããããyesã®ã¾ã¾ã«ãã¦ãã£ãã
ç¶ãã¦vagrantã¦ã¼ã¶ç¨ã«SSHå ¬ééµãè¨å®ããã
æé ãç°¡ç¥åããããã«ãvagrantã¦ã¼ã¶ã§æ¬¡ã®ã³ãã³ããå®è¡ããã
$ cd ~ $ mkdir .ssh $ cd .ssh $ wget http://github.com/mitchellh/vagrant/raw/master/keys/vagrant.pub $ mv vagrant.pub authorized_keys $ chmod 600 authorized_keys $ chmod 700 .
ãã¨ã¯Vagrantç¨ã®ç§å¯éµã使ã£ã¦æ¥ç¶ã§ããã確èªããã
MTAã®åæ¢ï¼ä»»æï¼
ããã©ã«ãã§MTAï¼exim4ï¼ãã¤ã³ã¹ãã¼ã«ããã¦ãèªåã§ãµã¼ãã¹ãèµ·åããããã«ãªã£ã¦ãã£ã½ãã®ã§ãæ°ã«ãªãå ´åã¯æ¢ããã
$ update-rc.d -f exim4 remove
Puppet/Chefã®ã¤ã³ã¹ãã¼ã«ï¼ä»»æï¼
å¿ é ã§ã¯ãªãããå ¥ãã¦ããã¦æã¯ãªãã
Puputãã¤ã³ã¹ãã¼ã«ã
$ apt-get -y install puppet puppetmaster
Chefãã¤ã³ã¹ãã¼ã«ã
$ apt-get -y install chef
ã¤ã³ã¹ãã¼ã«æã«Chef Clientã®æ¥ç¶å ã®è¨å®ãèãããã®ã§ã空æ¬ã®ã¾ã¾ç¡è¦ã§è¯ããChefã®ã¤ã³ã¹ãã¼ã«ãçµãã£ãããChef Clientã®ãµã¼ãã¹ãåæ¢ãã¦ããã
$ /etc/init.d/chef-client stop $ update-rc.d -f chef-client remove
追å ã§è²ã ã¤ã³ã¹ãã¼ã«ï¼ä»»æï¼
ã好ããªç©å ¥ãã¦ãã ãããã¨ããããVimã¨Gitãããã¯å ¥ãã¨ããæ¹ãç¡é£ã£ã½ãã®ã§å ¥ããããã¨ãcurlããã使ãã®ã§å ¥ããã
$ apt-get -y install vim git curl
ãã¨ãç§ã¯Windowsã§ä½¿ãåæã§ãSharedFolderã使ãæã«åé¡ãããï¼VirtualBoxのShared Folderが遅すぎるのでどうにかする(Windows向け) - terurouメモï¼ã®ã§ãsambaãã¤ã³ã¹ãã¼ã«ããã
ã³ãã³ãå±¥æ´ã®åé¤ï¼ä»»æï¼
ãªãã¨ãªãã³ãã³ãå±¥æ´ãæ®ã£ã¦ããã®ãå«ãªã®ã§ã¯ãªã¢ããã
$ export HISTSIZE=0 $ rm .bash_history
Vagrantç¨ã®Boxãä½æ
ãã¹ãå´ã§æ¬¡ã®ã³ãã³ããå®è¡ãããåè¿°ã®æé ã§ä¸æçã«è¨å®NATãã¼ãã«ã¯ãvagrantãèªåçã«æ¶ãã¦ãããã®ã§ãæ°ã«ããªãã¦ãããã
ã¾ãã¯ããã±ã¼ã¸ãä½æãããvagrant packageã³ãã³ãã®VMå㯠~/VirtualBox VMs ã«åå¨ãããã£ã¬ã¯ããªåãæãã
$ vagrant package --base debian_wheezy_x64
ããã§ã«ã¬ã³ããã£ã¬ã¯ããªã«ãpackage.box ãä½æããããããããå ã¯æ®éã«Vagrantãæä½ããã®ã¨å¤ãããªãã
$ vagrant box add my-box package.box $ vagrant init my-box $ vagrant up