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:
- Install MySql
- Create a Redmine database + user
- Install Ruby 1.8.6
- Include the Ruby bin directory in your PATH environment variable
- Install Rubygems
- Install Rails
- Install Mongrel
- Install Mongrel Service
- Check out Redmine’s source code
- Configure Redmine
- Create the database schema
- Start Mongrel and verify that the installation works
- Install Mongrel/Redmine as a Windows Service
- 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):
mysql -uUSER -pPASSWORD
where USER might be
root and PASSWORD is probably some secret cool password you made up during the installation of MySql.
CREATE DATABASE redmine;
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:
create user 'redmine_account'@'localhost' identified by 'very_secret'; grant all on redmine.* to 'redmine_account'@'localhost';
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:
gem install rails -v 2.1.2 --include-dependencies
-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:
gem install mongrel --include-dependencies
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:
gem install mongrel_service --include-dependencies
UPDATE April 4th 2010: When re-installing Redmine on a Windows 7 server today, I got this cryptic error message:
Building native extensions. This could take a while... ERROR: Error installing mongrel-service: ERROR: Failed to build gem native extension. C:/Ruby/bin/ruby.exe extconf.rb checking for RegisterServiceCtrlHandlerEx()... no creating Makefile make 'make' is not recognized as an internal or external command, operable program or batch file.
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:
gem install mongrel_service --include-dependencies --platform=mswin32
- which worked I have no idea why the platform parameter is suddenly required to install successfully on a Windows box.
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:
mongrel_rails start -p 4000 -e production
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:
mongrel_rails service::install -N redmine_service -p 4000 -e production
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”.