CentOS 6.6 安装redmine

时间:2024-10-03 11:35:44

Redmine是一个开源的、基于Web的项目管理和缺陷跟踪工具。它用日历和甘特图辅助项目及进度可视化显示。同时它又支持多项目管理。Redmine是一个*开放源码软件解决方案,它提供集成的项目管理功能,问题跟踪,并为多个版本控制选项的支持。虽说像IBM Rational Team Concert的商业项目调查工具已经很强大了,但想坚持一个*和开放源码的解决方案,可能会发现Redmine是一个有用的Scrum和敏捷的选择。 由于Redmine的设计受到Rrac的较大影响,所以它们的软件包有很多相似的特征。Redmine建立在Ruby on Rails的框架之上,它可以夸平台和数据库。

前提安装redmine ruby环境版本要求:

Redmine version Supported Ruby versions Rails version used
3.3, current trunk ruby 1.9.3, 2.0.0, 2.1, 2.2, 2.3 Rails 4.2
3.2, 3.1 ruby 1.9.3, 2.0.0, 2.1, 2.2 Rails 4.2

安装依赖关系

yum install zlib-devel openssl-devel ImageMagick-devel wget curl-devel rubygems mod_fcgid

安装rvm

# gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: requesting key D39DC0E3 from hkp server keys.gnupg.net
gpg: /root/.gnupg/trustdb.gpg: trustdb created
gpg: key D39DC0E3: public key "Michal Papis (RVM signing) <mpapis@gmail.com>" imported
gpg: no ultimately trusted keys found
gpg: Total number processed: 1
gpg: imported: 1 (RSA: 1)
# curl -sSL https://get.rvm.io | bash -s stable
...
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team. In case of problems: https://rvm.io/help and https://twitter.com/rvm_io

载入RVM环境并获取需要的支持安装包

# source /etc/profile.d/rvm.sh
# rvm requirements

利用rvm安装 Ruby 2.2.3 并设为默认

# sed -i -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' /usr/local/rvm/config/db
# rvm gemset create
# rvm install 2.2.3
# rvm use 2.2.3 --default

安装时有可能会遇到下面的错误:

[root@db-02 ~]#  rvm install 2.2.3
Already installed ruby-2.2.3.
To reinstall use: rvm reinstall ruby-2.2.3 Gemset '' does not exist, 'rvm ruby-2.2.3 do rvm gemset create ' first, or append '--create'.

按照提示我们可以重新安装或者使用:

#  rvm install 2.2.3 --create

安装rails

由于国内网络原因(你懂的),导致rubygems.org存放 Amazon S3上面的资源文件间歇性连接失败。所以你会与遇到gem install rack或bundle install的时候半天没有响应,具体可以用gem install rails -V来查看执行过程。下面替换成淘宝的GEM镜像站:

# gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/ # gem sources --remove https://rubygems.org/
https://rubygems.org/
removed from sources # gem sources -a https://ruby.taobao.org/
https://ruby.taobao.org/ added to sources # gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/

安装rails 4.2

# gem install rails -v=4.2

安装mysql和httpd

# yum install httpd httpd-devel -y
# yum install -y mysql*
mysql> create database redmine character set utf8;
mysql> create user 'redmine'@'localhost' identified by 'redmine';
mysql> grant all privileges on redmine.* to 'redmine'@'localhost';

安装redmine的apache支持,这样可以通过apache访问

# gem install passenger
# passenger-install-apache2-module # vim /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.30/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
PassengerRoot /usr/local/rvm/gems/ruby-2.2.3/gems/passenger-5.0.30
PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.3/wrappers/ruby
</IfModule> # vim /etc/httpd/conf.d/redmine.conf
<VirtualHost *:80>
ServerName www.a.com
# !!! Be sure to point DocumentRoot to 'public'!
DocumentRoot /var/www/html/redmine/public
ErrorLog logs/redmine_error_log
<Directory /var/www/html/redmine/public>
Options Indexes ExecCGI FollowSymLinks
Order allow,deny
Allow from all
# This relaxes Apache security settings.
AllowOverride all
# MultiViews must be turned off.
Options -MultiViews
# Uncomment this if you're on Apache >= 2.4:
#Require all granted
</Directory>
</VirtualHost>

安装redmine

# cd /var/www/html
# wget http://www.redmine.org/releases/redmine-3.1.1.tar.gz
# tar -zxvf redmine-3.1.1.tar.gz
# mv redmine-3.1.1 redmine
# cd /var/www/html/redmine/
# vim Gemfile
#source 'https://rubygems.org'
source'https://ruby.taobao.org'
# cp config/configuration.yml.example config/configuration.yml
# cp config/database.yml.example config/database.yml
production:
adapter: mysql2
database: redmine
host: localhost
username: redmine
password: "redmine"
encoding: utf8

安装管理ruby的包依赖的工具bundler

下面安装很容易报错,如果报错请尝试重新安装。

# gem install bundler  #注意是在网站根目录下执行
# bundle install

为Rails生成cookies秘钥

# rake generate_secret_token

初始化redmine数据库表名

# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data

修改fastcgi

# cd /var/www/html/redmine/public/
# cp dispatch.fcgi.example dispatch.fcgi
# cp htaccess.fcgi.example .htaccess

以上操作以后就可以在浏览器中输入www.a.com进行范围redmine,但是请提前做好域名的解析,如果不想做域名解析可以使用IP进行配置访问,具体IP访问配置这里就不做介绍了,

如果安装错误可以测试看redmine的问题还是httpd的问题。

在WEBrick服务上测试Redmine是否安装成功

# bundle exec rails server webrick -e production -b 0.0.0.0

地址:http://IP:3000 (注意:打开iptables 3000端口号)
缺省管理员用户:
login: admin
password: admin