在安装之前,确认linux已经安装了gcc编译器
检查方法:gcc –v
 
1、安装ruby-1.8.7
tar -xzf ruby-1.8.7-p352.tar.gz
cd ruby-1.8.7-p352
./configure --prefix=/usr/local/ruby-1.8.7
make && make install
查看ruby是否安装成功
#/usr/local/ruby-1.8.7/bin/ruby -v
ruby 1.8.7 (2011-06-30 patchlevel 352) [i686-linux]
ruby安装好之后,修改操作系统PATH的路径
PATH=/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/root/bin:/usr/local/ruby-1.8.7/bin
 
2、安装ruby on rails
在安装rails之前,要先安装rubygems。rubygems是ruby的在线包管理工具
tar -xzf rubygems-1.4.2.tgz
cd rubygems-1.4.2
ruby setup.rb
查看rubygems是否安装成功
gem –v
 
#gem install bundler
Fetching: bundler-1.0.22.gem (100%)
Successfully installed bundler-1.0.22
1 gem installed
Installing ri documentation for bundler-1.0.22...
Installing RDoc documentation for bundler-1.0.22...
 
gem install mysql
Fetching: mysql-2.8.1.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.
/usr/local/ruby-1.8.7/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lm... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lz... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lsocket... no
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lnsl... yes
checking for mysql_query() in -lmysqlclient... no
checking for main() in -lmygcc... no
checking for mysql_query() in -lmysqlclient... no
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.
Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/usr/local/ruby-1.8.7/bin/ruby
        --with-mysql-config
        --without-mysql-config
        --with-mysql-dir
        --without-mysql-dir
        --with-mysql-include
        --without-mysql-include=${mysql-dir}/include
        --with-mysql-lib
        --without-mysql-lib=${mysql-dir}/lib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mlib
        --without-mlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-zlib
        --without-zlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-socketlib
        --without-socketlib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-nsllib
        --without-nsllib
        --with-mysqlclientlib
        --without-mysqlclientlib
        --with-mygcclib
        --without-mygcclib
        --with-mysqlclientlib
        --without-mysqlclientlib
Gem files will remain installed in /usr/local/ruby-1.8.7/lib/ruby/gems/1.8/gems/mysql-2.8.1 for inspection.
Results logged to /usr/local/ruby-1.8.7/lib/ruby/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out
缺少了mysql的客户端,安装之后再重新安装mysql
yum install libxslt-devel
yum install mysql-devel
yum install mysql
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...
 
#gem install rails -v=2.3.5
ERROR:  Loading command: install (LoadError)
    no such file to load -- zlib
ERROR:  While executing gem ... (NameError)
    uninitialized constant Gem::Commands::InstallCommand
提示找不到zlib
安装zlib,再重新加载zlib到ruby
tar -xzf zlib-1.2.6.tar.gz
cd zlib-1.2.6
./configure
make && make install
cd ruby-1.8.7-p352/ext/zlib/
ruby extconf.rb
make && make install
安装好zlib,继续安装rails   
#gem install -v=2.3.5 rails
Fetching: rake-0.9.2.2.gem (100%)
Fetching: activesupport-2.3.5.gem (100%)
Fetching: activerecord-2.3.5.gem (100%)
Fetching: rack-1.0.1.gem (100%)
Fetching: actionpack-2.3.5.gem (100%)
Fetching: actionmailer-2.3.5.gem (100%)
Fetching: activeresource-2.3.5.gem (100%)
Fetching: rails-2.3.5.gem (100%)
Successfully installed rake-0.9.2.2
Successfully installed activesupport-2.3.5
Successfully installed activerecord-2.3.5
Successfully installed rack-1.0.1
Successfully installed actionpack-2.3.5
Successfully installed actionmailer-2.3.5
Successfully installed activeresource-2.3.5
Successfully installed rails-2.3.5
8 gems installed
Installing ri documentation for rake-0.9.2.2...
Installing ri documentation for activesupport-2.3.5...
Installing ri documentation for activerecord-2.3.5...
Installing ri documentation for rack-1.0.1...
Installing ri documentation for actionpack-2.3.5...
Installing ri documentation for actionmailer-2.3.5...
Installing ri documentation for activeresource-2.3.5...
Installing ri documentation for rails-2.3.5...
Installing RDoc documentation for rake-0.9.2.2...
Installing RDoc documentation for activesupport-2.3.5...
Installing RDoc documentation for activerecord-2.3.5...
Installing RDoc documentation for rack-1.0.1...
Installing RDoc documentation for actionpack-2.3.5...
Installing RDoc documentation for actionmailer-2.3.5...
Installing RDoc documentation for activeresource-2.3.5...
Installing RDoc documentation for rails-2.3.5...   
 
3、安装rake
gem install rack -v 1.0.1
 
4、安装redmine
tar -xzf redmine-1.1.1.tar.gz
cd /usr/local/redmine/config
cp database.yml.example database.yml
 
安装mysql,创建数据库,授权
create database redmine default character set utf8;
grant all on redmine.* to root;
grant all on redmine.* to root@localhost;
 
cd /usr/local/redmine-1.1.1/config
创建表
rake db:migrate RAILS_ENV="production"
出现如下错误:
rake aborted!
no such file to load -- openssl
这是缺少了openssl
解决方法:安装openssl,再重新加载到ruby
进入ruby源码目录
cd ext/openssl
ruby ./extconf.rb
make && make install
安装好openssl之后,继续创建表
#rake db:migrate RAILS_ENV="production"
WARNING: 'require 'rake/rdoctask'' is deprecated.  Please use 'require 'rdoc/task' (in RDoc 2.4.2+)' instead.
    at /usr/local/ruby-1.8.7/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 /usr/local/redmine-1.1.1/lib/tasks/email.rake:170
Tasks: TOP => db:migrate => environment
(See full trace by running task with --trace)
这是因为rake的版本太高了,把rake的版本卸载后,再重新安装
gem list rake #查看rake的版本,如果rake的版本高于0.8.7,那么需要卸载了重新安装
gem uninstall rake -v=0.9.2.2
gem list rake
gem install rake -v=0.8.7
安装好了0.8.7版本的rake之后,重新创建表
rake db:migrate RAILS_ENV="production"
加载默认配置
rake redmine:load_default_data RAILS_ENV="production"
会提示语言选择,选择zh
 
到这里,redmine已经安装好了,启动服务
ruby /usr/local/redmine-1.1.1/script/server webrick -e production
访问http://server-ip:3000/,默认是用3000端口,也可以修改,用-p port
初始用户名/密码:admin/admin
登录进去之后,在My account里面,修改语言为“简体中文”
可以自行修改各种配置,例如添加用户,设置管理账号的密码等
采用上面的启动命令启动,按ctrl+c,或者关闭会话窗口,服务就会一起关闭
可以把redmine放到后台作为服务执行,启用命令
ruby /usr/local/redmine-1.1.1/script/server webrick -e production –d
停止ruby:
ps aux | grep ruby
kill –9 pid