Task and issue tracking with Redmine on a Windows server

If you are in need of nifty and free task and issue tracking system, you could check out Redmine! It’s really cool, and it is easy to install (especially if your Windows box already has a Ruby development environment installed).

This post will show how Redmine can be installed as a Windows service on your Windows server. You will need to go through the following steps if you have a clean Windows machine, and you have not yet fiddled with Ruby on it:

  1. Install MySql
  2. Create a Redmine database + user
  3. Install Ruby 1.8.6
  4. Include the Ruby bin directory in your PATH environment variable
  5. Install Rubygems
  6. Install Rails
  7. Install Mongrel
  8. Install Mongrel Service
  9. Check out Redmine’s source code
  10. Configure Redmine
  11. Create the database schema
  12. Start Mongrel and verify that the installation works
  13. Install Mongrel/Redmine as a Windows Service
  14. Make the service run automatically when Windows boots

So… let’s do this!

1. Install MySql

Redmine needs a database. I use MySql for this. Go to http://dev.mysql.com/downloads/ and download and install the community server edition.

2. Create a Redmine database + user

Fire up a command prompt and enter (assuming that MySql is installed locally, running on the default port):

where USER might be root and PASSWORD is probably some secret cool password you made up during the installation of MySql.

Then, type

to create a new database for Redmine. Verify that it’s there by doing this:

Then, to create a new user for Redmine to use, and to grant full access to the database, do this:

3. Install Ruby 1.8.6

In Ruby land, 1.8.6 is still being used in many production environments around the world, even though Ruby 1.9 is well on its way. To install it, go to http://www.ruby-lang.org/en/downloads/ and choose the One-Click installer.

If you download the binaries instead, you will manually need to download a few missing dlls: zlib.dll, ssleay32.dll, iconv.dll and possibly more. Not too hard, but it’s definitely easier to use the One-Click installer.

4. Include the Ruby bin directory in your PATH environment variable

Not too hard – just do it! Mine says blablabla;c:\ruby-1.8.6\bin (not literally, though).

5. Install Rubygems

If you are unfamiliar with Ruby, I can inform you that Rubygems is the de facto standard package manager. Grab it from the downloads section of http://rubygems.org/, and put it somewhere on your computer. Then, open a command prompt in that directory and issue a

which will install gem.bat in your Ruby bin directory.

6. Install Rails

Redmine is built on the Rails frame work, so Rails must be installed for Redmine to work. Easy! Do it like this:

The -v 2.1.2 stuff is because my current version of Redmine required Rails 2.1.2. If your Redmine installation refuses to start up because it requires another version if Rails, it should be easy to install that version inspired by the command above.

7. Install Mongrel

Mongrel is a fast web server made in Ruby. Install it like this:

8. Install Mongrel Service

Mongrel Service is a Win32-specific thing, that allows Mongrel to be started via a Windows Service. Install it like this:

UPDATE April 4th 2010: When re-installing Redmine on a Windows 7 server today, I got this cryptic error message:

I Googled for a while before I thought about what Rubygems was trying to accomplish… It seemed like it was trying to run make on my Windows box, which is usually pretty hard… so I tried adding the platform parameter like so:

– which worked 🙂 I have no idea why the platform parameter is suddenly required to install successfully on a Windows box.
</update>

9. Check out Redmine’s source code

Look for instructions on how to obtain Redmine here. I have checked out the trunk on my computer – that makes it very easy to upgrade Remine whenever I feel like it.

10. Configure Redmine

Rails apps are easily configured by editing the files contained within the config folder of the Rails application. To configure Redmine to use your database when started in production mode, copy the database.yml.example file and call it database.yml. Edit the production section and supply the database name and user credentials you created in your MySql database.

11. Create the database schema

Rails applications have built-in database migration scripts. You can issue a full up to the current version by going to Redmine’s base directory in the command prompt and issue a

12. Start Mongrel and verify that the installation works

Open a command prompt in your Redmine app’s base directory and issue a:

to start Redmine on port 4000 in the production configuration.

Now you should be able to navigate to http://localhost:4000 and see Redmine running.

13. Install Mongrel/Redmine as a Windows Service

Open a command prompt as administrator (right click the command prompt shortcut and select “Run as administrator”) and navigate to your Redmine app’s base directory and issue a:

14. Make the service run automatically when Windows boots

Go to the service manager in Windows ( services.msc) and double-click your service to change the startup type to “Automatic”.