Skip to content

Instantly share code, notes, and snippets.

@shun115
Created May 17, 2012 06:32
Show Gist options
  • Save shun115/2717001 to your computer and use it in GitHub Desktop.
Save shun115/2717001 to your computer and use it in GitHub Desktop.
CentOS minimalでのOracle Virtualbox VMセットアップ(Chef)
## CentOS-6.2-x86_64-minimal.iso完了後
# shutdown -h now
## ネットワーク設定はeth0をNATに、eth1をホストオンリーアダプタにする
# cd /etc/sysconfig/network-scripts/
# vi ifcfg-eth0
DEVICE="eth0"
BOOTPROTO=dhcp
HWADDR="00:00:00:00:00:00"
NM_CONTROLLED="yes"
ONBOOT="yes"
TYPE=Ethernet
# cp ifcfg-eth0 ifcfg-eth1
# vi ifcfg-eth1
DEVICE="eth1"
BOOTPROTO=none
HWADDR="00:00:00:00:00:00"
IPADDR="192.168.56.20"
NETMASK="255.255.255.0"
ONBOOT="yes"
TYPE=Ethernet
# vi /etc/sysconfig/network
NETWORKING=yes
HOSTNAME=vm
# /etc/init.d/network restart
# vi /etc/ssh/sshd_config
PermitRootLogin no
PermitEmptyPasswords no
PasswordAuthentication yes
## 必要あれば /etc/yum.conf にproxy設定追加
# useradd chef
# passwd chef
# yum install sudo
# visudo
chef ALL=(ALL) ALL
# shutdown -r now
## ここからsshでchefユーザでつないで作業
$ sudo su -
# yum install openssl openssl-devel readline readline-devel zlib-devel wget gcc make mlocate man tree svn git
# yum clean all
# yum update
# mkdir lib
# cd lib/
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p352.tar.bz2
# tar xjvf ruby-1.8.7-p352.tar.bz2
# cd ruby-1.8.7-p352
# ./configure --prefix /opt/chef/ruby/1.8.7
# make && make install
# /opt/chef/ruby/1.8.7/bin/ruby -v
# cd ..
# wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz
# tar xzvf rubygems-1.8.10.tgz
# cd rubygems-1.8.10
# /opt/chef/ruby/1.8.7/bin/ruby setup.rb
# /opt/chef/ruby/1.8.7/bin/gem -v
# /opt/chef/ruby/1.8.7/bin/gem install chef --no-ri --no-rdoc
# /opt/chef/ruby/1.8.7/bin/chef-client
# exit
$ vi .bashrc
alias sudo='sudo '
alias cc='/opt/chef/ruby/1.8.7/bin/chef-client'
alias cs='/opt/chef/ruby/1.8.7/bin/chef-solo'
alias kn='/opt/chef/ruby/1.8.7/bin/knife'
alias chefruby='/opt/chef/ruby/1.8.7/bin/ruby'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment