CentOS下安裝Redmine的過(guò)程是一個(gè)痛苦的過(guò)程,其間遇到了很多問題,借助強(qiáng)大的網(wǎng)絡(luò)才順利完成了安裝工作,在此記錄一下安裝的細(xì)節(jié)以備查閱。
環(huán)境信息:
- CentOS 5
- Ruby 1.8.7
- RubyGems 1.3.6
- Ruby on Rails 2.3.5
- Redmine 0.9.3
- 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
發(fā)現(xiàn)版本是1.8.5,而不是所需要的1.8.7。只好下載源代碼編譯安裝,下載解壓
運(yùn)行 [root@collaborative ruby-1.8.7-p248]# ./configure
報(bào)如下的錯(cuò)誤:
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.
這個(gè)錯(cuò)誤是由于系統(tǒng)沒有安裝 gcc 的原因,運(yùn)行如下命令安裝gcc編譯器:
yum install -y gcc
gcc編譯器安裝完成后再次運(yùn)行配置,編譯安裝
[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安裝程序,并解壓
運(yùn)行 [root@collaborative rubygems-1.3.6]# ./setup.rb 安裝
3,安裝Ruby on Rails 2.3.5
通過(guò)RubyGems來(lái)安裝Rails,運(yùn)行命令:
gem install rails
二,安裝數(shù)據(jù)庫(kù)Postgresql 8.4.2
1,安裝數(shù)據(jù)庫(kù)系統(tǒng)
從官方網(wǎng)下載安裝文件postgresql-8.4.2-1-linux.bin
修改文件為可執(zhí)行:chmod +x postgresql-8.4.2-1-linux.bin
[root@collaborative u01]# ./postgresql-8.4.2-1-linux.bin 啟動(dòng)安裝界面,提供安裝目錄和管理員密碼,根據(jù)安裝界面完成安裝。
Postgresql數(shù)據(jù)庫(kù)安裝完成后, 安裝Postgresql的Ruby插件:gem install postgres-pr
2,創(chuàng)建Redmine數(shù)據(jù)庫(kù)和用戶
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數(shù)據(jù)庫(kù)
下載Redmine0.9.3安裝程序,解壓到redmine-0.9.3目錄,cd到此目錄
拷貝config/database.yml.example 文件為 config/database.yml,配置production段的內(nèi)容為:
production:
adapter: postgresql
database: redmine
host: localhost
username: postgres
password: “postgres”
encoding: utf8
4,運(yùn)行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,遷移數(shù)據(jù)庫(kù)和數(shù)據(jù)
將數(shù)據(jù)庫(kù)對(duì)象創(chuàng)建到Postgresql中
[root@collaborative redmine-0.9.3]# rake db:migrate RAILS_ENV=”production”
導(dǎo)入默認(rèn)的配置信息
[root@collaborative redmine-0.9.3]# rake redmine:load_default_data RAILS_ENV=”production”
三,啟動(dòng)Redmine
運(yùn)行命令啟動(dòng)Redmine
[root@collaborative redmine-0.9.3]# ruby script/server -e production
1,錯(cuò)誤#1
啟動(dòng)報(bào)錯(cuò),如下信息:
/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來(lái)升級(jí)rack
[root@collaborative ~]# gem install rails
2,錯(cuò)誤#2
安裝rails又報(bào)出如下的錯(cuò)誤:
/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庫(kù)沒有安裝
解決方案:
yum install zlib-devel
進(jìn)入目錄/u01/ruby-1.8.7-p248/ext/zlib
運(yùn)行 ruby extconf.rb
運(yùn)行 make && make install
3,錯(cuò)誤#3
再次啟動(dòng)Redmine,又報(bào)出如下錯(cuò)誤:
./script/../config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks’: no such file to load — openssl (RuntimeError)
看來(lái)又缺少openssl庫(kù)
解決方案:
從網(wǎng)上找到了解決方案http://netfork.javaeye.com/blog/432928
從 http://www.openssl.org/ 上下載:openssl-0.9.8m.tar.gz
tar -xvf openssl-0.9.8m.tar.gz 解壓后,
執(zhí)行make && make install
回到ruby源文件文件夾的/ext/openssl文件夾下,執(zhí)行以下命令:
ruby extconf.rb –with-openssl-include=/usr/local/ssl/include/ –with-openssl-lib=/usr/local/ssl/lib
成功!??!
再次啟動(dòng)Redmine,沒有錯(cuò)誤信息,通過(guò)瀏覽器訪問Redmine系統(tǒng):
http://localhost:3000
使用admin/admin登錄系統(tǒng)進(jìn)行配置
posted on 2011-03-05 09:28
大鳥 閱讀(692)
評(píng)論(2) 編輯 收藏 所屬分類:
linux