在 debian7.6 下 redmine 2.6.1 + thin + nginx 的安装和配置

安装

<!-- lang: shell -->
git clone https://github.com/redmine/redmine.git
cd redmine
git co -b 2.6-stable origin/2.6-stable

apt-get install imagemagick
gem install bundler

bundle install

# 测试安装环境
bundle install --without development test

bundle install --without development test rmagick

mv config/database.yml.example config/database.yml
vi config/database.yml
# 全部注释掉后添加:
production:
    adapter: sqlite3
    database: db/test.db

rake generate_secret_token
rake db:migrate RAILS_ENV="production"

ruby script/rails server -e production

之后访问 http://localhost:3000/

配置 thin

<!-- lang: shell -->
# 在 gem "builder", "3.0.4" 下面添加 gem "thin"
vi Gemfile

rm Gemfile.lock
bundle install

thin install

# 添加服务
update-rc.d -f thin defaults

创建 redmine 的配置文件

vi /etc/thin/redmine.yml

<!-- lang: shell -->
---
pid: tmp/pids/thin.pid
group: root
wait: 30
timeout: 30
log: log/thin.log
max_conns: 1024
require: []

environment: production
max_persistent_conns: 512
servers: 4
daemonize: true
user: root
socket: /tmp/thin.sock
chdir: /root/git/redmine

之后运行 /etc/init.d/thin start

整合 nginx

<!-- lang: shell -->
log_format  rm.erp-ec.com  '$remote_addr - $remote_user [$time_local] $request '
         '$status $body_bytes_sent $http_referer '
         '$http_user_agent $http_x_forwarded_for';

upstream thinserver {
    server unix:/tmp/thin.0.sock;
    server unix:/tmp/thin.1.sock;
    server unix:/tmp/thin.2.sock;
    server unix:/tmp/thin.3.sock;
}
server
{
    listen       80;
    server_name rm.erp-ec.com;
    root  /root/git/redmine/public;

    location /
    {
        try_files $uri/index.html $uri.html $uri @cluster;
    }
    location @cluster {
        proxy_pass http://thinserver;
    }
    access_log  /home/wwwlogs/rm.erp-ec.com.log  rm.erp-ec.com;
}

安装插件 redmine_code_review 代码评审

<!-- lang: shell -->
cd plugins

hg clone https://bitbucket.org/haru_iida/redmine_code_review

rake redmine:plugins:migrate RAILS_ENV=production

安装主题 gitmike

<!-- lang: shell -->
cd public/themes

git clone git://github.com/makotokw/redmine-theme-gitmike.git

重启服务

/etc/init.d/thin restart

换数据库 sqlite3 to mysql

<!-- lang: shell -->
vi Gemfile
# 在 gem "builder", "3.0.4" 下面加一行
gem "yaml_db"

# 运行
rm Gemfile.lock
bundle install

rake db:dump RAILS_ENV=production

vi config/database.yml
# 配置 mysql 的库信息
production:
    adapter: mysql2
    database: redmine
    host: localhost
    username: redmine
    password: "redmine123" # 密码必须要加双引号
    encoding: utf8
    socket: /tmp/mysql.sock

# 运行
rake db:load RAILS_ENV=production

你可能感兴趣的:(在 debian7.6 下 redmine 2.6.1 + thin + nginx 的安装和配置)