centos5.5上安装redmine小计(2011-05-23 22:49:21)

最近在应部门开发经理的需要,在centos5.5上安装了redmine项目管理软件。刚开始是按着别人的中文档做的,安装完成后,还是出现了很多问题。在细读英文官方文档后,这些问题都已经解决了。最主要的还是因为redmine使用的ruby开发环境,需要严格的按照官方的安装文档安装对应的ruby包。

下面我把安装经过命令记录一下,也方便自己今后查看:

1、yum安装必要的编译环境及库


yum -y groupinstall “Development Tools”

yum -y install zlib-devel wget openssl-devel pcre pcre-devel make gcc gcc-c++ curl-devel

2、安装ruby,请大家注意版本。ruby-1.8.7.tar.gz


wget http://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz

tar -zxvf ruby-1.8.7.tar.gz

cd ruby-1.8.7

nohup ./configure -prefix=/usr/local/ruby

make && make install

cd /usr/bin ; ln -s /usr/local/ruby/bin/ruby

3、安装rubygems ,注意一定要是1.5.0以下的版本,不然无法正常启动使用redmine。我就是因为看了一个他人写得中文文档,安装了1.5.1版本,所以redmine一直无法正常工作,为此走了一大圈弯路。最后在官方文档上才找到问题所在。下面是官网上的一些对版本要求的描述。


Ruby 1.9 is not supported yet. You have to use Ruby 1.8.x as stated above.
RubyGems 1.3.1 or higher is required (Rails 2.3.5 will fail with RubyGems 1.5.0 and later, stick to previous versions of RubyGems)
Rake 0.8.3 or higher is required
Rack 1.0.1 is required. If you don’t have this exact version, database migration would fail.
I18n 0.4.2 is required for Redmine >= 1.0.5


下面是安装命令


wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz

tar -zxvf rubygems-1.4.2.tgz

cd rubygem-1.4.2

ruby setup.rb

4、安装rails rack i18n mysql passenger


gem install rails -v=2.3.5

gem install rack -v=1.0.1

gem install -v=0.4.2 i18n

gem install mysql –no-rdoc –no-ri – –with-mysql-dir=/usr/local/mysql #我的mysql是编译安装在/usr/local/mysql目录 下的

gem install passenger


5、通过passenger的passenger-install-nginx-module安装nginx来

passenger-install-nginx-module #我选择安装方式2来安装我的nginx,编译参数如下:


./configure –user=www –group=www –prefix=/usr/local/nginx –with-http_stub_status_module –with-http_ssl_module –with-http_gzip_static_module –with-ipv6 –add-module=’/usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.7/ext/nginx’

6、安装 redmine


wget http://rubyforge.org/frs/download.php/74722/redmine-1.1.3.tar.gz

tar -zxvf redmine-1.1.3.tar.gz

cd redmine-1.1.3/config

cp database.yml.example database.yml

vi database.yml

  # MySQL (default setup).

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

mysql -uroot -p 

    create database redmine character set utf8;

    grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'xxxxxxxx';
rake generate_session_store

RAILS_ENV=production rake db:migrate

RAILS_ENV=production rake redmine:load_default_data

chown -R www:www files log tmp public/plugin_assets

chmod -R 755 files log tmp public/plugin_assets


7、配置nginx


vi /usr/local/nginx/conf/nginx.conf

  #在http配置中加下面3行
  passenger_root /usr/local/ruby/lib/ruby/gems/1.8/gems/passenger-3.0.7;
  passenger_ruby /usr/local/ruby/bin/ruby;
  passenger_max_pool_size 10;

 #新加一个redmine的server配置

 server {
  listen 80;
  server_name xxxx.com;
  access_log /home/wwwlogs/redming.log;
  error_log /home/wwwlogs/redming_error.log;
  root /home/redmine/public;   # <--- be sure to point to 'public'!
  passenger_enabled on;
}


8、 重启nginx,就可以访问redmine了。

坚持原创技术分享,您的支持将鼓励我继续创作!