Redmine 安装指南
Redmine 是一款灵活的开源项目管理 Web 应用程序。它使用 Ruby on Rails 框架编写,支持跨平台、多数据库,并提供甘特图、日历、问题跟踪和维基等功能。
2. 安装步骤
Section titled “2. 安装步骤”2.1. 环境准备 (RVM & Ruby)
Section titled “2.1. 环境准备 (RVM & Ruby)”首先需要安装 RVM (Ruby Version Manager) 来管理 Ruby 版本,并安装指定版本的 Ruby。
# 安装 RVMbash < <( curl -L https://get.rvm.io )source /etc/profile.d/rvm.sh# 配置自动激活echo '[[ -s "/etc/profile.d/rvm" ]] && source "/etc/profile.d/rvm"' > /etc/profile
# 安装 Ruby 3.2.0rvm install 3.2.0
# 优化 Gem 更新源 (推荐国内镜像)gem sources --remove https://rubygems.org/gem sources -a https://mirrors.cloud.tencent.com/rubygems/bundle config mirror.https://rubygems.org https://gems.ruby-china.com2.2. 安装核心依赖
Section titled “2.2. 安装核心依赖”# 安装 Rails, Rake 和 Bundlergem install rails -v '6.1.0'gem install rakegem install bundler2.3. Redmine 源码安装与配置
Section titled “2.3. Redmine 源码安装与配置”# 拉取并解压项目cd /opt/softwarewget https://www.redmine.org/releases/redmine-5.1.3.tar.gztar -zxvf redmine-5.1.3.tar.gzcd redmine-5.1.3
# 安装依赖项bundle install --with development test
# 配置文件准备mv config/database.yml.example config/database.yml# 需编辑 config/database.yml 进行数据库连接配置
# 初始化系统bundle exec rake generate_secret_tokenRAILS_ENV=production bundle exec rake db:migrate # 必须一次性执行迁移RAILS_ENV=production bundle exec rake redmine:load_default_data # 加载默认数据
# 临时启动测试bundle exec rails server -e production3. 数据库配置示例
Section titled “3. 数据库配置示例”在 config/database.yml 中配置 MySQL 连接信息:
production: adapter: mysql2 database: redmine host: localhost username: redmine password: "[PASSWORD]" variables: transaction_isolation: "READ-COMMITTED"4. Nginx 与 Passenger 部署
Section titled “4. Nginx 与 Passenger 部署”为了在生产环境获得更好的性能,建议使用 Passenger 模块集成 Nginx。
4.1. 安装 Passenger 模块
Section titled “4.1. 安装 Passenger 模块”apt-get install libcurl4-openssl-devgem install passenger# 按照指引编译安装 Nginx 模块passenger-install-nginx-module4.2. Nginx 站点配置
Section titled “4.2. Nginx 站点配置”server { listen 443 ssl; server_name [DOMAIN]; # 替换为实际域名
ssl_certificate [SSL_CERT_PATH]; ssl_certificate_key [SSL_KEY_PATH];
root /opt/software/redmine-5.1.3/public; index index.html index.htm;
location / { try_files $uri/index.html $uri @app; }
location @app { passenger_enabled on; passenger_app_env production; }
# 静态资源缓存优化 location ~ ^/(images|javascripts|stylesheets|favicon.ico) { expires max; add_header Cache-Control public; }}5. 运行环境依赖
Section titled “5. 运行环境依赖”- 编程语言: Ruby (推荐通过 RVM 管理)
- 数据库: MySQL / PostgreSQL
- Web 服务: Nginx + Passenger / Apache