Project

General

Profile

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

Jérôme Souquières, 2010-02-16 19:02
An installer is now available for Ruby 1.8.7

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