Created
March 6, 2012 13:11
-
-
Save kano4/1986186 to your computer and use it in GitHub Desktop.
Troch setup script for RedHat.
This file contains hidden or 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/sh | |
| # Troch | |
| echo "Download Troch" | |
| yum install -y git | |
| cd /srv/ | |
| git clone https://github.com/kano4/troch.git troch | |
| # Ruby | |
| echo "Setup Ruby" | |
| yum install -y gcc gcc-c++ make perl zlib-devel httpd-devel openssl-devel curl-devel libyaml-devel \ | |
| readline-devel libxml2 libxml2-devel bzip2-devel unzip libjpeg-devel libpng-devel freetype-devel \ | |
| ruby-devel libxslt libxslt-devel | |
| cd /tmp/ | |
| wget ftp://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p125.tar.gz | |
| tar xvfz ruby-1.9.3-p125.tar.gz | |
| cd ruby-1.9.3-p125 | |
| ./configure --prefix=/usr | |
| make && make install | |
| # MySQL | |
| echo "Setup MySQL" | |
| yum install -y mysql mysql-server mysql-devel | |
| mysql -u root -e " | |
| create database troch character set utf8; | |
| create user 'troch'@'localhost' identified by 'troch'; | |
| grant all privileges on troch.* to 'troch'@'localhost'; | |
| exit | |
| " || { echo "Error!"; exit 1; } | |
| echo "Success!" | |
| cp /srv/troch/config/database.mysql.yml /srv/troch/config/database.yml | |
| # SMTP | |
| echo "Setup SMTP" | |
| cp /srv/troch/config/settings.example.yml /srv/troch/config/settings.yml | |
| # Redis | |
| echo "Setup Redis" | |
| cd /tmp/ | |
| wget http://redis.googlecode.com/files/redis-2.4.8.tar.gz | |
| tar xvfz redis-2.4.8.tar.gz | |
| cd redis-2.4.8 | |
| make && make install | |
| mkdir /etc/redis | |
| cp /srv/troch/ext/redis/redis.conf /etc/redis/redis.conf | |
| cp /srv/troch/ext/redis/redis-server.redhat /etc/init.d/redis-server | |
| cp /srv/troch/ext/redis/redis /etc/sysconfig/redis | |
| /sbin/chkconfig --add redis-server | |
| /sbin/chkconfig redis-server on | |
| /etc/init.d/redis-server start | |
| # Bundler | |
| echo "Setup Redis" | |
| cd /srv/troch/ | |
| gem install bundler --pre | |
| bundle install --without development test --deployment | |
| RAILS_ENV=production bundle exec rake db:setup | |
| # Passenger & Nginx | |
| echo "Setup Passenger & Nginx" | |
| cd /srv/troch/ | |
| expect -c " | |
| spawn bundle exec passenger-install-nginx-module | |
| expect \"Press Enter to continue, or Ctrl-C to abort.\" | |
| send \"1\n\" | |
| expect \"Enter your choice (1 or 2) or press Ctrl-C to abort:\" | |
| send \"1\n\" | |
| expect \"Please specify a prefix directory\" | |
| send \"/etc/nginx\n\" | |
| expect \"Press ENTER to continue.\" | |
| send \"\n\" | |
| interact" | |
| cp /srv/troch/ext/nginx/nginx.conf /etc/nginx/nginx.conf | |
| cp /srv/troch/ext/nginx/mime.types /etc/nginx/mime.types | |
| cp /srv/troch/ext/nginx/nginx.redhat /etc/init.d/nginx | |
| /sbin/chkconfig --add nginx | |
| /sbin/chkconfig nginx on | |
| /etc/init.d/nginx start | |
| # Troch Worker | |
| echo "Setup Troch Worker" | |
| cd /srv/troch/ | |
| cp /srv/troch/ext/troch/troch-worker.redhat /etc/init.d/troch-worker | |
| /sbin/chkconfig --add troch-worker | |
| /sbin/chkconfig troch-worker on | |
| /etc/init.d/troch-worker start | |
| # Troch Health Checker | |
| echo "Setup Troch Health Checker" | |
| cd /srv/troch/ | |
| cp /srv/troch/ext/troch/troch-health-checker.redhat /etc/init.d/troch-health-checker | |
| /sbin/chkconfig --add troch-health-checker | |
| /sbin/chkconfig troch-health-checker on | |
| /etc/init.d/troch-health-checker start | |
| echo "Setup Success!!!" | |
| echo "----" | |
| cat <<EOF | |
| What's next: | |
| Customize /srv/troch/config/settings.yml and restart the server. | |
| Yah!! | |
| EOF |
Author
typo修正しました!
あとpassengerはbundleで他のgemと一緒にまとめてインストールしちゃってるからgem install passengerはいらないはず。
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
gem install passengerが必要ではありませんか?
あと73と75行目でngixとタイポしてます。
よろしくです。