差分表示
- 最後の更新で追加された行はこのように表示します。
- 最後の更新で削除された行は
このように表示します。
*Fedora 17 セットアップメモ
だいたいのサービスやライブラリは、yumやgemでインストールするだけでOK。
引っかかったところをメモ。
**sshで接続できるようにする [#m2200cf9]
ファイアウォールを外す。
http://www.server-world.info/query?os=Fedora_16&p=initial_conf&f=2
デーモンを起動。
systemctl enable sshd.service
systemctl start sshd.service
**gem pg のセットアップ [#aa071d25]
yum install gcc
yum install ruby-devel
yum install postgresql-devel
gem install pg
**railsを使うなら [#a0d312f5]
gem install bundler
yum install sqlite
yum install sqlite-devel
yum install gcc-c++
**NFSのマウント [#m363ccc9]
マウント情報をfstabに書き込んだ後で、
yum install nfs-utils
systemctl enable rpcbind.service
systemctl start rpcbind.service
mount -a
それだけではアクセス許可がないので、
各ユーザーのuidをNFSサーバと合わせる必要がある
**CGIを使えるようにする [#aed03ba0]
/etc/httpd/conf/httpd.conf の
<Directory "/var/www/html">
の近くの
Options に ExecCGI を追加
下記のコメントを解除
AddHandler cgi-script .cgi
SELinuxがうまく設定できなかったので、無効化する(ほんとはよくない)
/etc/selinux/config で
SELINUX=disabled
として再起動
**CGIでRubyを使うと、文字コード周りでトラブル [#y7146e50]
Internal Server Errorが出て、 /var/log/httpd/error_log に、
invalid byte sequence in US-ASCII (ArgumentError)
というログが残る。
/etc/httpd/conf/httpd.conf で、
<Directory "/var/www/html">
の中に以下を追加。
# for Ruby 1.9
SetEnv LC_CTYPE ja_JP.utf8
SetEnv LANG ja_JP.utf8
**Passenger (apacheでrailsアプリなどを動かすモジュール) [#e5c62885]
sudo gem install passenger
sudo /usr/local/bin/passenger-install-apache2-module
足りないものの入れ方を親切に教えてくれるので、言われたとおりやる
/etc/httpd/conf/httpd.conf に下記を追加
(バージョンが変わると思うので、スクリプトの出力からコピペする)
LoadModule passenger_module /usr/local/share/gems/gems/passenger-3.0.13/ext/apache2/mod_passenger.so
PassengerRoot /usr/local/share/gems/gems/passenger-3.0.13
PassengerRuby /usr/bin/ruby
**Passengerでのアプリのデプロイ [#ffb2bc8e]
こちらを参考に
http://www.modrails.com/documentation/Users%20guide%20Apache.html#deploying_rack_to_sub_uri
以下、アプリ名が weekly-report の例
/var/www/webapps/weekly-report にアプリを置く
下記を実行
cd /var/www
ln -s webapps/weekly-report/public weekly-report
/etc/httpd/conf/httpd.conf に下記を追加
<VirtualHost *:80>
ServerName scraper.hallab.co.jp
DocumentRoot /var/www
<Directory /var/www>
Allow from all
Options -MultiViews
</Directory>
RackBaseURI /weekly-report
# RailsBaseURI /weekly-report が必要なアプリもあるみたい
# 2つめ以降のアプリは、この行だけ追加
# RackBaseURI /weekly-report2
</VirtualHost>
**アプリを更新したら (初回デプロイ時も必要) [#e339ac7e]
cd /var/www/webapps/weekly-report
rake db:migrate RAILS_ENV=production
rake assets:precompile RAILS_ENV=production
touch tmp/restart.txt