Project

General

Profile

HowTo Install Redmine in a sub-URI on Windows with Apache » History » Version 3

Jack Kurzecki, 2010-02-01 11:28
updated for Redmine 0.9.1 and added more details

1 1 Jack Kurzecki
h1. HowTo Install Redmine in a sub-URI on Windows with Apache
2
3
{{>toc}}
4
5 3 Jack Kurzecki
bq. 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.
6
This walk-through also applies to installation of the latest Redmine revision. It was tested with *Redmine revision r3357*.
7 2 Jack Kurzecki
The intended audience for this walk-through are Windows users.
8 1 Jack Kurzecki
9
h2. Install Apache HTTP server 2.2.x
10
11 3 Jack Kurzecki
# 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
12
# Install to *C:\webserver\apache*
13 1 Jack Kurzecki
14
h2. Install MySQL 5.1.x
15
16 3 Jack Kurzecki
# Download *"Windows (x86, 32-bit), MSI Installer"* from "here":http://dev.mysql.com/downloads/mysql/5.1.html#win32
17
#* _(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.)_
18
# Install to *C:\webserver\MySQL*
19
#* During setup:
20
#*# set +default character set+ to *UTF8*
21
#*# select "Include Bin Directory in Windows PATH"
22
#*# (_optional:_) set data files installation directory to *C:\webserver\MySQLData*
23 1 Jack Kurzecki
24
h2. Install MySQL GUI Tools for MySQL 5.0
25
26 3 Jack Kurzecki
# Download *"Windows (x86)"* from "here":http://dev.mysql.com/downloads/gui-tools/5.0.html
27
# Install to *C:\webserver\MySQL_GUI_Tools*
28 1 Jack Kurzecki
29 3 Jack Kurzecki
h2. Install PHP 5.3.x
30
31
# Download *"VC6 x86 Thread Safe Installer"* from "here":http://windows.php.net/download/
32
# Install to *C:\webserver\PHP*
33
# (_optional:_) During setup, include LDAP plugin
34
35
36 1 Jack Kurzecki
h2. Install Ruby 1.8.7
37
38 3 Jack Kurzecki
* _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+._
39
* 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+.
40 1 Jack Kurzecki
41 3 Jack Kurzecki
# Download *"rubyinstaller-1.8.6-p383-rc1.exe"* from "here":http://rubyforge.org/frs/?group_id=167
42
# Install to *C:\webserver\ruby*
43
# During setup, select *"Add Ruby executables to your PATH"*
44 1 Jack Kurzecki
# Open command window, then execue: <pre>
45
mkdir C:\webserver\railsapps
46
cd C:\webserver\railsapps
47
gem list
48
gem uninstall rails
49
gem uninstall actionmailer
50
gem uninstall actionpack
51
gem uninstall activerecord
52
gem uninstall activeresource
53
gem uninstall activesupport
54
</pre>
55 3 Jack Kurzecki
# Download *Ruby 1.8.7-p72 Binary "ruby-1.8.7-p72-i386-mswin32.zip"* from "here":http://www.ruby-lang.org/en/downloads/
56
#* +Forget about the fact that version 1.9.1 is available (for now)+
57
# Extract the archive contents to *C:\webserver\ruby* overwriting the files from version 1.8.6 when prompted
58
# Download *"zlib compiled DLL"* package from "here":http://www.zlib.net/
59
## extract *zlib1.dll*
60
## rename it to *zlib.dll*
61
## move it to *C:\webserver\ruby\bin*
62
##* _(Alternatively you can just copy "C:\webserver\ruby\bin\zlib1.dll" and rename it to "C:\webserver\ruby\bin\zlib.dll")_
63
# Download the iconv 1.9.2-1 "libiconv-1.9.2-1-bin.zip" from "here":http://sourceforge.net/projects/gnuwin32/files/libiconv/
64
## extract *bin\libiconv2.dll*
65
## rename it to *iconv.dll*
66
## move it to *C:\webserver\ruby\bin*
67
##* _(Alternatively you can just copy "C:\webserver\ruby\bin\libiconv2.dll" and rename it to "C:\webserver\ruby\bin\iconv.dll")_
68 1 Jack Kurzecki
# Verify Ruby version
69 2 Jack Kurzecki
## in command window, execute: <pre>
70 1 Jack Kurzecki
ruby -v
71
</pre>
72
##* expected output:<pre>
73
ruby 1.8.7 (2008-08-11 patchlevel 72) [i386-mswin32]
74 2 Jack Kurzecki
</pre>
75 1 Jack Kurzecki
76
h2. Install RubyGems
77 2 Jack Kurzecki
78 3 Jack Kurzecki
* _At the time of writing this document the latest version of RubyGems was 1.3.5. Newer versions should work too._
79 1 Jack Kurzecki
80 3 Jack Kurzecki
# Download *"rubygems-1.3.5.zip"* from "here":http://rubyforge.org/frs/?group_id=126
81
# Extract the package to *C:\webserver\railsapps*
82 1 Jack Kurzecki
# Install Ruby Gems
83
## in command window, execute: <pre>
84
cd C:\webserver\railsapps\rubygems-1.3.5
85
ruby setup.rb
86
</pre>
87
##* expected output:<pre>
88
RubyGems 1.3.5 installed
89
</pre>
90
## in command window, execute: <pre>
91 2 Jack Kurzecki
cd ..
92 1 Jack Kurzecki
gem update --system
93
</pre>
94 3 Jack Kurzecki
##* _If you get errors about missing "SSLEAY32.dll", install PHP as shown above and this dll will become available_
95 1 Jack Kurzecki
96 2 Jack Kurzecki
h2. Additional gems
97
98 1 Jack Kurzecki
* _mongrel-service and win32-service gems have to be downloaded manually. Download locations are added to sections below._
99 2 Jack Kurzecki
100 1 Jack Kurzecki
h3. Install Rake
101
102 3 Jack Kurzecki
* _At the time of writing this document the latest version of Rake was 0.8.7. Newer versions should work too._
103 1 Jack Kurzecki
104
# Install Rake gem
105 2 Jack Kurzecki
## in command window, execute: <pre>
106 1 Jack Kurzecki
gem install rake</pre>
107 2 Jack Kurzecki
##* expected output:<pre>
108 1 Jack Kurzecki
Successfully installed rake-0.8.7
109
</pre>
110 2 Jack Kurzecki
111 1 Jack Kurzecki
h3. Install Rails
112
113 3 Jack Kurzecki
* _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._*
114 1 Jack Kurzecki
115
# Install Rails gems
116
## in command window, execute: <pre>
117 3 Jack Kurzecki
gem install rails -v=2.3.5
118 1 Jack Kurzecki
</pre>
119
##* expected output:<pre>
120 3 Jack Kurzecki
Successfully installed activesupport-2.3.5
121
Successfully installed activerecord-2.3.5
122
Successfully installed actionpack-2.3.5
123
Successfully installed actionmailer-2.3.5
124
Successfully installed activeresource-2.3.5
125
Successfully installed rack-1.0.1
126
Successfully installed rails-2.3.5
127 1 Jack Kurzecki
</pre>
128
129
h3. Install Mongrel
130
131 3 Jack Kurzecki
* _At the time of writing this document the latest version of Mongrel was 1.1.5. Newer versions should work too._
132 2 Jack Kurzecki
* "_Project page_":http://rubyforge.org/projects/mongrel/
133 1 Jack Kurzecki
134
# Install Mongrel gems
135
## in command window, execute: <pre>
136
gem install mongrel
137
</pre>
138
##* expected output:<pre>
139
Successfully installed gem_plugin-0.2.3
140
Successfully installed cgi_multipart_eof_fix-2.5.0
141
Successfully installed mongrel-1.1.5-x86-mswin32-60
142
</pre>
143
144
h3. Install mysql gem
145
146 3 Jack Kurzecki
* _At the time of writing this document the latest version of mysql gem was 2.8.1. Newer versions should work too._
147 1 Jack Kurzecki
* It drastically improves page generation speed.
148
149 2 Jack Kurzecki
# Install mysql gem
150 1 Jack Kurzecki
## in command window, execute: <pre>
151
gem install mysql
152
</pre>
153
##* expected output:<pre>
154 2 Jack Kurzecki
Successfully installed mysql-2.8.1
155 3 Jack Kurzecki
No definition for ***
156 1 Jack Kurzecki
</pre>
157 3 Jack Kurzecki
##* _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_
158 1 Jack Kurzecki
159 2 Jack Kurzecki
h3. Install mongrel-service + win32-service gems
160 1 Jack Kurzecki
161 3 Jack Kurzecki
* _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_
162 1 Jack Kurzecki
* *Use only win32-service version 0.5.2 for Redmine deployment.*
163
164 3 Jack Kurzecki
# Download *"mongrel_service-0.3.4-i386-mswin32.gem"* from "here":http://rubyforge.org/frs/?group_id=1306
165
# Move *mongrel_service-0.3.4-i386-mswin32.gem* to *C:\webserver\railsapps*
166
# Download *"win32-service-0.5.2-mswin32.gem"* from "here":http://files.ruby.inoack.com/win32utils/
167
#* _This file is also attached at the bottom of this wiki page_
168
# Move *win32-service-0.5.2-mswin32.gem* to *C:\webserver\railsapps*
169 1 Jack Kurzecki
# Install the gem
170 2 Jack Kurzecki
## in command window, execute: <pre>
171 1 Jack Kurzecki
cd C:\webserver\railsapps
172
gem install mongrel_service
173
</pre>
174 2 Jack Kurzecki
##* expected output:<pre>
175 1 Jack Kurzecki
Successfully installed gem win32-service-0.5.2-mswin32
176
Successfully installed gem mongrel_service-0.3.4-i386-mswin32
177
</pre>
178
179
180 2 Jack Kurzecki
h2. Install Redmine
181 1 Jack Kurzecki
182 3 Jack Kurzecki
* _Procedure below assumes we will be installing Redmine 0.9.1, but it also works with any revisions >= r3235_
183 1 Jack Kurzecki
184 3 Jack Kurzecki
# Download *Redmine 0.9.1 (final) "redmine-0.9.1.zip"* from "here":http://rubyforge.org/frs/?group_id=1850
185
# Extract the contents of the +redmine-0.9.1+ directory in the archive to *C:\webserver\railsapps\redmine*
186
# Log into MySQL using *MySQL Query Browser* from MySQL GUI Tools as *root*. You can also use command prompt or another tool, such as phpMyAdmin.
187 2 Jack Kurzecki
#* Open a new script tab and execute the following script: <pre>
188 1 Jack Kurzecki
create database redmine character set utf8;
189 3 Jack Kurzecki
create user 'redmineUser'@'localhost' identified by 'myPassword';
190
grant all privileges on redmine.* to 'redmineUser'@'localhost';
191 1 Jack Kurzecki
</pre>
192 3 Jack Kurzecki
#* _You should of course make the *redmineUser* and *myPassword* less obvious._
193
# Copy *C:\webserver\railsapps\redmine\config\database.yml.example* to *C:\webserver\railsapps\redmine\config\database.yml*
194
# Edit *C:\webserver\railsapps\redmine\config\database.yml* file to configure your database settings for "production" environment. It should look like this:<pre>
195
production:
196
  adapter: mysql
197
  database: redmine
198
  host: localhost
199
  username: redmineUser
200
  password: myPassword
201
  encoding: utf8
202
</pre>
203
#* set username and password to the values entered in the SQL script above.
204 1 Jack Kurzecki
#* save and close the file.
205 3 Jack Kurzecki
# Create default tables and populate with data (for fresh install only)
206 2 Jack Kurzecki
## in command window, execute: <pre>
207 3 Jack Kurzecki
cd C:\webserver\railsapps\redmine
208 1 Jack Kurzecki
set RAILS_ENV=production
209 3 Jack Kurzecki
rake config\initializers\session_store.rb
210 1 Jack Kurzecki
rake db:migrate
211
rake redmine:load_default_data
212
</pre>
213
# _Procedure below assumes we will be hosting Redmine under http://localhost/redmine:_
214 3 Jack Kurzecki
# 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).
215 1 Jack Kurzecki
#* add the following line at the bottom of the file:<pre>
216
Redmine::Utils::relative_url_root = "/redmine" 
217 2 Jack Kurzecki
</pre>
218 1 Jack Kurzecki
#* save and close the file.
219 3 Jack Kurzecki
#* _This is a preferred way of setting up the application prefix. *Mongrel_rails service "--prefix" directive does +NOT+ work with Rails 2.3.x*_
220 1 Jack Kurzecki
221
h2. Setup windows services
222
223 3 Jack Kurzecki
* 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:
224
** Apache = 5MB + 20MB + 40MB = 65MB
225
** MySQL = 35MB
226
** Mongrel cluster = number-of-mongrel_rails-services x (3MB + 90MB) = 279MB (@3 processes)
227
228 1 Jack Kurzecki
# Create windows services
229
## in command window, execute: <pre>
230
mongrel_rails service::install -N mongrel_redmine_3001 -D "Mongrel serving Redmine on 3001" -p 3001 -e production -c C:\webserver\railsapps\redmine
231
mongrel_rails service::install -N mongrel_redmine_3002 -D "Mongrel serving Redmine on 3002" -p 3002 -e production -c C:\webserver\railsapps\redmine
232
mongrel_rails service::install -N mongrel_redmine_3003 -D "Mongrel serving Redmine on 3003" -p 3003 -e production -c C:\webserver\railsapps\redmine
233
</pre>
234
# Start windows services, which in turn will start mongrel servers
235
## in command window, execute: <pre>
236 2 Jack Kurzecki
net start mongrel_redmine_3001
237
net start mongrel_redmine_3002
238 1 Jack Kurzecki
net start mongrel_redmine_3003
239
</pre>
240 2 Jack Kurzecki
# Go to the Windows Services list and set all "Mongrel serving Redmine on 300#" services to start automatically
241 1 Jack Kurzecki
## in command window, execute: <pre>
242
services.msc /s
243
</pre>
244 3 Jack Kurzecki
## find each one of "Mongrel serving Redmine on 300#" services
245
## right click, select *Properties*
246
## set *Startup type* to *"Automatic"*
247
## press OK and repeat for the remaining Mongrel services.
248 1 Jack Kurzecki
249
h2. Configure Apache 2.2.x as proxy to Mongrel cluster
250
251 3 Jack Kurzecki
* _Procedure below assumes we will be hosting Redmine under http://localhost/redmine and must match the *relative_url_root* set above_
252 1 Jack Kurzecki
253 3 Jack Kurzecki
# Open *C:\webserver\apache\conf\httpd.conf*
254 1 Jack Kurzecki
# At the bottom of this file add the following line: <pre>
255
Include conf/httpd-proxy-mongrel.conf
256
</pre>
257 3 Jack Kurzecki
# Create a file *C:\webserver\apache\conf\httpd-proxy-mongrel.conf*
258 1 Jack Kurzecki
# Enter the following: <pre>
259
LoadModule proxy_module modules/mod_proxy.so
260
LoadModule proxy_http_module modules/mod_proxy_http.so
261 2 Jack Kurzecki
LoadModule proxy_balancer_module modules/mod_proxy_balancer.so
262 1 Jack Kurzecki
263
ProxyPass /redmine balancer://redmine_cluster
264
ProxyPassReverse /redmine balancer://redmine_cluster
265
266
267
<Proxy balancer://redmine_cluster>
268
	BalancerMember http://127.0.0.1:3001
269
	BalancerMember http://127.0.0.1:3002
270
	BalancerMember http://127.0.0.1:3003
271
</Proxy>
272
</pre>
273 3 Jack Kurzecki
# Restart the Apache service.
274
#* in command window, execute: <pre>
275
C:\webserver\apache\bin\httpd.exe -w -n "Apache2.2" -k stop
276
C:\webserver\apache\bin\httpd.exe -w -n "Apache2.2" -k start
277
</pre>
278 1 Jack Kurzecki
279
280
281 2 Jack Kurzecki
*+DONE!+*
282
283
284
285
h3. Apendix
286
287 3 Jack Kurzecki
* Check if you have all the necessary gems installed for Redmine 0.9.1+
288 1 Jack Kurzecki
** in command window, execute: <pre>
289
gem list
290
</pre>
291
*** expected output:<pre>
292
actionmailer (2.3.5)
293 2 Jack Kurzecki
actionpack (2.3.5)
294 1 Jack Kurzecki
activerecord (2.3.5)
295
activeresource (2.3.5)
296
activesupport (2.3.5)
297
cgi_multipart_eof_fix (2.5.0)
298
gem_plugin (0.2.3)
299
mongrel (1.1.5)
300
mongrel_service (0.3.4)
301
mysql (2.8.1)
302
rack (1.0.1)
303
rails (2.3.5)
304
rake (0.8.7)
305
win32-service (0.5.2)
306
</pre>