Project

General

Profile

HowTo Install Redmine in a sub-URI on Windows with Apache » History » Revision 9

Revision 8 (Tiemo Vorschuetz, 2010-07-29 15:56) → Revision 9/13 (Jack Kurzecki, 2010-08-09 05:30)

h1. HowTo Install Redmine in a sub-URI on Windows with Apache 

 {{>toc}} 

 bq. Following the steps below exactly as listed will produce a working *Redmine* *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 1.0.0.devel.3919* but should work with any version >= 0.8 . revision r3357*. 
 The intended audience for this walk-through are Windows users. 

 +In case you encounter problems, please look at "*this forum thread*":http://www.redmine.org/boards/1/topics/10162 for information about some known issues and their workarounds+ 

 h2. 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":http://httpd.apache.org/download.cgi 
 # Install to *C:\webserver\Apache\* *C:\webserver\apache* 

 h2. Install MySQL 5.1.x 

 # Download *"Windows (x86, 32-bit), MSI Installer - Essentials - Recommended"* Installer"* from "here":http://dev.mysql.com/downloads/mysql/5.1.html#win32 
 #* _(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*_":http://www.redmine.org/boards/1/topics/10162 
 # Install to *C:\webserver\MySQL\* *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" 
 #*# (_optional:_) set data files installation directory to *C:\webserver\MySQLData* 

 h2. Install -MySQL GUI Tools for MySQL 5.0- MySQL Workbench 5.2.x 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":http://dev.mysql.com/downloads/gui-tools/5.0.html- *"Windows (x86, 32-bit), MSI Installer"* from "here":http://dev.mysql.com/downloads/workbench/ 
 # Install to *C:\webserver\MySQL_Workbench\* -C:\webserver\MySQL_GUI_Tools- *C:\webserver\MySQL_Workbench* 

 h2. Install PHP 5.3.x 

 # Download *"VC6 x86 Thread Safe - Installer"* from "here":http://windows.php.net/download/ 
 # Install to *C:\webserver\PHP\* *C:\webserver\PHP* 
 #* During setup: 
 #*# for webserver, choose "Apache 2.2.x Module" include *Curl* plugin 
 #*# configuration directory is "C:\webserver\Apache\conf\" (_optional:_) include *LDAP* plugin 
 #*# you can leave all default Extensions as *DO NOT* include any MSSQL plugins, because they are, optionally adding "Internationalization" are not included in the installer package and "Multi-Byte String" 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)_ 

 h2. Install Ruby 1.8.7 with RubyGems 

 * _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+._ 

 # Download *"rubyinstaller-1.8.7-p299.exe"* *"rubyinstaller-1.8.7-p249-rc2.exe"* from "here":http://rubyforge.org/frs/?group_id=167 
 # Install to *C:\webserver\Ruby\* *C:\webserver\ruby* 
 # During setup, select *"Add Ruby executables to your PATH"* 
 # Verify Ruby version 
 #* Open command window, then execute: <pre> 
 ruby -v mkdir C:\webserver\railsapps 
 </pre> cd C:\webserver\railsapps 
 #** expected output:<pre> gem list 
 ruby 1.8.7 (2010-06-23 patchlevel 299) [i386-mingw32] gem uninstall rails 
 gem uninstall actionmailer 
 gem uninstall actionpack 
 gem uninstall activerecord 
 gem uninstall activeresource 
 gem uninstall activesupport 
 </pre> 
 # Verify RubyGems Ruby version 
 #* ## in command window, execute: <pre> 
 gem ruby -v 
 </pre> 
 #** ##* expected output:<pre> 
 1.3.7 ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32] 
 </pre> 
 ##* 

 h2. Install RubyGems 

 * _At the time of writing this document the latest version of RubyGems was 1.3.7. 1.3.5. Newer versions should work too._ 

 # Download *"rubygems-1.3.5.zip"* from "here":http://rubyforge.org/frs/?group_id=126 
 # Check for RubyGems update Extract the package to *C:\webserver\railsapps* 
 #* # Install Ruby Gems 
 ## in command window, execute: <pre> 
 gem update --system cd C:\webserver\railsapps\rubygems-1.3.5 
 ruby setup.rb 
 </pre> 
 #** ##* expected output:<pre> 
 Updating RubyGems 1.3.5 installed 
 Nothing to </pre> 
 ## in command window, execute: <pre> 
 cd .. 
 gem update --system 
 </pre> 

 * 
 ##* _If you get errors about missing "SSLEAY32.dll", install PHP as shown above and this dll will become available_ 

 h2. Additional gems 

 * _mongrel-service and win32-service gems have to be downloaded manually. Download locations are added to sections below._ 

 h3. 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: <pre> 
 gem install rake</pre> 
 #** ##* expected output:<pre> 
 Successfully installed rake-0.8.7 
 </pre> 

 h3. Install Rails 

 * _At the time of writing this document, the latest version of Rails is 2.3.8, but *Redmine 1.0.0* 0.9.1* installation requires required *Rails 2.3.5*._ 2.3.5*. Use Rails version 2.3.5 for Redmine revision >= r3235    deployment._* 

 # Install Rails gems 
 #* ## in command window, execute: <pre> 
 gem install rails -v=2.3.5 
 </pre> 
 #** ##* expected output:<pre> 
 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 rack-1.0.1 
 7 gems Successfully installed rails-2.3.5 
 </pre> 

 h3. 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_":http://rubyforge.org/projects/mongrel/ 

 # Install Mongrel gems 
 #* ## in command window, execute: <pre> 
 gem install mongrel 
 </pre> 
 #** ##* expected output:<pre> 
 Successfully installed gem_plugin-0.2.3 
 Successfully installed cgi_multipart_eof_fix-2.5.0 
 Successfully installed mongrel-1.1.5-x86-mingw32 mongrel-1.1.5-x86-mswin32-60 
 3 gems installed 
 </pre> 

 h3. 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: <pre> 
 gem install mysql 
 </pre> 
 #** ##* expected output:<pre> 
 Successfully installed mysql-2.8.1-x86-mingw32 mysql-2.8.1 
 1 gem installed 
 Installing ri documentation for mysql-2.8.1-x86-mingw32... 
 No definition for (...) *** 
 </pre> 
 #** ##* _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_ 

 h3. 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":http://rubyforge.org/frs/?group_id=1306 
 # Move *mongrel_service-0.3.4-i386-mswin32.gem* to *C:\webserver\* *C:\webserver\railsapps* 
 # Download *"win32-service-0.5.2-mswin32.gem"* from "here":http://files.ruby.inoack.com/win32utils/ 
 #* _This file is also attached at the bottom of this wiki page_ 
 # Move *win32-service-0.5.2-mswin32.gem* to *C:\webserver\* *C:\webserver\railsapps* 
 # Install the gem 
 #* ## in command window, execute: <pre> 
 cd C:\webserver\ C:\webserver\railsapps 
 gem install mongrel_service 
 </pre> 
 #** ##* expected output:<pre> 
 Successfully installed win32-service-0.5.2-x86-mswin32 gem win32-service-0.5.2-mswin32 
 Successfully installed mongrel_service-0.3.4-x86-mswin32 gem mongrel_service-0.3.4-i386-mswin32 
 2 gems installed 
 </pre> 
 # Delete the two .gem files from C:\webserver\ 

 


 h2. Install Redmine 

 * _Procedure below assumes we will be installing Redmine 1.0.0, 0.9.1, but it also works with any revisions >= r3235_ 

 # Download *"redmine-1.0.0.zip"* *Redmine 0.9.1 (final) "redmine-0.9.1.zip"* from "here":http://rubyforge.org/frs/?group_id=1850 
 # Extract the contents of the +redmine-1.0.0+ +redmine-0.9.1+ directory in the archive to *C:\webserver\Redmine* *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 connection to Start Querying" 
 ## In SQL Query window enter #* Open a new script tab and execute the following script: <pre> 
 create database redmine character set utf8; 
 create user 'redmineUser'@'localhost' identified by 'myPassword'; 
 grant all privileges on redmine.* to 'redmineUser'@'localhost'; 
 </pre> 
 ## "Execute SQL Script in Connected Server" 
 ##* #* _You should of course change make the *redmineUser* and *myPassword* to something different._ less obvious._ 
 # Copy *C:\webserver\Redmine\config\database.yml.example* *C:\webserver\railsapps\redmine\config\database.yml.example* to *C:\webserver\Redmine\config\database.yml* *C:\webserver\railsapps\redmine\config\database.yml* 
 # Edit *C:\webserver\Redmine\config\database.yml* *C:\webserver\railsapps\redmine\config\database.yml* file to configure your database settings for "production" environment. It should look like this:<pre> 
 production: 
   adapter: mysql 
   database: redmine 
   host: localhost 
   username: redmineUser 
   password: myPassword 
   encoding: utf8 
 </pre> 
 ## Set #* set username and password to the values entered in the SQL script above. 
 ## Save #* save and close the file. 
 # Create (or update) Redmine database default tables and populate with data (for fresh install only) 
 #* ## in command window, execute: <pre> 
 cd C:\webserver\Redmine C:\webserver\railsapps\redmine 
 set RAILS_ENV=production 
 rake generate_session_store config/initializers/session_store.rb 
 rake db:migrate 
 rake redmine:load_default_data 
 </pre> 
 #** ##* _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":http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/ 
 #**# move this .dll file to *C:\webserver\Ruby\bin\* 
 #**# in command window, again execute: <pre> 
 rake db:migrate 
 </pre> 
 #** There is a known issue with Redmine 1.0.0 on Win32 and ENGINE=InnoDB*, you might get an error: *Mysql::Error: BLOB/TEXT column 'path' can't have need to download a default value: ALTER TABLE `c specific version of *libmySQL.dll* into *C:\webserver\Ruby\bin* folder. 
 hanges` CHANGE `path` `path` text DEFAULT '' NOT NULL* 
 #*** It is resolved in r3860 , For details refer to resolve yourself: "*this thread*_":http://www.redmine.org/boards/1/topics/10162 
 #***# open *C:\webserver\Redmine\db\migrate\20100705164950_change_changes_path_length_limit.rb* 
 #***# in the *def self.up* block insert at the beginning: <pre> 
 change_column :changes, :path, :text, :default => nil, :null => true 
 </pre> 
 #***# save file 
 #***# in command window, again execute: <pre> 
 rake db:migrate 
 </pre> 
 # If this is a fresh install, you can pre-populate the tables with default data 
 #* in command window, execute: <pre> 
 rake redmine:load_default_data 
 </pre> 
 # _Assuming that we will be hosting Redmine under http://localhost/redmine_ http://localhost/redmine:_ 
 #* Edit *C:\webserver\Redmine\config\environment.rb* *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:<pre> 
 Redmine::Utils::relative_url_root = "/redmine"  
 </pre> 
 #* 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*_ 2.3.x* 
 #** To fix this issue create a file config/initializers/patch_for_mongrel.rb    [name of file can be anything]: anything]:_ 
 <pre> 
 # 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 
 </pre> 

 h2. 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 (@3 processes) 

 # Create windows services 
 ## in command window, execute: <pre> 
 mongrel_rails service::install -N mongrel_redmine_3001 -D "Mongrel serving Redmine on 3001" -p 3001 -e production -c C:\webserver\Redmine 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\Redmine 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\Redmine C:\webserver\railsapps\redmine 
 </pre> 
 # Start windows services, which in turn will start mongrel servers 
 ## in command window, execute: <pre> 
 net start mongrel_redmine_3001 
 net start mongrel_redmine_3002 
 net start mongrel_redmine_3003 
 </pre> 
 # Go to the Windows Services list and set all "Mongrel serving Redmine on 300#" services to start automatically 
 ## in command window, execute: <pre> 
 services.msc /s 
 </pre> 
 ## 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. 

 h2. 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* *C:\webserver\apache\conf\httpd.conf* 
 # At the bottom of this file add the following line: <pre> 
 Include conf/httpd-proxy-mongrel.conf 
 </pre> 
 # Create a file *C:\webserver\Apache\conf\httpd-proxy-mongrel.conf* *C:\webserver\apache\conf\httpd-proxy-mongrel.conf* 
 # Enter the following: <pre> 
 <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> 
 </pre> 
 # Restart the Apache service. 
 #* in command window, execute: <pre> 
 C:\webserver\Apache\bin\httpd.exe C:\webserver\apache\bin\httpd.exe -w -n "Apache2.2" -k stop 
 C:\webserver\Apache\bin\httpd.exe C:\webserver\apache\bin\httpd.exe -w -n "Apache2.2" -k start 
 </pre> 



 *+DONE!+* 
 Your local installation of Redmine is now accessible at http://localhost/redmine 


 h2. Additional components 

 



 h3. Install RMagic Apendix 

 # Download *"RMagick-2.12.0-ImageMagick-6.5.6-8-Q8.zip"* or a later version from "here":http://rubyforge.org/frs/?group_id=12 
 # 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 * Check if you have all the RMagic gem necessary gems installed for Redmine 0.9.1+ 
 #* ** in command window, execute: <pre> 
 cd C:\webserver 
 gem install rmagick --local list 
 </pre> 
 #** *** expected output:<pre> 
 Successfully installed rmagick-2.12.0-x86-mswin32 actionmailer (2.3.5) 
 1 gem installed actionpack (2.3.5) 
 </pre> activerecord (2.3.5) 
 # Delete the .gem file from C:\webserver\ activeresource (2.3.5) 
 # Reboot your server. (I was unsuccessful trying to get it to work without rebooting) 


 h3. Add redmine_attach_screenshot plugin 

 # download source from "here":http://github.com/snej/redmine_attach_screenshot activesupport (2.3.5) 
 # Extract the archive to *C:\webserver\Redmine\vendor\plugins\redmine_attach_screenshot* cgi_multipart_eof_fix (2.5.0) 
 # Restart the Mongrel cluster gem_plugin (0.2.3) 
 #* in command window, execute: <pre> mongrel (1.1.5) 
 net stop mongrel_redmine_3001 mongrel_service (0.3.4) 
 net stop mongrel_redmine_3002 mysql (2.8.1) 
 net stop mongrel_redmine_3003 rack (1.0.1) 
 net start mongrel_redmine_3001 rails (2.3.5) 
 net start mongrel_redmine_3002 rake (0.8.7) 
 net start mongrel_redmine_3003 win32-service (0.5.2) 
 </pre> 



 +In 

 * As already mentioned above, in case you encounter problems, please look at "*this forum thread*":http://www.redmine.org/boards/1/topics/10162 for information about some known issues and their workarounds+ workarounds