MacOS10.5でRedmine+passenger

時間ないのでさーっとコマンドだけメモ。
後でまとめる。

sudo port -uv install mysql5 +server

my.cnf修正。
[mysqld]
default-character-set = utf8
skip-character-set-client-handshake

権限修正
sudo chown -R _mysql:_mysql /opt/local/var/db/mysql5

sudo -u mysql mysql_install_db5

↓だめ。
sudo mysql_install_db5

sudo /opt/local/share/mysql5/mysql/mysql.server start
Starting MySQL
...... ERROR! Manager of pid-file quit without updating file.

mysql5 -u root
ERROR 2002 (HY000): Can't connect to local MySQL server through socket '/opt/local/var/run/mysql5/mysqld.sock' (2)
↑デーモンが起動してると思うので、プロセス殺して、mysqlユーザー指定してDB初期からやればok。
+環境設定から起動できるmysqlを停止しておかないと、TCP/IP使用されててこっちのServer動かないから注意。

sudo /opt/local/share/mysql5/mysql/mysql.server start
Starting MySQL
. SUCCESS!

mysqladmin5 -u root password 'xxxxxxxx'
create database db_radmine default character set utg8;


sudo gem update

sudo gem update --system

sudo port install subversion

gem install -v=2.3.5 rails
mkdir /works/


cd /works
svn checkout http://redmine.rubyforge.org/svn/trunk/ redmine

cd redmine
cp /works/redmine/config/database.yml.example /works/redmine/config/database.yml
vi database.yml
production:
adapter: mysql
database: db_redmine
host: localhost
username: root
password: xxxxxxxx
encoding: utf8

rake config/initializers/session_store.rb

↓が出る場合はversion指定してrails入れ直す。
(in /works/redmine)
Missing the Rails 2.3.5 gem. Please `gem install -v=2.3.5 rails`, update your RAILS_GEM_VERSION setting in config/environment.rb for the Rails version you do have installed, or comment out RAILS_GEM_VERSION to use the latest version installed.

rake db:migrate RAILS_ENV=production --trace

確認。
script/server -e production
http://0.0.0.0:3000

sudo gem install passenger

passenger-install-apache2-module

                                                                                      • -

The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.15
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails
applications on Apache, without any further Ruby on Rails-specific
configuration!

Press ENTER to continue.

                                                                                      • -

Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
Apache configuration file and set its DocumentRoot to /somewhere/public:


ServerName www.yourhost.com
DocumentRoot /somewhere/public # <-- be sure to point to 'public'!

AllowOverride all # <-- relax Apache security settings
Options -MultiViews # <-- MultiViews must be turned off

And that's it! You may also want to check the Users Guide for security and
optimization tips, troubleshooting and other useful information:

/Library/Ruby/Gems/1.8/gems/passenger-2.2.15/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
http://www.modrails.com/

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.

sudo vi /etc/apache2/httpd.conf

LoadModule vhost_alias_module libexec/apache2/mod_vhost_alias.so

# Virtual hosts
#Include /private/etc/apache2/extra/httpd-vhosts.conf

sudp vi /etc/apache2/other/passenger.cnf
LoadModule passenger_module /Library/Ruby/Gems/1.8/gems/passenger-2.2.15/ext/apache2/mod_passenger.so
PassengerRoot /Library/Ruby/Gems/1.8/gems/passenger-2.2.15
PassengerRuby /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby



ServerName www.yourhost.com
DocumentRoot /works/redmine/public

AllowOverride all
Options -MultiViews
Order deny,allow


/private/etc/apache2/extra/httpd-vhosts.conf

ServerAdmin webmaster@dummy-host.example.com
DocumentRoot "/usr/docs/dummy-host.example.com"
ServerName dummy-host.example.com
ServerAlias www.dummy-host.example.com
ErrorLog "/private/var/log/apache2/dummy-host.example.com-error_log"
CustomLog "/private/var/log/apache2/dummy-host.example.com-access_log" common

sudo apachectl configtest

sudo apachectl restart


http://redmine.jp/tech_note/apache-passenger/
パーミッションの問題