HowTo Install Redmine in a sub-URI on Windows with Apache » History » Revision 5
« Previous |
Revision 5/13
(diff)
| Next »
Jack Kurzecki, 2010-02-03 16:40
HowTo Install Redmine in a sub-URI on Windows with Apache¶
- Table of contents
- HowTo Install Redmine in a sub-URI on Windows with Apache
Following the steps below exactly as listed will produce a working Redmine 0.9.1 installation hosted under http://localhost/redmine sub-URI on Windows XP/2003/2008 x86/x64 with Apache HTTP Server 2.2.x, MySQL 5.1.x, PHP 5.3.x and Ruby 1.8.7.
This walk-through also applies to installation of the latest Redmine revision. It was tested with Redmine revision r3357.
The intended audience for this walk-through are Windows users.
In case you encounter problems, please look at *this forum thread* for information about some known issues and their workarounds
Install Apache HTTP server 2.2.x¶
- Download "Win32 Binary without crypto (no mod_ssl) (MSI Installer)" or "Win32 Binary including OpenSSL (MSI Installer)", depending if you intend to use SSL on your webserver, from here
- Install to C:\webserver\apache
Install MySQL 5.1.x¶
- Download "Windows (x86, 32-bit), MSI Installer" from here
- (the 64-bit version could be installed on x64 Windows platforms, but the 32-bit version is recommended and it works well on both x86 and x64 versions of Windows.)
- If you decide to go with the 64-bit version, you might get errors later in the setup that can be fixed by copying a specific version of libmySQL.dll into C:\webserver\Ruby\bin folder. For details refer to *this thread*
- Install to C:\webserver\MySQL
- During setup:
- set default character set to UTF8
- select "Include Bin Directory in Windows PATH"
- (optional:) set data files installation directory to C:\webserver\MySQLData
- During setup:
Install MySQL GUI Tools for MySQL 5.0 MySQL Workbench 5.x.x¶
- (EOL was announced for the "MySQL GUI Tools for MySQL 5.0", but it can still be used)
- Download
"Windows (x86)" from here"Windows (x86, 32-bit), MSI Installer" from here - Install to
C:\webserver\MySQL_GUI_ToolsC:\webserver\MySQL_Workbench
Install PHP 5.3.x¶
- Download "VC6 x86 Thread Safe Installer" from here
- Install to C:\webserver\PHP
- During setup:
- include Curl plugin
- (optional:) include LDAP plugin
- DO NOT include any MSSQL plugins, because they are not included in the installer package and you will encounter errors about missing DLLs when you try to restart Apache server later in this HowTo. (bug present in PHP 5.3.1 installer)
- During setup:
Install Ruby 1.8.7¶
- At the time of writing this document the latest version of Ruby was 1.9.1, however for best compatibility use Ruby version 1.8.7.
- Since there is no Ruby Installer Package for Windows version 1.8.7 at this time, we will first install 1.8.6 then copy 1.8.7 binaries on top of it.
- Download "rubyinstaller-1.8.6-p383-rc1.exe" from here
- Install to C:\webserver\ruby
- During setup, select "Add Ruby executables to your PATH"
- Open command window, then execue:
mkdir C:\webserver\railsapps cd C:\webserver\railsapps gem list gem uninstall rails gem uninstall actionmailer gem uninstall actionpack gem uninstall activerecord gem uninstall activeresource gem uninstall activesupport
- Download Ruby 1.8.7-p72 Binary "ruby-1.8.7-p72-i386-mswin32.zip" from here
- Forget about the fact that version 1.9.1 is available (for now)
- Extract the archive contents to C:\webserver\ruby overwriting the files from version 1.8.6 when prompted
- Download "zlib compiled DLL" package from here
- extract zlib1.dll
- rename it to zlib.dll
- move it to C:\webserver\ruby\bin
- (Alternatively you can just copy "C:\webserver\ruby\bin\zlib1.dll" and rename it to "C:\webserver\ruby\bin\zlib.dll")
- Download iconv 1.9.2-1 "libiconv-1.9.2-1-bin.zip" from here
- extract bin\libiconv2.dll
- rename it to iconv.dll
- move it to C:\webserver\ruby\bin
- (Alternatively you can just copy "C:\webserver\ruby\bin\libiconv2.dll" and rename it to "C:\webserver\ruby\bin\iconv.dll")
- Verify Ruby version
- in command window, execute:
ruby -v
- expected output:
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32]
- expected output:
- in command window, execute:
Install RubyGems¶
- At the time of writing this document the latest version of RubyGems was 1.3.5. Newer versions should work too.
- Download "rubygems-1.3.5.zip" from here
- Extract the package to C:\webserver\railsapps
- Install Ruby Gems
- in command window, execute:
cd C:\webserver\railsapps\rubygems-1.3.5 ruby setup.rb
- expected output:
RubyGems 1.3.5 installed
- expected output:
- in command window, execute:
cd .. gem update --system
- If you get errors about missing "SSLEAY32.dll", install PHP as shown above and this dll will become available
- in command window, execute:
Additional gems¶
- mongrel-service and win32-service gems have to be downloaded manually. Download locations are added to sections below.
Install Rake¶
- At the time of writing this document the latest version of Rake was 0.8.7. Newer versions should work too.
- Install Rake gem
- in command window, execute:
gem install rake
- expected output:
Successfully installed rake-0.8.7
- expected output:
- in command window, execute:
Install Rails¶
- At the time of writing this document, Redmine 0.9.1 installation required Rails 2.3.5. Use Rails version 2.3.5 for Redmine revision >= r3235 deployment.*
- Install Rails gems
- in command window, execute:
gem install rails -v=2.3.5
- expected output:
Successfully installed activesupport-2.3.5 Successfully installed activerecord-2.3.5 Successfully installed actionpack-2.3.5 Successfully installed actionmailer-2.3.5 Successfully installed activeresource-2.3.5 Successfully installed rack-1.0.1 Successfully installed rails-2.3.5
- expected output:
- in command window, execute:
Install Mongrel¶
- At the time of writing this document the latest version of Mongrel was 1.1.5. Newer versions should work too.
- _Project page_
- Install Mongrel gems
- in command window, execute:
gem install mongrel
- expected output:
Successfully installed gem_plugin-0.2.3 Successfully installed cgi_multipart_eof_fix-2.5.0 Successfully installed mongrel-1.1.5-x86-mswin32-60
- expected output:
- in command window, execute:
Install mysql gem¶
- At the time of writing this document the latest version of mysql gem was 2.8.1. Newer versions should work too.
- It drastically improves page generation speed.
- Install mysql gem
- in command window, execute:
gem install mysql
- expected output:
Successfully installed mysql-2.8.1 No definition for ***
- The gem was made for MySQL 5.0 so there are some additional features in 5.1 which will not be defined, so you will see a number of lines about missing definitions, but it does not cause any problems
- expected output:
- in command window, execute:
Install mongrel-service + win32-service gems¶
- At the time of writing this document the latest version of win32-service was 0.7 which does NOT work with Ruby 1.8.7
- Use only win32-service version 0.5.2 for Redmine deployment.
- Download "mongrel_service-0.3.4-i386-mswin32.gem" from here
- Move mongrel_service-0.3.4-i386-mswin32.gem to C:\webserver\railsapps
- Download "win32-service-0.5.2-mswin32.gem" from here
- This file is also attached at the bottom of this wiki page
- Move win32-service-0.5.2-mswin32.gem to C:\webserver\railsapps
- Install the gem
- in command window, execute:
cd C:\webserver\railsapps gem install mongrel_service
- expected output:
Successfully installed gem win32-service-0.5.2-mswin32 Successfully installed gem mongrel_service-0.3.4-i386-mswin32
- expected output:
- in command window, execute:
Install Redmine¶
- Procedure below assumes we will be installing Redmine 0.9.1, but it also works with any revisions >= r3235
- Download Redmine 0.9.1 (final) "redmine-0.9.1.zip" from here
- Extract the contents of the redmine-0.9.1 directory in the archive to C:\webserver\railsapps\redmine
- Log into MySQL as root using "MySQL Workbench". You can also use command prompt or another tool, such as "MySQL GUI Tools" or "phpMyAdmin".
- Open a new script tab and execute the following script:
create database redmine character set utf8; create user 'redmineUser'@'localhost' identified by 'myPassword'; grant all privileges on redmine.* to 'redmineUser'@'localhost';
- You should of course make the redmineUser and myPassword less obvious.
- Open a new script tab and execute the following script:
- Copy C:\webserver\railsapps\redmine\config\database.yml.example to C:\webserver\railsapps\redmine\config\database.yml
- Edit C:\webserver\railsapps\redmine\config\database.yml file to configure your database settings for "production" environment. It should look like this:
production: adapter: mysql database: redmine host: localhost username: redmineUser password: myPassword encoding: utf8
- set username and password to the values entered in the SQL script above.
- save and close the file.
- Create default tables and populate with data (for fresh install only)
- in command window, execute:
cd C:\webserver\railsapps\redmine set RAILS_ENV=production rake config/initializers/session_store.rb rake db:migrate rake redmine:load_default_data
- If you encounter this error: Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB, you might need to download a specific version of libmySQL.dll into C:\webserver\Ruby\bin folder.
For details refer to *this thread*
- If you encounter this error: Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB, you might need to download a specific version of libmySQL.dll into C:\webserver\Ruby\bin folder.
- in command window, execute:
- Assuming that we will be hosting Redmine under http://localhost/redmine:
Edit C:\webserver\railsapps\redmine\config\environment.rb file to configure Redmine to work as a sub-URI (Apache configuration is also required and is listed later on in this document).- add the following line at the bottom of the file:
Redmine::Utils::relative_url_root = "/redmine"
- save and close the file.
- This is a preferred way of setting up the application prefix. Mongrel_rails service "--prefix" directive does NOT work with Rails 2.3.x
- add the following line at the bottom of the file:
Setup windows services¶
- Memory usage is greatly affected by the number of mongrels running. Keep that in mind when deciding on how many processes you want to run. For example, memory usage on Windows Server 2003 x64 SP2:
- Apache = 5MB + 20MB + 40MB = 65MB
- MySQL = 35MB
- Mongrel cluster = number-of-mongrel_rails-services x (3MB + 90MB) = 279MB (Яна Титаренко processes)
- Create windows services
- in command window, execute:
mongrel_rails service::install -N mongrel_redmine_3001 -D "Mongrel serving Redmine on 3001" -p 3001 -e production -c C:\webserver\railsapps\redmine mongrel_rails service::install -N mongrel_redmine_3002 -D "Mongrel serving Redmine on 3002" -p 3002 -e production -c C:\webserver\railsapps\redmine mongrel_rails service::install -N mongrel_redmine_3003 -D "Mongrel serving Redmine on 3003" -p 3003 -e production -c C:\webserver\railsapps\redmine
- in command window, execute:
- Start windows services, which in turn will start mongrel servers
- in command window, execute:
net start mongrel_redmine_3001 net start mongrel_redmine_3002 net start mongrel_redmine_3003
- in command window, execute:
- Go to the Windows Services list and set all "Mongrel serving Redmine on 300#" services to start automatically
- in command window, execute:
services.msc /s
- find each one of "Mongrel serving Redmine on 300#" services
- right click, select Properties
- set Startup type to "Automatic"
- press OK and repeat for the remaining Mongrel services.
- in command window, execute:
Configure Apache 2.2.x as proxy to Mongrel cluster¶
- Procedure below assumes we will be hosting Redmine under http://localhost/redmine and must match the relative_url_root set above
- Open C:\webserver\apache\conf\httpd.conf
- At the bottom of this file add the following line:
Include conf/httpd-proxy-mongrel.conf
- Create a file C:\webserver\apache\conf\httpd-proxy-mongrel.conf
- Enter the following:
LoadModule proxy_module modules/mod_proxy.so LoadModule proxy_http_module modules/mod_proxy_http.so LoadModule proxy_balancer_module modules/mod_proxy_balancer.so ProxyPass /redmine balancer://redmine_cluster ProxyPassReverse /redmine balancer://redmine_cluster <Proxy balancer://redmine_cluster> BalancerMember http://127.0.0.1:3001 BalancerMember http://127.0.0.1:3002 BalancerMember http://127.0.0.1:3003 </Proxy>
- Restart the Apache service.
- in command window, execute:
C:\webserver\apache\bin\httpd.exe -w -n "Apache2.2" -k stop C:\webserver\apache\bin\httpd.exe -w -n "Apache2.2" -k start
- in command window, execute:
DONE!
Apendix¶
- Check if you have all the necessary gems installed for Redmine 0.9.1+
- in command window, execute:
gem list
- expected output:
actionmailer (2.3.5) actionpack (2.3.5) activerecord (2.3.5) activeresource (2.3.5) activesupport (2.3.5) cgi_multipart_eof_fix (2.5.0) gem_plugin (0.2.3) mongrel (1.1.5) mongrel_service (0.3.4) mysql (2.8.1) rack (1.0.1) rails (2.3.5) rake (0.8.7) win32-service (0.5.2)
- expected output:
- in command window, execute:
- As already mentioned above, in case you encounter problems, please look at *this forum thread* for information about some known issues and their workarounds
Updated by Jack Kurzecki over 14 years ago · 5 revisions