CentOS 下 Redmine 安装实战记录
Redmine 官方安装文档
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
Ruby on Rails 官网
http://rubyonrails.org/download
【安装 Ruby 环境】
安装 Ruby
wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p327.tar.gz tar xvfz ruby-1.9.3-p327.tar.gz ./configure make make install
安装 RubyGems
wget http://rubyforge.org/frs/download.php/76073/rubygems-1.8.24.tgz tar xvfz rubygems-1.8.24.tgz cd rubygems-1.8.24 ruby setup.rb
安装 Rails
gem install rails
安装第三方软件包
gem install rake -v '10.0.2' gem install mysql2 -v '0.3.11' -- --with-mysql-config=/data2/mysql5.5/bin/mysql_config gem install activerecord-mysql-adapter -- --with-mysql-config=/data2/mysql5.5/bin/mysql_config
【安装 Redmine】
下载 redmine,地址 http://rubyforge.org/frs/?group_id=1850
将 redmine 解压后复制到安装目录
cp -rf redmine-2.1.4 /data/
安装 Bundler
gem install bundler
安装 redmine
cd /data/redmine-2.1.4 bundle install --without development test rmagick postgresql sqlite
【配置数据库】
创建数据库
create database redmine character set utf8; create user 'redmine'@'localhost' identified by 'my_password'; grant all privileges on redmine.* to 'redmine'@'localhost';
修改配置文件
cp config/database.yml.example to config/database.yml
【生成 Rails 使用的密钥】
rake generate_secret_token
【初始化数据表】
在项目根目录下执行下面的命令:
cd /data/redmine-2.1.4 RAILS_ENV=production rake db:migrate export RAILS_ENV=production rake db:migrate
初始化数据表中的配置数据
RAILS_ENV=production REDMINE_LANG=zh rake redmine:load_default_data
【修改文件访问权限】
mkdir tmp tmp/pdf public/plugin_assets chown -R redmine:redmine files log tmp public/plugin_assets chmod -R 775 files log tmp public/plugin_assets
【启动web server】
为了避免采用 ip:port 的地址来访问 redmine,可以使用 nginx 做代理。创建虚拟主机配置文件www.redmine.com.conf:
upstream webrick { server 127.0.0.1:3000; } server { listen 80; server_name www.redmine.com; root /data/redmine-2.1.4/public; location / { index index.php index.html index.shtml; proxy_pass http://webrick; proxy_redirect off; proxy_set_header Host $host; proxy_set_header X-Real_IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; } }
启动 WEBrick web server
nohup ruby script/rails server webrick -e production > log/webrick.log &
访问 Redmine