====== Rubricksインストール手順 ====== ==== 前提条件 ==== * 以下の手順は[[http://www.netcube.ne.jp/|ZoneExpress]]にRubricks(ルブリクス)をインストールする場合の手順となります。他のサーバにインストールする場合は設定が異なる場合があります。 * 以下の手順はOpenSolaris+Apache+mod_proxy_balancer+Mongrel構成の手順となります。 * 以下の手順は rubricks-0.6.8を用いて説明しています。バージョンにより内容が異なる場合がありますがご了承ください。 * 以下の説明はFierfoxを用いて説明しています。 * インストールにはターミナルエミュレータを利用しています。ターミナルエミュレータについてはご自身でご用意ください。 * 弊社ではRubricksに関するサポートは行っておりません。Rubricksに関するご質問にはお答えできません。 ===== バーチャルホスト設定 ===== v-hostsディレクトリ内にバーチャルホスト用のコンフィグファイルを作成します。 ここではvirtual.confとします。(ファイル名はXXX.confであれば任意の名称でかまいません) 以下の手順では80番ポートにApacheを利用したまま、8000番ポート、8080番ポートを追加しています。 # cd /opt/csw/apache2/etc/v-hosts # vi virtual.conf 【 記述例 】 ★マークの列を環境に合わせて書き換えてください。\\ 下記の例では、サーバ名をexampl.jp、mongrelを5プロセスで起動する例となります。 #===[Setting for Static]=======================================================#  ★ ServerName example.jp ★ DocumentRoot /opt/csw/apache2/share/htdocs ★  ★ Options None AllowOverride All Allow from all #===[Setting for mongrel]=======================================================#  ★ ServerName example.jp ★ DocumentRoot /var/mongrel/rubricks/public ★  ★ Options None AllowOverride None Allow from all #===[Setting for Rubricks]=====================================================#  ★ ServerName example.jp ★ ProxyRequests Off ProxyPass /errors/ http://example.jp:8000/errors/ ★ ProxyPass /images/ http://example.jp:8000/images/ ★ ProxyPass /javascripts/ http://example.jp:8000/javascripts/ ★ ProxyPass /stylesheets/ http://example.jp:8000/stylesheets/ ★ ProxyPass / balancer://rubricks/ timeout=2 ProxyPassReverse / balancer://rubricks/ Options None AllowOverride None Allow from all BalancerMember http://example.jp:3000 loadfactor=20 keepalive=on ★ BalancerMember http://example.jp:3001 loadfactor=20 keepalive=on ★ BalancerMember http://example.jp:3002 loadfactor=20 keepalive=on ★ BalancerMember http://example.jp:3003 loadfactor=20 keepalive=on ★ BalancerMember http://example.jp:3004 loadfactor=20 keepalive=on ★ ==== main.confの修正 ==== # cd /opt/csw/apache2/etc/extra # vi main.conf 【 記述例 】 DocumentRoot "/opt/csw/apache2/share/htdocs" ServerRoot "/opt/csw/apache2" Listen xxx.xxx.xxx.xxx:80 Listen xxx.xxx.xxx.xxx:8000 Listen xxx.xxx.xxx.xxx:8080 ==== virtualhostip.conf ==== # vi virtualhostip.conf NameVirtualHost xxx.xxx.xxx.xxx:80 NameVirtualHost xxx.xxx.xxx.xxx:443 NameVirtualHost xxx.xxx.xxx.xxx:8000 NameVirtualHost xxx.xxx.xxx.xxx:8080 ===== ファイルのダウンロード ===== [[http://rubricks.org/|Rubricks公式サイト]]より、rubricksをダウンロードします。 ここではrubricks-0.6.8.tar.gzを利用します。 # cd /usr/local # wget [ファイルURL] ==== ファイルの解凍 ==== # tar xvfz rubricks-0.6.8.tar.gz ==== ディレクトリ作成 ==== mongrelインストールディレクトリを作成します。 ここでは/var/mongrelとします。 # mkdir /var/mongrel # chmod 701 /var/mongrel 解凍したrubricksディレクトリをmongrelディレクトリ配下に移動します。 # mv -p rubricks/ /var/mongrel ===== Gemパッケージインストール ===== 必要なGemパッケージをインストールします。 # cd /var/mongrel/rubricks # gem install rake # gem install mongrel_cluster # gem update --system ===== mongrelインストール ===== # gem install mongrel Need to update 26 gems from http://gems.rubyforge.org .......................... complete Select which gem to install for your platform (i386-solaris2.8) 1. mongrel 1.1.4 (ruby) 2. mongrel 1.1.4 (java) 3. mongrel 1.1.4 (x86-mswin32-60) 4. mongrel 1.1.3 (java) 5. mongrel 1.1.3 (i386-mswin32) 6. mongrel 1.1.3 (ruby) 7. Skip this gem 8. Cancel installation **> 1** を入力します。 Install required dependency fastthread? [Yn] y Select which gem to install for your platform (i386-solaris2.8) 1. fastthread 1.0.1 (mswin32) 2. fastthread 1.0.1 (ruby) 3. fastthread 1.0.1 (i386-mswin32) 4. Skip this gem 5. Cancel installation **> 2** を入力します。 Building native extensions. This could take a while... Install required dependency cgi_multipart_eof_fix? [Yn] y Building native extensions. This could take a while... Successfully installed mongrel-1.1.4 Successfully installed fastthread-1.0.1 Successfully installed cgi_multipart_eof_fix-2.5.0 Installing ri documentation for mongrel-1.1.4... Installing ri documentation for fastthread-1.0.1... No definition for dummy_dump No definition for dummy_dump No definition for rb_queue_marshal_load No definition for rb_queue_marshal_dump Installing ri documentation for cgi_multipart_eof_fix-2.5.0... Installing RDoc documentation for mongrel-1.1.4... Installing RDoc documentation for fastthread-1.0.1... No definition for dummy_dump No definition for dummy_dump No definition for rb_queue_marshal_load No definition for rb_queue_marshal_dump Installing RDoc documentation for cgi_multipart_eof_fix-2.5.0... ==== Gemパッケージのインストール確認 ==== インストールしたGemパッケージが表示される事を確認してください。 # gem list --local 【 出力結果例 】 *** LOCAL GEMS *** cgi_multipart_eof_fix (2.5.0) daemons (1.0.10) fastthread (1.0.1) gem_plugin (0.2.3) mongrel (1.1.4) mongrel_cluster (1.0.5) rake (0.8.1) rubygems-update (1.1.1) sources (0.0.1) ===== database.ymlファイルの編集 ===== # cp /var/mongrel/rubricks/config/sample1_environment.rb /var/mongrel/rubricks/config/environment.rb # cp /var/mongrel/rubricks/config/sample1_database.yml /var/mongrel/rubricks/config/database.yml socket,username,passwordの内容を修正します。 # vi /var/mongrel/rubricks/config/database.yml 【 記述内容例 】 common: &common adapter: mysql host: localhost socket: /tmp/mysql.sock username: root password: *************** encoding: utf8 |socket |/tmp/mysql.sock|/opt/csw/mysql5/my.cnfを確認 | |username|root |ご契約時の設定完了メールの、MySQLアクセス情報ユーザー | |password|***************|ご契約時の設定完了メールの、MySQLアクセス情報初期パスワード| ===== パーミッション変更 ===== # chown -R webservd:webservd /var/mongrel/rubricks ===== データベースの作成 ===== ここではデータベース名をrubricksとします。 # mysql -u root -p <パスワード> mysql> CREATE DATABASE rubricks; mysql> exit # export RAILS_ENV=production # rake db:migrate ===== mongrelの起動/停止 ===== ==== mongrel cluster起動ファイル作成 ===== 以下のコマンドで、ポート3000~3004番でmongrelを起動させる設定ファイルが作成されます。 ご自身の環境に合わせて、値を設定してください。 # cd /var/mongrel/rubricks # mongrel_rails cluster::configure -e production -p 3000 -N 5 -c /var/mongrel/rubricks/ ==== mongrel clusterの起動 ==== # cd /var/mongrel/rubricks # mongrel_rails cluster::start ==== mongrel clusterの停止 ==== # cd /var/mongrel/rubricks # mongrel_rails cluster::stop ==== 動作確認 ==== http://example.jp:8080にアクセスしRubriucksトップページが表示される事を確認します。 管理者ユーザでログインします。 デフォルトの管理者ユーザ、パスワードは以下になります。 |ユーザ名|admin| |パスワード|pass| 管理画面イメージ\\ ^{{:cms:ruburicks.gif|}}^ ===== 関連リンク ===== * [[http://rubricks.org/index.html|Rubricks公式サイト]]  * [[http://mongrel.rubyforge.org/|mongrel.rubyforge.org]]