2010-02-12

Installing Redmine on Windows

Installation Procedure

Redmine, which is one of the most promising collaboration software including wiki, issue tracking, forum and etc., is based on Ruby. When you install it, you need some packages for ruby and use commands in ruby's world. So, for those who have no experience on Ruby, the installation guide at Redmine's homepage is not enough.

To install Redmine on windows, you should work the following steps. I intalled Redmine 0.9.2 with them. Redmine, as of 0.9.2, supports MySQL 4.1+, PostgreSQL 8 and SQLite 3. MySQL is supposed in the followings. You can easily apply the steps for database for PostgreSQL and SQLite.

  1. Install Ruby using Ruby installer.
  2. Adjust RubyGems.
  3. Install Rake.
  4. Install Rails.
  5. Install internationalization package.
  6. Install MySQL API module for Ruby.
  7. Download and extract Redmine binaries.
  8. Create user and database for Redmine in MySQL.
  9. Setup database configuration of Redmine.
  10. Generate a session store secret.
  11. Update PATH variable of Windows.
  12. Build database schema.
  13. Build default configuration data into the database.
  14. Test the installation.
Install Ruby using Ruby installer.

You can find Ruby Installer for Windows in the following location. : http://rubyinstaller.org/
Ruby Installer is .exe file which make it easy to installing Ruby on windows. It includes RubyGems which is packaging tool for Ruby based applications.
From 0.8.x to 1.1.x of Redmine, Ruby 1.8.6 or 1.8.7 is necessary and 1.9.x is not supported.
After you install Ruby using Ruby Installer, you can find ruby.exe and gem.bat in the bin directory under the Ruby's home.
Ruby Installer will add the bin directory (eg. c:\ruby\bin) to PATH variable of your windows.

You need to install several packages before installing redmine. Those includes rake, rails, and rack. According to the version of the Redmine for you to install, each package has limitation for its version. For this, refer to the official installation guide of Redmine.

During installation, you can identify the packages installed in your machine using the following command.


c:\ruby\bin>gem list -l

It seems to be no problem to install different versions of the same package at the same machine. Applications or packages of ruby seem to be able to find proper version among more than one versions of the necessary package in the machine.

Adjust RubyGems.

You should use RubyGems 1.4.2 or less to install Redmine 1.1.2 correctly. Using RubyGems 1.5.2 with Redmine 1.1.2 would fail when building database schema.

The RubyGems would be installed with Ruby. The version of RubyGems can be identified like this.

c:\ruby\bin>gem -v

If the installed version of the RubyGems is higher than the one required by Redmine, you can downgrade the RubyGems using commands like following.

c:\ruby\bin>gem -v
1.5.2
c:\ruby\bin>gem install rubygems-update -r -v=1.4.2
...
c:\ruby\bin>update_rubygems
...
c:\ruby\bin>gem -v
1.4.2
Install Rake.

Rake is build tool for Ruby. It's like make for Unix or Ant for Java.
You can install Rake using RubyGems's remote installation without manually downloading binaries to your local computer.

c:\ruby\bin>gem install rake -r

Actually, you can run gem.bat in any directory, 'cause Ruby Installer will add the bin directory to the PATH variable.
In the above sample command, -r option means remote installation where the RubyGems would download the wanted packages from the remote site.

Install Rails.

Rails is that famous application framework for Ruby. It is also called Ruby on Rails or RoR.

Redmine 1.1.x requires Rails 2.3.5, so, you have to specify the version of the Rails to install with -v option.

c:\ruby\bin>gem install rails -r -v=2.3.5

Note that the RubyGems also install Rack 1.0.1 during installing Rails 2.3.5. Rack is a web server interface of the ruby for ruby frameworks.

Install internationalization package.

Redmine 1.1.2 with MySQL 5.0 needs 0.4.2 not higher version of i18n package.


c:\ruby\bin>gem install i18n -r -v=0.4.2
Install MySQL API module for Ruby.

First make query for available mysql package. The following command will show the latest version of mysql.

c:\ruby\bin>gem list mysql -r

There may be different mysql packages not only by version but also by platform. If so, you should specify the platform using --platform option.

c:\ruby\bin>gem install mysql -r -v 2.8.1 --platform x86-mswin32
Download and extract Redmine binaries.

You can get Redmine in zip format from here.
You can just extract it any directory you like such as c:\appls\redmine.

Create user and database for Redmine in MySQL.

If you don't have MySQL already, install and setup MySQL 5.0.
You should create a database for Redmine, create a user and then grant proper privilege to the user. You can use the following SQL statements after logging-in as an administrator

create database redmine character set utf8;
create user 'redmine'@'localhost' identified by 'passwordforredmine';
grant all privileges on redmine.* to 'redmine'@'localhost';
Setup database configuration of Redmine.

For this, refer official installation guide of Redmine

Generate a session store secret.

If you don't have session_store.rb in config\initializers\ directory under Redmine home directory (eg. c:\appls\redmine\), you should generate it first.
You should run Rake at Redmine home directory.

c:\appls\redmine>rake generate_session_store

And now, you can generate secret.

C:\appls\redmine>rake config/initializers/session_store.rb RAILS_ENV=production
Update PATH variable of Windows.

Ruby's mysql pacakge needs libmysql.dll at runtime. Previously the dll was included in Ruby installer but at some time, it became excluded.
Originally, libmysql.dll is located in the bin directory of MySQL installation.
So, you need to update PATH variable of your Windows to include MySQL's bin directory.

Build database schema.

You should run your MySQL first. And then, use the following Rake command at Redmine home directory.

C:\appls\redmine>rake db:migrate RAILS_ENV=production
Build default configuration data into the database.

While still your MySQL is running,

C:\appls\redmine>rake redmine:load_default_data RAILS_ENV=production
Test the installation.

While still MySQL is running, start your Redmine.

C:\appls\redmine>ruby script/server webrick -e production

Access the login page : http://localhost:3000/login
Try to login built-in default account : admin:admin

References

7 comments:

Sergio said...

Just wanted to point out that you MUST have MySQL 5.0, any other more recent version and step 1.9 will fail with a "segmentation fault" error.

midobouz said...

thanks you!!!

Thilina.Madush said...

Hello all,
This is a really good guide. It's really easy to understand.

I followed all steps mentioned above. but I got a problem in stemp 1.12. here I will include my trace. please let me know the error that I have done.
Sorry for my poor English


(in D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0)
** Invoke db:migrate (first_time)
** Invoke environment (first_time)
** Execute environment
rake aborted!
RubyGem version error: rack(1.2.3 not ~> 1.1.0)
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks'
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:134:in `process'
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:113:in `send'
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/config/../vendor/rails/railties/lib/initializer.rb:113:in `run'
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/config/environment.rb:20
D:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `gem_original_require'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:29:in `require'
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
D:/Assignments/RedMine/redmine-1.2.0/redmine-

Thilina.Madush said...

Here is the rest of the trace: Thilina

1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:547:in `new_constants_in'
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/vendor/rails/activesupport/lib/active_support/dependencies.rb:182:in `require'
D:/Assignments/RedMine/redmine-1.2.0/redmine-1.2.0/vendor/rails/railties/lib/tasks/misc.rake:4
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `call'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:636:in `execute'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `each'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:631:in `execute'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:597:in `invoke_with_call_chain'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:607:in `invoke_prerequisites'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `each'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:604:in `invoke_prerequisites'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:596:in `invoke_with_call_chain'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/1.8/monitor.rb:242:in `synchronize'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:590:in `invoke_with_call_chain'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:583:in `invoke'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2051:in `invoke_task'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `each'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2029:in `top_level'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2023:in `top_level'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2001:in `run'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:2068:in `standard_exception_handling'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/lib/rake.rb:1998:in `run'
D:/RailsInstaller/Ruby1.8.7/lib/ruby/gems/1.8/gems/rake-0.8.7/bin/rake:31
D:/RailsInstaller/Ruby1.8.7/bin/rake:19:in `load'
D:/RailsInstaller/Ruby1.8.7/bin/rake:19

prolix said...

Hello!!.... This post is likeable, and your blog is very interesting, congratulations.

Window Installation Melbourne

Anonymous said...

this error is due to your wrong version of rack installed...
Please reinstall the 1.1.1 version of rack. and then try again...
it will solve your problem..

Window cleaning adelaide said...

Appreicate your thoughts, Im not always in agreement, but you do cause a peron to think keep blogging!carpet cleaning adelaide

Post a Comment