Created
May 6, 2014 01:24
-
-
Save lonefreak/d40501bc734aad3fd156 to your computer and use it in GitHub Desktop.
Chef + Knife Solo + Ruby 2.1.0 on CentOS
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
#!/usr/bin/env bash | |
# repository | |
cd /tmp | |
wget http://dl.fedoraproject.org/pub/epel/6/x86_64/epel-release-6-8.noarch.rpm | |
rpm -Uvh epel-release-6-8.noarch.rpm | |
# system update | |
yum -y update | |
yum -y install gcc | |
yum -y install *gcc-c++* | |
yum -y groupinstall "Development Tools" | |
yum -y install libxslt-devel libyaml-devel libxml2-devel gdbm-devel libffi-devel zlib-devel openssl-devel libyaml-devel readline-devel curl-devel openssl-devel pcre-devel git memcached-devel valgrind-devel mysql-devel ImageMagick-devel ImageMagick | |
# ruby 2.1.0 | |
version=2.1.0 | |
cd /usr/local/src | |
wget ftp://ftp.ruby-lang.org/pub/ruby/2.1/ruby-$version.tar.gz | |
tar zxvf ruby-$version.tar.gz | |
cd ruby-$version | |
./configure | |
make | |
make install | |
# ruby-gems | |
version=2.2.0 | |
cd .. | |
wget http://production.cf.rubygems.org/rubygems/rubygems-$version.tgz | |
tar zxvf rubygems-$version.tgz | |
cd rubygems-$version | |
/usr/local/bin/ruby setup.rb | |
# knife-solo | |
gem install knife-solo --no-ri --no-rdoc | |
# delivering your keys to hosts | |
HOST=your.host.here.com | |
USER=yourUser | |
cat ~/.ssh/id_rsa.pub | ssh ${USER}@${HOST} 'mkdir ~/.ssh; cat >> ~/.ssh/authorized_keys' | |
# setting up kitchen | |
cd /opt | |
# creates project and runs basic config | |
knife solo init kitchen | |
cd /opt/kitchen | |
knife configure -r . --defaults | |
# examples | |
# creates nginx recipe | |
# knife cookbook create nginx -o cookbooks | |
# | |
# installs chef and ruby in the node | |
# knife prepare root@host | |
# | |
# configures run_list for a node | |
# nodes->node.json {"run_list":["recipe[nginx]"]} | |
# | |
# runs recipes in the node | |
# knife solo cook root@host |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment