RedmineをApache+Passengerで動かす

wget http://www.redmine.org/releases/redmine-2.5.1.tar.gz
tar zxvf redmine-2.5.1.tar.gz
mv redmine-2.5.1 /var/www/vhosts/redmine

rpm -ivh http://dev.mysql.com/get/mysql-community-release-el6-5.noarch.rpm
yum install httpd curl-devel httpd24-devel apr-util-devel apr-devel ruby-devel rubygems libxslt-devel libxml2-devel gcc gcc-c++ sqlite-devel ImageMagick-devel expect mysql-community-server mysql-community-client mysql-community-devel
gem install passenger bundle bundler rake

passenger-install-apache2-module --auto
passenger-install-apache2-module --snippet > /etc/httpd/conf.d/passenger.conf

vim /var/www/vhosts/redmine/config/database.yml
---
production:
  adapter: mysql2
  database: redmine
  host: 127.0.0.1
  username: {user}
  password: {pass}
  encoding: utf8
---

cd /var/www/vhosts/redmine
/usr/local/bin/bundle install --without development test --path vendor/bundle

mysql -uroot -e "create database redmine default character set utf8 collate utf8_unicode_ci";
mysql -uroot -e "GRANT ALL ON redmine.* TO ${user}@'127.0.0.1' IDENTIFIED BY '${pass}';";
mysql -uroot -e "FLUSH PRIVILEGES";

/usr/local/bin/bundle exec /usr/local/bin/rake generate_secret_token
/usr/local/bin/bundle exec /usr/local/bin/rake db:migrate RAILS_ENV=production

service mysqld start

vim /etc/httpd/conf.d/www.conf
---
<VirtualHost *:80>
  ServerName   {server_name}
  DocumentRoot /var/www/vhosts/redmine/public

  <Directory /var/www/vhosts/redmine/public>
    AllowOverride all
    Options -MultiViews
    Require all granted
  </Directory>
</VirtualHost>
---

service httpd start