Vagrant ã®ãã¼ã¹BOXä½ææé (Scientific Linux 6.1)
Scientific Linux 6.1 ã®ãã¼ã¹ BOX ãèªåã§ä½æãã¦ã¿ãã
http://docs-v1.vagrantup.com/v1/docs/base_boxes.html
ã¾ã㯠VirtualBox ä¸ã§ VM ãä½æãããããã¦ãvagrant package ã³ãã³ãã§ããã±ã¼ã¸åããã
以ä¸ãããææ°ã®ã¤ã³ã¹ãã¼ã«DVDã¤ã¡ã¼ã¸ããã¦ã³ãã¼ããã¦ããã
http://www.scientificlinux.org/
VirtualBox ã®ç»é¢ããä»®æ³ãã·ã³ã®æ°è¦ä½æ
åå | vagrant-sl6 |
---|---|
OS | Linux |
ãã¼ã¸ã§ã³ | RedHat |
ã¡ã¤ã³ã¡ã¢ãª | 512 MB |
ãããã»ãã | PIIX3 |
ãªã¼ãã£ãª | ç¡å¹ |
USB | ç¡å¹ |
ãããã¯ã¼ã¯ | NAT |
ã¹ãã¬ã¼ã¸(HDD) | 80GB (åçæ¡å¼µVMDKå½¢å¼) |
ã¹ãã¬ã¼ã¸(CDROM) | ã¤ã³ã¹ãã¼ã«DVDã¤ã¡ã¼ã¸ãå²ãå½ã¦(ã¤ã³ã¹ãã¼ã«æã®ã¿ï¼ |
ãããã»ãããICH9 ã«ããã¨ããªããããã±ã¼ã¸åããã¾ããããªãã£ããã¾ãããã¼ã¹ BOX ãã³ã³ãã¯ãã«ããããHDD㯠VMDK å½¢å¼ã§ä½æãã¦ã¿ãããã以å¤ã®å½¢å¼ã§ã¯è©¦ãããã¨ã¯ãªãã
ä»®æ³ãã·ã³ã« Scientific Linux 6.1 ã¤ã³ã¹ãã¼ã«
ä»®æ³ãã·ã³ã®ã¤ã³ã¹ãã¼ã«ãè¡ããåºæ¬çã«ã¤ã³ã¹ãã¼ã©ã¼ã®æµãã®ã¾ã¾ã§ãããã以ä¸ã®ç¹ã ã注æããã
ã¤ã³ã¹ãã¼ã«å¾ã®ä½æ¥
root ã§ãã°ã¤ã³ãã¦ãVagrant ä»æ§ã«ã»ããã¢ããããã
ããã±ã¼ã¸æ´æ°
ææ°ã®ããã±ã¼ã¸ã«ã¢ãããã¼ããããã«ã¼ãã«ãªã©ãæ´æ°ãããã®ã§ã¤ãã§ã«ãªãã¼ãã
$ yum update $ reboot
ãã«ãç¨ããã±ã¼ã¸
Chef ã VirtualBox Guest Addition ã¤ã³ã¹ãã¼ã«ã®ããã«å¿ è¦ãªããã±ã¼ã¸ãã¤ã³ã¹ãã¼ã«ã
$ yum install ruby ruby-devel gcc gcc-c++ automake autoconf make rubygems kernel-devel
Chef
Chef ã®ã¤ã³ã¹ãã¼ã«
$ gem install chef --no-ri --no-rdoc
Guest Addition
VirtualBox ã® [ããã¤ã¹]-[GuestAdditionã¤ã³ã¹ãã¼ã«]ãé¸æããã
GuestAddition ã®ã¤ã³ã¹ãã¼ã«
$ mount /dev/cdrom /mnt $ sh /mnt/VBoxLinuxAdditions.run
ããã±ã¼ã¸åé¤
VMãµã¤ãºåæ¸ã®ãããå¯è½ãªéãä¸è¦ãªããã±ã¼ã¸ã¯åé¤ããã
$ yum remove ruby-devel gcc gcc-c++ automake autoconf make $ yum remove kernel-devel kernel-headers $ yum remove xorg-x11-drv-ati-firmware yum-autoupdate $ yum remove kernel-å¤ããã¼ã¸ã§ã³
yum ã®ç®¡çæ å ±ãã¯ãªã¢ãã
$ yum clear all
sudo
ãã¹ã¯ã¼ããªã㧠sudo ã§ããããã«ãããã¾ããrequiretty ãç¡å¹ã«ããã
ã³ãã³ãï¼
$ visudo
è¨å®å 容ï¼
# Default requiretty %wheel ALL=(ALL) NOPASSWD:ALL
openssh
openssh ãµã¼ãã®è¨å®ãå¤æ´ããã°ã¤ã³æéãç縮ããããããã
$ echo 'UseDNS no' >> /etc/ssh/sshd_config
vagrant ã¦ã¼ã¶ä½æ
vagrant ã¦ã¼ã¶ãä½æããsudo 権éãä»å ãssh å ¬ééµèªè¨¼ã§ãã°ã¤ã³ã§ããããã«ããããã¹ã¯ã¼ã㯠vagrantã
$ adduser vagrant $ passwd vagrant $ gpasswd -a vagrant wheel $ mkdir /home/vagrant/.ssh $ chmod 700 /home/vagrant/.ssh $ cd /home/vagrant/.ssh $ curl 'https://raw.github.com/mitchellh/vagrant/master/keys/vagrant.pub' > authorized_keys $ chown -R vagrant:vagrant /home/vagrant/.ssh
ãããã¯ã¼ã¯é¢é£
dhcp ãªã¼ã¹æ å ±ãåé¤ã
$ rm /var/lib/dhcp3/*
udev ã«ããMACã¢ãã¬ã¹ã®èªåä¿åãç¡å¹åããã
$ rm /etc/udev/rules.d/70-persistent-net.rules $ mkdir /etc/udev/rules.d/70-persistent-net.rules
Vagrant ããã±ã¼ã¸å
ãã¹ããã·ã³ä¸ã§ãã¼ã¹BOXã®ããã±ã¼ã¸åããã
vagrant package --base vagrant-sl6
package.box ãçæãããããã®ãã¡ã¤ã«ãé å¸ãããã¨ã«ãªãã
ãã¼ã¹BOX ã®åä½ç¢ºèª
試ãã«æå ã§ä½¿ããããã«ãã¦ã¿ãã
vagrant box add sl6 package.box mkdir sl6test cd sl6test vagrant init sl6 vagrant up
ãã㧠sl6 ã使ããããã«ãªã£ãã