CentOS5下安装Redmine0.9.3

三月 8, 2010 in Ruby/Ruby on Rails

CentOS下安装Redmine的过程是一个痛苦的过程,其间遇到了很多问题,借助强大的网络才顺利完成了安装工作,在此记录一下安装的细节以备查阅。

环境信息:

  1. CentOS 5
  2. Ruby 1.8.7
  3. RubyGems 1.3.6
  4. Ruby on Rails 2.3.5
  5. Redmine 0.9.3
  6. Postgresql 8.4.2

 

一,安装Ruby1.8.7和Ruby on Rails2.3.5

1,使用CentOS的安装工具安装ruby:

yum install -y ruby
yum install -y ruby-devel ruby-docs ruby-ri ruby-irb ruby-rdoc

完成后检查Ruby版本:

ruby -v

发现版本是1.8.5,而不是所需要的1.8.7。只好下载源代码编译安装,下载解压

运行 [root@collaborative ruby-1.8.7-p248]# ./configure

报如下的错误:
checking build system type… i686-pc-linux-gnu
checking host system type… i686-pc-linux-gnu
checking target system type… i686-pc-linux-gnu
checking for gcc… no
checking for cc… no
checking for cl.exe… no
configure: error: no acceptable C compiler found in $PATH
See `config.log’ for more details.

这个错误是由于系统没有安装 gcc 的原因,运行如下命令安装gcc编译器:

yum install -y gcc

gcc编译器安装完成后再次运行配置,编译安装

[root@collaborative ruby-1.8.7-p248]# ./configure
[root@collaborative ruby-1.8.7-p248]# make&make install

ruby -v 再次检查ruby的版本

2,安装RubyGems1.3.6

下载RubyGems安装程序,并解压

运行 [root@collaborative rubygems-1.3.6]# ./setup.rb 安装

3,安装Ruby on Rails 2.3.5

通过RubyGems来安装Rails,运行命令:

gem install rails

 

二,安装数据库Postgresql 8.4.2

1,安装数据库系统

从官方网下载安装文件postgresql-8.4.2-1-linux.bin

修改文件为可执行:chmod +x postgresql-8.4.2-1-linux.bin

[root@collaborative u01]# ./postgresql-8.4.2-1-linux.bin 启动安装界面,提供安装目录和管理员密码,根据安装界面完成安装。

Postgresql数据库安装完成后, 安装Postgresql的Ruby插件:gem install postgres-pr

2,创建Redmine数据库和用户

psql -U postgres postgres
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD ‘aronezhang’ NOINHERIT VALID UNTIL ‘infinity’;
CREATE DATABASE redmine WITH ENCODING=’UTF8′ OWNER=redmine;

3,配置Redmine使用Postgresql数据库

下载Redmine0.9.3安装程序,解压到redmine-0.9.3目录,cd到此目录

拷贝config/database.yml.example 文件为 config/database.yml,配置production段的内容为:
production:
adapter: postgresql
database: redmine
host: localhost
username: postgres
password: “postgres”
encoding: utf8

4,运行redmine脚本

[root@collaborative redmine-0.9.3]# rake config/initializers/session_store.rb RAILS_ENV=”production”
[root@collaborative redmine-0.9.3]# rake generate_session_store

5,迁移数据库和数据

将数据库对象创建到Postgresql中

[root@collaborative redmine-0.9.3]# rake db:migrate RAILS_ENV=”production”

导入默认的配置信息

[root@collaborative redmine-0.9.3]# rake redmine:load_default_data RAILS_ENV=”production”

 

三,启动Redmine

运行命令启动Redmine

[root@collaborative redmine-0.9.3]# ruby script/server -e production

1,错误#1

启动报错,如下信息:

/usr/local/lib/ruby/site_ruby/1.8/rubygems.rb:777:in `report_activate_error’: Could not find RubyGem rack (~> 1.0.1) (Gem::LoadError)

看样子是rake的版本不够,Rails2.3.5中的rake版本是1.0.1的,重新安装Rails来升级rack

[root@collaborative ~]# gem install rails

2,错误#2

安装rails又报出如下的错误:

/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in `gem_original_require’: no such file to load — zlib (LoadError)

是zlib库没有安装

解决方案:

yum install zlib-devel
进入目录/u01/ruby-1.8.7-p248/ext/zlib
运行 ruby extconf.rb
运行 make && make install

3,错误#3

再次启动Redmine,又报出如下错误:

./script/../config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks’: no such file to load — openssl (RuntimeError)

看来又缺少openssl库

解决方案:

从网上找到了解决方案http://netfork.javaeye.com/blog/432928

http://www.openssl.org/ 上下载:openssl-0.9.8m.tar.gz

tar -xvf openssl-0.9.8m.tar.gz 解压后,

执行make && make install

回到ruby源文件文件夹的/ext/openssl文件夹下,执行以下命令:

ruby extconf.rb –with-openssl-include=/usr/local/ssl/include/ –with-openssl-lib=/usr/local/ssl/lib

成功!!!

 

再次启动Redmine,没有错误信息,通过浏览器访问Redmine系统:
http://localhost:3000

使用admin/admin登录系统进行配置

相关文章:

  1. 基于RoR的项目协作平台Redmine
  2. Passenger实现Redmine和Apache集成

6 responses to CentOS5下安装Redmine0.9.3

  1. [url=http://www.ksd.com]哦哦[/url]
    哦哦
    哦哦

  2. 能不能告诉我为什么我安装postgresql 8.4.2 最后总是报:problem running post-install step .Installation may not complete correctly
    the database cluster initialisation failed

  3. 查看解决问题的那片帖子,发现问题的核心在于缺少ssl.h这个头文件。通常一个软件包只包含运行时文件而不包含源码,源码通常在*-dev或*-devel包中。可以查看这篇post
    http://ubuntuforums.org/showthread.php?t=452519

    从源码编译OpenSSL能解决该问题是因为编译过程中会同时安装源码

  4. 最后openssl那个看起来好像是因为只安装了openssl而没有装openssl-devel的包

    • 这里细节被我省略了,其中有一个步骤是确认系统是否安装了openssl。
      但是我很奇怪LS的怎么会认为是没有安装openssl-devel包呢?

Leave a reply

You must be logged in to post a comment.