曲曲折折,费了六七个小时,终于在centos5.4上将redmine给装上了。
如下就是一些步骤和注意的事项了。
1.关于装redmine之前应该注意的支持软甲的版本问题(很重要),这次我就在这费了很多功夫。
摘自http://www.redmine.org/projects/redmine/wiki/RedmineInstall
Compatibility notes
- Ruby 1.9 is not supported yet. You have to use Ruby 1.8.x as stated above.
- RubyGems 1.3.7 or higher is required with following limitations :
- Rails 2.3.5 will fail with RubyGems 1.5.0 or later, stick to previous versions of RubyGems !
- Rails 2.3.11 will fail with RubyGems 1.7.0 or later, stick to previous versions of RubyGems !
- Rake 0.8.7 is required (rake 0.9.x is not supported by Rails yet)
- Rack 1.1.x is required, 1.1.0 has a bug with quotes (#8416). Database migration would fail with other version.
- Mongrel 1.1.5 needs a patch attached to #7688 to work fine with Rails 2.3.11. In case of upgrade, another issue may appear for some time after migration (#7857).
- I18n 0.4.2 is required for Redmine >= 1.0.5
- Rails 2.3.11 to 2.3.14 suffer from a major issue with sending mails to multiple recipients, see #8751 for details and solution.
- Rails 2.3.14 is a minor security release known to work fine with Redmine 1.2.x series (except for previous point) and can be used as a replacement for 2.3.11 (read
config/environment.rb
first).
2.安装MySQL,并且设置为开机启动
#
/etc/init.d/mysqld start
# mysql -u root -p
进入mysql后再 >exit
其实就是需要先启动mysql服务了 (
service mysqld start)
Next Need Create database for redmine
# /etc/init.d/mysqld start
# mysql -u root -p
进入mysql后执行如下几条语句:
CREATE DATABASE redmine CHARACTER SET utf8 COLLATE utf8_general_ci;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL ON redmine.* TO 'redmine'@'localhost';
如此便创建了一个用户为redmine密码为redmine的redmine数据库
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
GRANT ALL ON redmine.* TO 'redmine'@'localhost';
如此便创建了一个用户为redmine密码为redmine的redmine数据库
3.安装Ruby
# yum install gcc-c++ openssl openssl-devel zlib zlib-devel mysql-devel subversion
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz
# tar zxf ruby-1.8.7.tar.gz
# cd ruby-1.8.7
# ./configure
# make && make install
# yum install gcc-c++ openssl openssl-devel zlib zlib-devel mysql-devel subversion
# wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7.tar.gz
# tar zxf ruby-1.8.7.tar.gz
# cd ruby-1.8.7
# ./configure
# make && make install
安装完毕后,可以执行ruby -v查看Ruby的版本信息。
4.安装RubyGems
# wget http://rubyforge.org/frs/download.php/74445/rubygems-1.6.2.tgz
# tar zxvf rubygems-1.6.2.tgz
# cd rubygems-1.6.2
# ruby setup.rb
安装完毕后,可以执行gem -v查看版本信息。
5.安装Rails以及相关的一些东西
如果不能直接用gem install xxx安装,那么可以使用如下的方法将包下载到本地然后再安装
# wget http://rubygems.org/downloads/rake-0.8.3.gem
# wget http://rubygems.org/downloads/rack-1.1.0.gem
# wget http://rubygems.org/downloads/rails-2.3.11.gem
# wget http://rubygems.org/downloads/activesupport-2.3.11.gem
# wget http://rubygems.org/downloads/activerecord-2.3.11.gem
# wget http://rubygems.org/downloads/actionpack-2.3.11.gem
# wget http://rubygems.org/downloads/actionmailer-2.3.11.gem
# wget http://rubygems.org/downloads/activeresource-2.3.11.gem
# wget http://rubygems.org/downloads/i18n-0.4.2.gem
# wget http://rubygems.org/downloads/mysql-2.8.1.gem
# wget http://rubygems.org/downloads/cgi_multipart_eof_fix-2.5.0.gem
# wget http://rubygems.org/downloads/coderay-1.0.0.gem
# gem install --local rake-0.8.3.gem
# gem install --local rack-1.1.0.gem
# gem install --local rails-2.3.11.gem
# gem install --local mysql-2.8.1.gem
# gem install --local i18n-0.4.2.gem
# gem install --local cgi_multipart_eof_fix-2.5.0.gem
# gem install --local coderay-1.0.0.gem
# wget http://rubygems.org/downloads/rack-1.1.0.gem
# wget http://rubygems.org/downloads/rails-2.3.11.gem
# wget http://rubygems.org/downloads/activesupport-2.3.11.gem
# wget http://rubygems.org/downloads/activerecord-2.3.11.gem
# wget http://rubygems.org/downloads/actionpack-2.3.11.gem
# wget http://rubygems.org/downloads/actionmailer-2.3.11.gem
# wget http://rubygems.org/downloads/activeresource-2.3.11.gem
# wget http://rubygems.org/downloads/i18n-0.4.2.gem
# wget http://rubygems.org/downloads/mysql-2.8.1.gem
# wget http://rubygems.org/downloads/cgi_multipart_eof_fix-2.5.0.gem
# wget http://rubygems.org/downloads/coderay-1.0.0.gem
# gem install --local rake-0.8.3.gem
# gem install --local rack-1.1.0.gem
# gem install --local rails-2.3.11.gem
# gem install --local mysql-2.8.1.gem
# gem install --local i18n-0.4.2.gem
# gem install --local cgi_multipart_eof_fix-2.5.0.gem
# gem install --local coderay-1.0.0.gem
如果可以直接用gem install xxx安装的话,那么直接安装就可以了。
# gem install rails -v=2.3.11
# gem install i18n -v=0.4.2
# gem install mysql
# gem install cgi_multipart_eof_fix
# gem install coderay
# gem install i18n -v=0.4.2
# gem install mysql
# gem install cgi_multipart_eof_fix
# gem install coderay
其实这个里边有一些东西我也不知道安着干啥的,有一些各种active,action啥的其实是安装rails的依赖包,但是在后边的执行过程中,如果有提示需要安装什么时,你都可以按照gem install xxx的格式来自己安装。特别是gem install i18n -v=0.4.2这个,如果你在这没有安装,后边肯定会提示你安装的。
6.经过各种的磨叽,现在终于到正题了,安装Redmine
#
cd /opt
# svn co svn://rubyforge.org/var/svn/redmine/branches/1.2-stable redmine
给redmine数据库配置一下,在第一步的时候,咱自个不是创建了一个用户数据库吗?现在就得派上用场了。
# cd /opt/redmine
# cp config/database.yml.example config/database.yml
编辑一下database.yml,使用我们自己的数据库用户信息。但是只需要更改里边的production项信息,其他的东西都不要动。
# vim config/database.yml
production:
adapter: mysql
database: redmine
host: localhost
username: redmine
password: redmine
adapter: mysql
database: redmine
host: localhost
username: redmine
password: redmine
生成session存储加密信息和数据库
# cd /opt/redmine
# rake config/initializers/session_store.rb
# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data
# cd /opt/redmine
# rake config/initializers/session_store.rb
# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data
在执行最后一行命令时,会提示选择语言种类,输入 zh 回车即可,如果直接回车确则认默认为英文。
后边三条执行正确的话,效果如下:
[root@bogon redmine]# rake config/initializers/session_store.rb
(in /opt/redmine)
(in /opt/redmine)
[root@bogon redmine]# RAILS_ENV=production rake db:migrate
(in /opt/redmine)
[root@bogon redmine]# RAILS_ENV=production rake redmine:load_default_data
(in /opt/redmine)
Select language: bg, bs, ca, cs, da, de, el, en, en-GB, es, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh
====================================
Some configuration data is already loaded.
(in /opt/redmine)
[root@bogon redmine]# RAILS_ENV=production rake redmine:load_default_data
(in /opt/redmine)
Select language: bg, bs, ca, cs, da, de, el, en, en-GB, es, eu, fa, fi, fr, gl, he, hr, hu, id, it, ja, ko, lt, lv, mk, mn, nl, no, pl, pt, pt-BR, ro, ru, sk, sl, sr, sr-YU, sv, th, tr, uk, vi, zh, zh-TW [en] zh
====================================
Some configuration data is already loaded.
终于是装完了,接下来就得看看效果啦!
运行redmine
# cd /opt/redmine
# ruby script/server webrick -e production
出现如下效果时:
[root@bogon redmine]# ruby script/server webrick -e production
=> Booting WEBrick
=> Rails 2.3.11 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-11-06 19:03:58] INFO WEBrick 1.3.1
[2011-11-06 19:03:58] INFO ruby 1.8.7 (2008-05-31) [i686-linux]
[2011-11-06 19:03:58] INFO WEBrick::HTTPServer#start: pid=3231 port=3000
=> Booting WEBrick
=> Rails 2.3.11 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-11-06 19:03:58] INFO WEBrick 1.3.1
[2011-11-06 19:03:58] INFO ruby 1.8.7 (2008-05-31) [i686-linux]
[2011-11-06 19:03:58] INFO WEBrick::HTTPServer#start: pid=3231 port=3000
可以打开网页了,输入
http://localhost:3000/就可以啦!
然后就是使用缺省的帐号登录了
login:admin
password:admin
到此终于算是完事了,一声长叹啊!
在执行过程中如果出现如下问题的原因分析,解决方法,还有就是疑惑了:
1).
[root@bogon redmine]# RAILS_ENV=production rake db:migrate
(in /opt/redmine)
rake aborted!
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
(in /opt/redmine)
rake aborted!
Can't connect to local MySQL server through socket '/var/lib/mysql/mysql.sock' (2)
这个就是前边说过的数据库木有打开了,用前边的方法打开就ok了。
2).
在执行rake config/initializers/session_store.rb时,如果出现什么warmming:说什么什么过期,然后用什么什么代替什么什么,我记得好像是有个什么0.9.2.2啥的,这个就是那前边的一大准备活动中
rake的版本不能是0.9.2.2,必须得是0.8.x了,我这边是0.8.3。
这个我的解决办法是:直接先安装rake-0.8.3.gem,安装完毕后,再执行rake config/initializers/session_store.rb时,发现老问题还是照样出现,那就没办法,只能暴力点了。在
/usr/local/lib/ruby/gems/1.8/gems/下,将rake-0.8.3中的全部内容都copy到rake-0.9.2.2,当然,在此之前,rake-0.9.2.2中的东西都要清空了。这个也就是没有办法的办法吧,谁叫rake的时候他就只认rake-0.9.2.2呢。要是谁还有好的办法的话,告诉我一下吧。
3).
在配置redmine的数据库信息时,也就是在执行vim config/database.yml后,不是需要修改一些信息吗,这个地方我反正是出了好多问题,最后是,production密码项为空,我也不知道是为什么,明明在创建数据库用户的时候设置了密码的。
在这个过程中,参考了很多东西,如下是几个最全: