how to get Redmine running on a Windows Server 2008 R2 are really really old and with the support for Ruby 1.9.3
Redmine installed on:
-Windows Server 2008 R2 x64
-MySQL Community server 5.5.27 64bit
-Apache 2.4.2 from Apachelounge
-Ruby 1.9.3 RubyInstaller
Installing the prequisites:
1. go to http://www.mysql.com/downloads/mysql/ and download the latest version of MySQL. Using a 64bit installation is fine. I will assume you know how to install MySQL so that you can make local connections to it.
2. go to http://www.apachelounge.com/ and download Apache. The reason I use the files from this site is that they compile Apache using VC9 instead of VC6 that the official downloads are built with. This gives some performance increase and stability when using a modern OS like Windows 7 or Windows Server 2008 R2.
For PHP 5.4 you need to download the handler module for apache 2.4 from the same page (php5apache2_4.dll-php-5.4-win32.zip) because PHP only provides the handle module up to apache 2.3 at the time of writing this text. Once downloaded
While there are also 64bit binaries now available for Apache from Apachelounge many Apache modules are still available only for 32bit versions so I have not yet found a working set of modules for 64bit Apache.
If you dont want to use PHP and PHPMyAdmin on your server you can skip steps 3 and 4.
3. go to http://windows.php.net/download/ and download a version of PHP that you have a working handler module for from the previous step! If the version on the download page is newer than there is a module handler you can find all previous versions of PHP by scrolling down and there is a box labeled “Archive” in the left side where you can find a link to the old versions.
4. go to http://www.phpmyadmin.net/home_page/index.php and download and install PHPMyAdmin. You can also use MySQL Workbench or any other way to manage your databases. Create a new database for your upcoming redmine and create a user for it. Remember the password for the redmine configs.
5. go to http://rubyinstaller.org/downloads/ and download Ruby 1.9.3 p194 installer . Install Ruby using the installer and rememer to “Add Ruby executables to your PATH”. but the Development kit is just a self extracting archive and where ever you point it thats where it will be “installed”. After installing the development kit add the path to the <devkit>\bin and <devkit>\mingw\bin to your system PATH. Also note that the installer probably added the Ruby path to just your user so adding it to the system path will help you to avoid some issues when running the files with different users like SYSTEM etc.
(To view your system path settings: Control Panel -> System -> Advanced system settings -> Environment Variables -button. Upper box is user settings and lower box is whole system settings.)
Setting up Redmine and Ruby:
1. Download Redmine and unpack it. Copy the files to a desired installation location. For this tutorial I will assume that “C:\Webserver\Redmine” is our desired installation location.
2. Navigate to the root of your Redmine and create a file called: “Gemfile.local”. Open up this file and enter the following into it:
# Gemfile.local gem "eventmachine", "~> 1.0.0.rc.4" gem "thin"
3. open up a command prompt and verify that your ruby path is working by doing:
And it should print out your ruby version (1.9.3 p194 when writing this tutorial).
4. install bundle as required by RedmineInstall instructions and then install all the gems with bundle. If you want to install RMagick check HowTo_Install_Redmine_in_a_sub-URI_on_Windows_with_Apache otherwise use:
bundle install --without development test rmagick
to install all the needed gems. Json seemed to require the Ruby Development Kit installed so that is why we installed it earlier.
5. before you go to creating the database things in step 5 of the RedmineInstall you need to include the MySQL Connector for MySQL2 gem. If you get an error later on saying to install “activerecord-mysql2-adapter” do NOT install it since it will cause other things to break. The error simply means that the connector you are trying to use does not work. I found a working connector from http://dev.mysql.com/downloads/connector/c/ and I used the mysql-connector-c-noinstall-6.0.2-win32.zip version. Download the .zip file since you only need to copy libmysql.dll inside the lib folder in that .zip file to your Ruby bin folder.
6. Finish following RedmineInstall. Note that in the part where it says
RAILS_ENV=production rake db:migrate
on windows this will not work. Use:
set RAILS_ENV=production rake db:migrate . .
Setting up Thin as a Windows service and configuring Apache
If you understand what you are doing there is no danger.
1. in the command prompt navigate into your Redmine root folder and test that Thin works:
thin start -e production -p 3000
and after it displays that its listening use your webbrowser to navigate to your Redmine installation. Make sure that there are no firewalls etc blocking your connections. Once you have confirmed its working shut it down.
2. go to http://www.microsoft.com/en-us/download/details.aspx?id=17657 and download and install the Windows Server 2003 Resource kit. There is no kit for Server 2008 but you dont have to necessarily install the kit to your server. You can install it on your local Windows 7 machine or just unpack the .exe and .msi with 7zip and copy from the pack to your server. Some people suggest copying srvany.exe to C:\Windows\system32 but I personally make a copy to each folder where the program I want to run as service is. So in this case I would copy srvany.exe into the Ruby\bin folder because that is where ruby.exe is located in. (As a fun fact you can use srvany.exe to make a windows service of pretty much any software you use.)
3. open a new command prompt but this time . Use the following commandline to install srvany.exe as a Windows Service:
SC create MyService binPath= "C:\path to\srvany.exe" DisplayName= "My Custom Service"
Naturally replace MyService with the name you want the service to have in the windows registry (we will need that information in the next step) and Displayname is the one displayed on the Windows Services list. If the creation of the service went okay you should see something like “SC create SUCCESS”. If you messed something up use:
SC delete MyService
to remove the service.
4. Launch RegEdit and navigate to
In that list you should find the service you created with the name you used for MyService. Create a new KEY called “Parameters” and add the following strings with the corresponding data:
STRING: AppDirectory DATA: path to your Redmine root folder for example: C:\Webserver\Redmine
STRING: Application DATA: path to your Ruby.exe for example: C:\Webserver\Ruby193\bin\ruby.exe
STRING: AppParameters DATA: Thin startup settings and path for example: C:\Webserver\Ruby193\bin\thin start -e production -p 3001
Now you should have a working Windows Service setup with Thin and if you go to “Control Panel -> Administrative Tools -> Services” you should find your newly created service in the list. Start it up and use a browser to test Thin works and browse to the port you selected with the -p switch and you should have a working Redmine setup there. If you edit the service from the Services list you can change the startup to be “Automatic” instead of “Manual” and your service will start automatically when Windows starts. But since no-one wants to usehttp://www.example.com:3001/ to use your Redmine in the next part we will configure Apache to redirect traffic so that you can use http://www.example.com as your Redmine address.
5. Edit your Apache httpd.conf and enable the following modules
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so LoadModule proxy_http_module modules/mod_proxy_http.so
Please note that without proper configuration that I will not go through here your server might become an open proxy by enabling these modules. Refer to Apache 2.4 documentation on how to make your server NOT act like an open proxy.
I use vhosts to enable our Redmine installation so make sure that
is not commented out.
6. Here is an example conf/extra/httpd-vhosts.conf
<VirtualHost *:80> ServerAdmin email@example.com ServerName example.com ServerAlias www.example.com DocumentRoot "c:/Webserver/Redmine/public" <Directory "C:/Webserver/Redmine/public"> Require all granted Options -MultiViews </Directory> ProxyPass / balancer://redmine_cluster/ ProxyPassReverse / balancer://redmine_cluster/ ProxyPreserveHost On <Proxy balancer://redmine_cluster> BalancerMember http://127.0.0.1:3001 </Proxy> ErrorLog "|C:/Webserver/Apache/bin/rotatelogs.exe logs/example.com/%Y.%m.%d.example.com.error.log 86400" CustomLog "|C:/Webserver/Apache/bin/rotatelogs.exe logs/example.com/%Y.%m.%d.example.com.access.log 86400" combined </VirtualHost> (from redmind.com)