CentOS平台安装配置项目管理工具Redmine

redmine 下载地址 http://rubyforge.org/frs/?group_id=1850
ruby-mysql 下载地址 http://www.tmtm.org/en/ruby/mysql/
rubygems 下载地址 http://rubyforge.org/frs/?group_id=126&release_id=37073
rails 下载地址 http://rubyforge.org/frs/?group_id=307&release_id=39559

安装mysql

# yum –y install mysql-server.x86_64
# service mysqld start
# mysqladmin -u root password 123456(root密码为123456)
# mysql –p
# 123456
mysql>create database redmine character set utf8;
mysql>exit

安装ruby相关软件

# yum -y install ruby ruby-devel ruby-libs ruby-irb ruby-rdoc

安装下载的ruby-mysql

# tar zxvf ruby-mysql-0.2.x.tar.gz
# cd ruby-mysql-0.2.x
# ruby setup.rb
# ruby install.rb

 安装下载的rubygems

# tar zxvf rubygems-1.3.x.tgz
# cd rubygems-1.3.x
# ruby setup.rb

 安装下载的rails

# gem install rails-2.3.x.gem

安装配置redmine

# tar zxvf redmine-1.0.x.tar.gz
# mv redmine-1.0.x redmine
# mv redmine /var/www/html/
# cd /var/www/html/
# cd redmine/config
# mv database.yml.example database.yml
# vim database.yml

在下面相应的位置填上用户名和密码:

production:
adapter: mysql
database: redmine
host: localhost
username: root
password: 123456
encoding: utf8

development:
adapter: mysql
database: redmine_development
host: localhost
username: root
password: 123456
encoding: utf8
:wq
# cd ..
# rake config/initializers/session_store.rb
# rake db:migrate RAILS_ENV=production
# rake redmine:load_default_data RAILS_ENV=production

如果没有出现错误信息,那么可以以webrick的方式试启动下redmine,还是在上面的在命令行里执行

# ruby script/server -e production

在浏览器中访问地址

http://localhost:3000/ 进入 Redmine。缺省管理员用户名是admin,密码也是admin

整合redmine到apache

官方文档 URL:http://www.redmine.org/wiki/1/HowTo_configure_Apache_to_run_Redmine

通过 http://localhost:3000这样访问 redmine 会很慢 , 要把 apache 与 redmine 整合效果就好很多了。不过 Apache 上面沒有 mod_rails ,我们需要安装后才能进行。由于我们之前安装有 Ruby ,安装操作如下:

# gem install passenger
# passenger-install-apache2-module

然后按照提示安装就可以,缺什么安装什么,注意是操作系统位数,安装相应的版本

passenger成功安装后,它会给出如下的配置提示信息,需要将它们添加到apache的配置文件 /etc/httpd/conf/httpd.conf 中

The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

LoadModule passenger_module /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.0/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/1.8/gems/passenger-3.0.0
PassengerRuby /usr/bin/ruby

After you restart Apache, you are ready to deploy any number of Ruby on Rails

applications on Apache, without any further Ruby on Rails-specific
configuration!

配置Apache使其支持cgi

# vim /etc/httpd/conf/httpd.conf
Options Indexes FollowSymLinks (找到这一行,删除“ Indexes ”,并添加“ Includes ”、“ ExecCGI “ )
Options Includes ExecCGI FollowSymLinks(允许服务器执行 CGI 及 SSI))
#AddHandler cgi-script .cgi 找到这一行,去掉行首的“ # ”,并在行尾添加“ .pl ”)
AddHandler cgi-script .cgi .pl  (允许扩展名为 .pl 的 CGI 脚本运行)

配置redmine源码目录下的public/dispath.cgi脚本

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

12.配置虚拟主机

# vim /etc/httpd/conf/httpd.conf
<VirtualHost *:80>
    ServerName redmine.123admin.com
    ServerAdmin [email protected]
    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
        AllowOverride all
    </Directory>
</VirtualHost>