版本历史:
[V0.9.2.20120102][更新,适用于redmine 1.3.0]
[V0.9.1.20111021][初始化安装,基于redmine 1.2.2]
操作系统: CentOS 5.7,更新至 20120102。
由于yum安装的ruby 是 1.8.5版本,但是 redmine 需要的 ruby 版本是 1.8.6 或者 1.8.7,所以如果系统安装了 ruby 相关的东东,建议先卸载。
我只安装了 ruby 和 rubygems ,可以按如下卸载(全部卸载可以用 ruby*,要注意卸载 ruby 会导致 yum 安装的 cacti 和 rrdtool被卸载)
sudo yum erase ruby rubygems
安装一些 ruby 要用到的基础依赖包:
sudo yum install -y gcc-c++ patch readline readline-devel zlib zlib-devel libyaml-devel libffi-devel \\
openssl-devel make bzip2 autoconf automake libtool bison iconv-devel
以方便我们编译安装 ruby。
1.安装ruby
在 ftp://ftp.ruby-lang.org/pub/ruby/ 下载 ruby 1.8.7-p352 版本。
编译安装
cd ruby-1.8.7.pXXX ./configure make sudo make install ruby -v
默认情况下,编译生成的 ruby 在 /usr/local/bin ,这个要特别注意,可能需要把 /usr/local加入到用户的PATH中。
2.安装rubygems
在 http://rubyforge.org/frs/?group_id=126&release_id=46340 上下载 rubygems 1.3.7 版本的安装包(这里要注意,千万不能使用最新的版本,比如 1.8.12,如果使用 1.8.12 那么在下面的步骤会报错)。
参考 http://rubygems.org/pages/download 进行安装,切换到 rubygems 目录执行
[gaohu@localhost rubygems-1.3.7]$ sudo ruby setup.rb
RubyGems 1.3.7 installed
...
RubyGems installed the following executables:
/usr/local/bin/gem
[gaohu@localhost rubygems-1.3.7]$
1.首先,要说的是,正常途径的
[gaohu@rzgh ~]$ sudo gem install rails -v=2.3.14
基本上会报错:
ERROR: http://gems.rubyforge.org/ does not appear to be a repository ERROR: could not find gem rails locally or in a repository
也尝试了增加 ruby的源,发现效果都不好,只能自己手工下载了。
据说地址被墙了,所以我们使用本地安装的方式来安装。
2.下载rails
在 http://rubygems.org/pages/download 下载 rails 的gem包(主要版本,一定要下载 2.3.14 版本的),同时递归下载依赖包,也要下载对应的版本。
(或者可以使用 Bundler 来处理,自行研究。)
大概会得到不少,都存到一个文件夹中。建议新建立一个文件夹 redmine,我们还有很多包要下载。
我大概下载了这些,才把 rails 装上(下面是所有安装完的包,这一步用不到这么多,就按照软件依赖下载就可以了)
[gaohu@rzgh redmine]$ ls actionmailer-2.3.14.gem activeresource-2.3.14.gem fastthread-1.0.7.gem mysql-2.8.1.gem rails-2.3.14.gem
rubygems-update-1.8.12.gem
actionpack-2.3.14.gem activesupport-2.3.14.gem fcgi-0.8.8.gem passenger-3.0.11.gem rake-0.8.7.gem
activerecord-2.3.14.gem daemon_controller-0.2.6.gem i18n-0.4.2.gem rack-1.1.1.gem
3.安装 rails
[gaohu@localhost redmine]$ sudo gem install --local rails-2.3.14.gem
Successfully installed rake-0.8.7
Successfully installed activesupport-2.3.14
Successfully installed activerecord-2.3.14
Successfully installed rack-1.1.1
Successfully installed actionpack-2.3.14
Successfully installed actionmailer-2.3.14
Successfully installed activeresource-2.3.14
Successfully installed rails-2.3.14
8 gems installed
Installing ri documentation for rake-0.8.7...
Installing ri documentation for activesupport-2.3.14...
Installing ri documentation for activerecord-2.3.14...
Installing ri documentation for rack-1.1.1...
Installing ri documentation for actionpack-2.3.14...
Installing ri documentation for actionmailer-2.3.14...
Installing ri documentation for activeresource-2.3.14...
Installing ri documentation for rails-2.3.14...
Installing RDoc documentation for rake-0.8.7...
Installing RDoc documentation for activesupport-2.3.14...
Installing RDoc documentation for activerecord-2.3.14...
Installing RDoc documentation for rack-1.1.1...
Installing RDoc documentation for actionpack-2.3.14...
Installing RDoc documentation for actionmailer-2.3.14...
Installing RDoc documentation for activeresource-2.3.14...
Installing RDoc documentation for rails-2.3.14...
[gaohu@rzgh redmine]$
(这一步列出的包,应该就是 rails的依赖了。)
rails 安装完成。
下载,rack 1.1.1版本的
[gaohu@localhost redmine]$ sudo gem install --local rack-1.1.1.gem Successfully installed rack-1.1.1 1 gem installed Installing ri documentation for rack-1.1.1... Installing RDoc documentation for rack-1.1.1... [gaohu@localhost redmine]$
我选择 mysql,还可以选择其他的数据库
下载 ruby 的 mysql gem,安装
[gaohu@rzgh redmine]$ sudo gem install --local mysql-2.8.1.gem Building native extensions. This could take a while... Successfully installed mysql-2.8.1 1 gem installed Installing ri documentation for mysql-2.8.1... No definition for next_result ... No definition for error_sqlstate [gaohu@rzgh redmine]$
报了一堆错,不知道有没有影响,等下看。
1.创建数据库
create database redmine character set utf8; create user 'redmine'@'localhost' identified by 'my_password'; grant all privileges on redmine.* to 'redmine'@'localhost';
2.下载 redmine 解压redmine 到 httpd 服务器文件夹位置,对于我的,
[gaohu@rzgh ~]$ cd /var/www/html [gaohu@rzgh html]$ sudo mv /home/gaohu/redmine-1.2.2 ./ [gaohu@rzgh html]$ sudo mv redmine-1.2.2/ redmine
3.编辑database.yml 文件
[gaohu@rzgh redmine]$ sudo cp config/database.yml.example config/database.yml [gaohu@rzgh redmine]$ sudo vi config/database.yml
调整生产数据库的数据库和密码:
production: adapter: mysql database: redmine host: localhost username: redmine password: my_password
这里密码前,一定要记得冒号后一个空格,否则 sudo RAILS_ENV=production rake db:migrate 会报错
[gaohu@rzgh redmine]$ sudo RAILS_ENV=production rake db:migrate NOTE: SourceIndex.new(hash) is deprecated; From /var/www/html/redmine/config/../vendor/rails/railties/lib/rails/vendor_gem_source_index.rb:100:in `new'. WARNING: 'require 'rake/rdoctask'' is deprecated. Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead. at /usr/local/lib/ruby/gems/1.8/gems/rake-0.9.2.2/lib/rake/rdoctask.rb WARNING: 'task :t, arg, :needs => [deps]' is deprecated. Please use 'task :t, [args] => [deps]' instead. at /var/www/html/redmine/lib/tasks/email.rake:170 rake aborted! syntax error on line 8, col 2: ` encoding: utf8' Tasks: TOP => db:migrate => environment (See full trace by running task with --trace)
4.生成会话存储
[gaohu@localhost redmine-1.3.0]$ sudo rake generate_session_store
(in /usr/local/share/redmine-1.3.0)
Please install RDoc 2.4.2+ to generate documentation.
开始安装 rdoc(这时建议一并把 i18n 0.4.2 给装上)。下载 rdoc及依赖
[gaohu@localhost redmine]$ sudo gem install --local rdoc-2.5.3.gem
Successfully installed rdoc-2.5.3
1 gem installed
Installing ri documentation for rdoc-2.5.3...
Installing RDoc documentation for rdoc-2.5.3...
[gaohu@localhost redmine]$ sudo gem install --local rdoc-data-2.5.3.gem
To install ri data for RDoc 2.5+ run:
rdoc-data
Successfully installed rdoc-data-2.5.3
1 gem installed
Installing ri documentation for rdoc-data-2.5.3...
Installing RDoc documentation for rdoc-data-2.5.3...
[gaohu@localhost redmine]$ sudo rdoc-data --install
重新执行
[gaohu@localhost redmine-1.3.0]$ sudo rake generate_session_store
(in /usr/local/share/redmine-1.3.0)
5.创建数据库结构,在 redmine 路径下执行
[gaohu@localhost redmine-1.3.0]$ sudo RAILS_ENV=production rake db:migrate
6.插入默认数据
[gaohu@localhost redmine-1.3.0]$ sudo RAILS_ENV=production rake redmine:load_default_data
(in /usr/local/share/redmine-1.3.0)
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]
====================================
Default configuration data loaded.
7.设置权限
[gaohu@localhost redmine-1.3.0]$ sudo mkdir tmp public/plugin_assets
mkdir: cannot create directory `tmp': File exists
mkdir: cannot create directory `public/plugin_assets': File exists
[gaohu@localhost redmine-1.3.0]$ sudo chown -R redmine:redmine files log tmp public/plugin_assets
chown: `redmine:redmine': invalid user
[gaohu@localhost redmine-1.3.0]$ sudo chown -R apache:apache files log tmp public/plugin_assets
[gaohu@localhost redmine-1.3.0]$ sudo chmod -R 755 files log tmp public/plugin_assets
8.通过 WEBrick web server 测试安装
[gaohu@localhost redmine-1.3.0]$ sudo ruby script/server webrick -e production
=> Booting WEBrick
=> Rails 2.3.14 application starting on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-01-03 00:16:50] INFO WEBrick 1.3.1
[2012-01-03 00:16:50] INFO ruby 1.8.7 (2011-12-28) [i686-linux]
[2012-01-03 00:16:55] INFO WEBrick::HTTPServer#start: pid=18704 port=3000
访问服务器 http://localhost:3000 端口测试。
9.Use default administrator account to log in:
You can go to Admin & Settings
to modify application settings.
《待补充》
http://www.redmine.org/projects/redmine/wiki/RedmineInstall
1.如果使用了高版本的 rubygems(比如 1.8.12),那么执行如下命令时会报错
.[gaohu@localhost redmine-1.3.0]$ sudo rake generate_session_store
(in /usr/local/share/redmine-1.3.0)
NOTE: Gem.source_index is deprecated, use Specification. It will be removed on or after 2011-11-01.
Gem.source_index called from /usr/local/share/redmine-1.3.0/config/../vendor/rails/railties/lib/rails/gem_dependency.rb:21.
rake aborted!
uninitialized constant Gem::SyckDefaultKey
/usr/local/share/redmine-1.3.0/Rakefile:4
(See full trace by running task with --trace)
解决办法:降级,可以降级到 1.3.7版本。
参考:http://www.redmine.org/boards/2/topics/27792
http://www.redmine.org/boards/2/topics/27928
2
3
4