HowTo Install Redmine in a sub-URI on Windows with Apache » History » Revision 12
« Previous |
Revision 12/13
(diff)
| Next »
Etienne Massip, 2011-04-15 09:59
Removed RubyGem system update as current Redmine stable does not support RubyGems >= 1.5.0
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 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 was tested with Redmine 1.0.4.devel.4543 but should work with any version >= 0.8 .
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 - Essentials - Recommended" 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.)
- Install to C:\webserver\MySQL\
- During initial setup:
- (optional:) set data files installation directory to C:\webserver\MySQL_Data\
- During Server Instance Configuration Wizard:
- (optional:) Add firewall exception for the port used
- set default character set to "Best Support for Multilingualism" UTF8
- select "Include Bin Directory in Windows PATH"
- During initial setup:
Install MySQL Workbench 5.2.x¶
- Download "Windows (x86, 32-bit), MSI Installer" from here
- Install to C:\webserver\MySQL_Workbench\
Install PHP 5.3.x¶
- Download "VC6 x86 Thread Safe - Installer" from here
- Install to C:\webserver\PHP\
- During setup:
- for webserver, choose "Apache 2.2.x Module"
- configuration directory is "C:\webserver\Apache\conf\"
- you can leave all default Extensions as they are, optionally adding "Internationalization" and "Multi-Byte String"
- During setup:
Install Ruby 1.8.7 with RubyGems¶
- At the time of writing this document the latest version of Ruby was 1.9.2, however for best compatibility use Ruby version 1.8.7.
- Download "rubyinstaller-1.8.7-p302.exe" from here
- Install to C:\webserver\Ruby\
- During setup, select "Add Ruby executables to your PATH"
- Verify Ruby version
- Open command window, execute:
ruby -v
- expected output:
ruby 1.8.7 (2010-08-16 patchlevel 302) [i386-mingw32]
- expected output:
- Open command window, execute:
- Verify RubyGems version
- in command window, execute:
gem -v
- expected output:
1.3.7
- At the time of writing this document the latest version of RubyGems was 1.3.7. Versions >= 1.5.0 won't work with Redmine 1.1.x.
- expected output:
- in command window, execute:
- If you get errors about missing "SSLEAY32.dll", install PHP as shown above and this dll will become available
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, the latest version of Rails is 3.0.3, but Redmine 1.0.4 installation requires Rails 2.3.5.
- 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 rack-1.0.1 Successfully installed actionpack-2.3.5 Successfully installed actionmailer-2.3.5 Successfully installed activeresource-2.3.5 Successfully installed rails-2.3.5 7 gems installed
- expected output:
- in command window, execute:
Install i18n¶
- At the time of writing this document, the latest version of i18n is 0.5, but Redmine 1.0.4 installation requires i18n 0.4.2.
- Install i18n gem
- in command window, execute:
gem install -v=0.4.2 i18n
- expected output:
Successfully installed i18n-0.4.2 1 gem installed
- 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-mingw32 3 gems installed
- 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-x86-mingw32 1 gem installed Installing ri documentation for mysql-2.8.1-x86-mingw32... 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\
- 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\
- Install the gem
- in command window, execute:
cd C:\webserver\ gem install mongrel_service
- expected output:
Successfully installed win32-service-0.5.2-x86-mswin32 Successfully installed mongrel_service-0.3.4-x86-mswin32 2 gems installed
- expected output:
- in command window, execute:
- Delete the two .gem files from C:\webserver\
Install Redmine¶
- Procedure below assumes we will be installing Redmine 1.0.4, but it also works with any revisions >= r3235
- Download "redmine-1.0.4.zip" from here
- Extract the contents of the redmine-1.0.4 directory in the archive to C:\webserver\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 connection to Start Querying"
- In SQL Query window enter the following script:
create database redmine character set utf8; create user 'redmineUser'@'localhost' identified by 'myPassword'; grant all privileges on redmine.* to 'redmineUser'@'localhost';
- "Execute SQL Script in Connected Server"
- You should of course change redmineUser and myPassword to something different.
- Copy C:\webserver\Redmine\config\database.yml.example to C:\webserver\Redmine\config\database.yml
- Edit C:\webserver\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 (or update) Redmine database tables
- in command window, execute:
cd C:\webserver\Redmine set RAILS_ENV=production rake generate_session_store rake db:migrate
- If you encounter this error: Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB :
- download libmySQL.dll from here
- move this .dll file to C:\webserver\Ruby\bin\
- in command window, again execute:
rake db:migrate
- If you encounter this error: Mysql::Error: query: not connected: CREATE TABLE `schema_migrations` (`version` varchar(255) NOT NULL) ENGINE=InnoDB :
- in command window, execute:
- If this is a fresh install, you can pre-populate the tables with default data
- in command window, execute:
rake redmine:load_default_data
- in command window, execute:
- Assuming that we will be hosting Redmine under http://localhost/redmine
- Edit C:\webserver\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
- Optionally, you can add a following initializer, but ONLY IF you want to use "--prefix" in "Mongrel_rails service" command instead of changing "environment.rb":
- Create a file config/initializers/patch_for_mongrel.rb [name of file can be anything]:
# Fix for mongrel which still doesn't know about Rails 2.2's changes, # We provide a backwards compatible wrapper around the new # ActionController::base.relative_url_root, # so it can still be called off of the actually non-existing # AbstractRequest class. module ActionController class AbstractRequest < ActionController::Request def self.relative_url_root=(path) ActionController::Base.relative_url_root=(path) end def self.relative_url_root ActionController::Base.relative_url_root end end end # # Thanks to http://www.ruby-forum.com/topic/190287
- Create a file config/initializers/patch_for_mongrel.rb [name of file can be anything]:
- Optionally, you can add a following initializer, but ONLY IF you want to use "--prefix" in "Mongrel_rails service" command instead of changing "environment.rb":
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\Redmine mongrel_rails service::install -N mongrel_redmine_3002 -D "Mongrel serving Redmine on 3002" -p 3002 -e production -c C:\webserver\Redmine mongrel_rails service::install -N mongrel_redmine_3003 -D "Mongrel serving Redmine on 3003" -p 3003 -e production -c C:\webserver\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.
- Alternatively you can execute this command on elevated command prompt for each mongrel service installed:
sc config mongrel_redmine_3001 start= auto
- 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:
<IfModule !mod_proxy.c> LoadModule proxy_module modules/mod_proxy.so </IfModule> <IfModule !mod_proxy_http.c> LoadModule proxy_http_module modules/mod_proxy_http.so </IfModule> <IfModule !mod_proxy_balancer.c> LoadModule proxy_balancer_module modules/mod_proxy_balancer.so </IfModule> 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!
Your local installation of Redmine is now accessible at http://localhost/redmine
Additional components¶
Install RMagic¶
- Download "RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip" or a later version from here
- Extract "rmagick-2.12.0-x86-mswin32.gem" to C:\webserver\
- Install "ImageMagick-6.5.6-8-Q8-windows-dll.exe" to C:\webserver\ImageMagick
- Install the RMagic gem
- in command window, execute:
cd C:\webserver gem install rmagick --local
- expected output:
Successfully installed rmagick-2.12.0-x86-mswin32 1 gem installed
- expected output:
- in command window, execute:
- Delete the .gem file from C:\webserver\
- Reboot your server. (I was unsuccessful trying to get it to work without rebooting)
Add redmine_attach_screenshot plugin¶
- download source from here
- Extract the archive to C:\webserver\Redmine\vendor\plugins\redmine_attach_screenshot
- Restart the Mongrel cluster
- in command window, execute:
net stop mongrel_redmine_3001 net stop mongrel_redmine_3002 net stop mongrel_redmine_3003 net start mongrel_redmine_3001 net start mongrel_redmine_3002 net start mongrel_redmine_3003
- in command window, execute:
In case you encounter problems, please look at *this forum thread* for information about some known issues and their workarounds
Updated by Etienne Massip over 13 years ago · 12 revisions