Last active
December 18, 2015 13:39
-
-
Save ysaotome/5791280 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# File:chef-solo_automatic_install_with_centos63_64bit_Plain_for_niftycloud.sh | |
# 2013/06/16 @ysaotome | |
#=============================================== | |
# Settings | |
#=============================================== | |
##ニフティクラウドのAPIキーを埋め込むと便利 | |
NIFTY_CLOUD_ACCESS_KEY='Your NIFTY Cloud Access Key' | |
NIFTY_CLOUD_SECRET_KEY='Your NIFTY Cloud Secret Key' | |
#=============================================== | |
## セットアップに必要なライブラリのインストール | |
/usr/bin/yum -y install gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel openssl-devel make bzip2 autoconf automake libtool bison wget unzip git | |
## rbenvセットアップ | |
/usr/bin/git clone git://github.com/sstephenson/rbenv.git /usr/local/rbenv | |
/bin/mkdir /usr/local/rbenv/{shims,versions} | |
/usr/sbin/groupadd rbenv | |
/bin/chgrp -R rbenv /usr/local/rbenv | |
/bin/chmod -R g+rwxXs /usr/local/rbenv | |
/bin/cat << _RBENVCONF_ > /etc/profile.d/rbenv.sh | |
export RBENV_ROOT=/usr/local/rbenv | |
export PATH=\${PATH}:\${RBENV_ROOT}/bin | |
eval "\$(/usr/local/rbenv/bin/rbenv init -)" | |
_RBENVCONF_ | |
/bin/sh /etc/profile.d/rbenv.sh | |
## ruby-buildセットアップ | |
/usr/bin/git clone git://github.com/sstephenson/ruby-build.git /usr/local/ruby-build | |
cd /usr/local/ruby-build/ && ./install.sh | |
## rubyセットアップ | |
/usr/local/rbenv/bin/rbenv install 1.9.3-p429 | |
/usr/local/rbenv/bin/rbenv global 1.9.3-p429 | |
/usr/local/rbenv/bin/rbenv rehash | |
## chef-solo, knife-soloセットアップ | |
/usr/local/rbenv/shims/gem install chef knife-solo --no-ri --no-rdoc | |
/usr/local/rbenv/bin/rbenv rehash | |
# 作業ディレクトリ | |
/bin/mkdir /etc/chef | |
/bin/mkdir /var/chef-solo | |
# 設定 | |
/bin/cat << _CHEFSOLOCONF_ > /etc/chef/solo.rb | |
file_cache_path "/var/chef-solo" | |
cookbook_path ["/root/chef/cookbooks"] | |
role_path "/root/chef/role" | |
json_attribs "/etc/chef/node.json" | |
log_level :debug | |
_CHEFSOLOCONF_ | |
echo '{ "run_list": [] }' > /etc/chef/node.json | |
## nifty-cloud-sdk, knife-nc, someセットアップ | |
## knife for niftycloud : https://github.com/tily/ruby-knife-nc | |
## sumo for niftycloud : https://github.com/tily/some | |
/usr/local/rbenv/shims/gem install nifty-cloud-sdk knife-nc some --no-ri --no-rdoc | |
/usr/local/rbenv/bin/rbenv rehash | |
## serverspecセットアップ | |
## RSpec tests for checking your servers : http://serverspec.org/ | |
/usr/local/rbenv/shims/gem install serverspec --no-ri --no-rdoc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
/bin/cp -p /etc/rc.d/rc.local{,.org} ; /bin/echo -e '#!/bin/bash\n/bin/mv /etc/rc.d/rc.local.org /etc/rc.d/rc.local ; /usr/bin/curl -s https://gist.github.com/ysaotome/5791280/raw/chef-solo_automatic_install_with_centos63_64bit_Plain_for_niftycloud.sh | /bin/bash' > /etc/rc.d/rc.local |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
サーバの新規作成時や起動時に下記画面に「起動時スクリプト.sh」の記載内容をコピー&ペーストで実行
