POSTS
FreeBSD 9.0 架設安裝 redmine
之前有介紹過FreeBSD 架設 redmine.
不過現在因為版本關係不相容,以無法使用.
$ cd /usr/ports/www/redmine
$ make install clean
===> redmine-1.3.1 is marked as broken: Does not work with RubyGems 1.8.
*** Error code 1
Stop in /usr/ports/www/redmine.
$
現在來介紹一下如何手動安裝.
1. 首先先裝好 Ruby 1.9 與所需要相關套件
$ echo "RUBY_VERSION=1.9.3" >> /etc/make.conf
$ cd /usr/ports/lang/ruby19
$ make install clean
$ cd /usr/ports/devel/ruby-gems
$ make install clean
$ cd /usr/ports/converters/ruby-iconv
$ make install clean
$ cd /usr/ports/databases/ruby-mysql
$ make install clean
$ gem19 install rails --version=2.3.14
2. 拉Redmine最新版本 來安裝
$ mkdir /usr/local/www/
$ cd /usr/local/www/
$ svn co http://redmine.rubyforge.org/svn/trunk redmine
$ cd redmine
# 拷貝設定檔 設定
$ cp config/configuration.yml.example config/configuration.yml
$ cp config/database.yml.example config/database.yml
# 編輯好相關設定
$ vi config/configuration.yml
$ vi config/database.yml
# 產生 session store secret.
$ rake generate_session_store
# 產生 populate database 資料庫
$ rake db:migrate RAILS_ENV=production
$ rake redmine:load_default_data RAILS_ENV=production
# 建立獨立使用者
$ pw groupadd -n redmine -g 3000
$ pw useradd -n redmine -u 3000 -g 3000 -d /usr/local/www/redmine -s /bin/sh -h -
# 修改好目錄權限
$ mkdir tmp public/plugin_assets
$ sudo chown -R redmine:redmine files log tmp public/plugin_assets
$ sudo chmod -R 755 files log tmp public/plugin_assets
# Login as Redmine user
$ su - redmine
# 啟動
$ ruby19 script/server webrick -e production
NGINX 設定
upstream mongrel {
server 127.0.0.1:3000;
}
server {
listen 80;
server_name redmine.test;
root /usr/local/www/redmine/public;
location / {
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_set_header Host $http_host;
proxy_redirect off;
proxy_read_timeout 30;
if (-f $request_filename/index.html) {
rewrite (.*) $1/index.html break;
}
if (-f $request_filename.html) {
rewrite (.*) $1.html break;
}
if (-f $request_filename.txt) {
rewrite (.*) $1.txt break;
}
proxy_pass http://mongrel/;
}
}