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 nginx curl-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 unicorn bundle bundler rake vim /etc/nginx/nginx.conf --- upstream unicorn { server unix:/tmp/unicorn.todo.sock fail_timeout=0; } server { listen 80; server_name _; root /var/www/vhosts/redmine/public; try_files $uri @unicorn; location @unicorn { proxy_set_header Host $http_host; proxy_pass http://unicorn; } error_page 500 502 503 504 /500.html; } --- 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 vim Gemfile --- gem "unicorn" --- /usr/local/bin/bundle install --without development test --path vendor/bundle service mysqld start 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 vim /etc/init.d/redmine --- #!/bin/sh # chkconfig: 2345 85 15 RAILS_ENV=production RAILS_ROOT=/var/www/vhosts/redmine set -e sig () { test -s "$PID" && kill -$1 `cat "$PID"` } oldsig () { test -s "$OLD_PID" && kill -$1 `cat "$OLD_PID"` } cmd () { case $1 in start) sig 0 && echo >&2 "Already running" && exit 0 echo "Starting" $CMD ;; stop) sig QUIT && echo "Stopping" && exit 0 echo >&2 "Not running" ;; force-stop) sig TERM && echo "Forcing a stop" && exit 0 echo >&2 "Not running" ;; restart|reload) sig USR2 && sleep 5 && oldsig QUIT && echo "Killing old master" `cat $OLD_PID` && exit 0 echo >&2 "Couldn't reload, starting '$CMD' instead" $CMD ;; upgrade) sig USR2 && echo Upgraded && exit 0 echo >&2 "Couldn't upgrade, starting '$CMD' instead" $CMD ;; rotate) sig USR1 && echo rotated logs OK && exit 0 echo >&2 "Couldn't rotate logs" && exit 1 ;; *) echo >&2 "Usage: $0 <start|stop|restart|upgrade|rotate|force-stop>" exit 1 ;; esac } setup () { echo -n "$RAILS_ROOT: " cd $RAILS_ROOT || exit 1 export PID=$RAILS_ROOT/tmp/pids/unicorn.pid export OLD_PID="$PID.oldbin" CMD="/usr/local/bin/bundle exec /usr/local/bin/unicorn --config-file config/unicorn.rb --env $RAILS_ENV --daemonize" } start_stop () { if [ $2 ]; then . $2 fi setup cmd $1 } ARGS="$1 $2" start_stop $ARGS --- service redmine start service nginx restart