Project

General

Profile

RedmineInstall » History » Version 203

Jean-Philippe Lang, 2013-03-19 21:45

1 1 Jean-Philippe Lang
h1. Installing Redmine
2
3
{{>TOC}}
4 73 Liraz Siri
5 147 Jean-Philippe Lang
This is the installation documentation for Redmine 1.4.0 and higher. You can still read the document for 1.3.x "here":/projects/redmine/wiki/RedmineInstall?version=146.
6
7 1 Jean-Philippe Lang
h2. Requirements
8
9 25 Jean-Philippe Lang
h3. Operating system
10 1 Jean-Philippe Lang
11 161 Etienne Massip
Redmine should run on most Unix, Linux, [[RedmineInstallOSX|Mac]], [[RedmineInstallOSXServer|Mac Server]] and [[RedmineInstall#Notes-on-Windows-installation|Windows]] systems as long as Ruby is available on this platform.  See specific installation HowTos [[HowTos|here]].
12 25 Jean-Philippe Lang
13 163 Etienne Massip
h3. Ruby interpreter
14 25 Jean-Philippe Lang
15 163 Etienne Massip
The required Ruby versions for a given Redmine version is:
16 1 Jean-Philippe Lang
17 189 Mischa The Evil
|_. Redmine version|_. Supported Ruby versions           |_. Rails version used|_. Supported RubyGems versions|
18 203 Jean-Philippe Lang
|current trunk     |ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, jruby-1.6.7, jruby-1.7.2|Rails 3.2.13         |RubyGems <= 1.8|
19
|2.3.0             |ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0, jruby-1.6.7, jruby-1.7.2|Rails 3.2.13         |RubyGems <= 1.8|
20
|2.2.4             |ruby 1.8.7, 1.9.2, 1.9.3, jruby-1.6.7|Rails 3.2.13         |RubyGems <= 1.8|
21 1 Jean-Philippe Lang
22 164 Etienne Massip
h3. Supported database back-ends
23 92 Knight Samar
24 146 Etienne Massip
* MySQL 5.0 or higher (recommended)
25 35 Jean-Philippe Lang
26 195 Mischa The Evil
 * make sure to install the C bindings for Ruby that dramatically improve performance. You can get them by running @gem install mysql2@.
27 1 Jean-Philippe Lang
28 191 Etienne Massip
* PostgreSQL 8.2 or higher
29 117 Etienne Massip
30 1 Jean-Philippe Lang
 * make sure your database datestyle is set to ISO (Postgresql default setting). You can set it using: @ALTER DATABASE "redmine_db" SET datestyle="ISO,MDY";@
31 146 Etienne Massip
 * some bugs in PostgreSQL 8.4.0 and 8.4.1 affect Redmine behavior (#4259, #4314), they are fixed in PostgreSQL 8.4.2
32 1 Jean-Philippe Lang
33 201 Jean-Philippe Lang
* Microsoft SQL Server 2008 or higher (since Redmine 2.3.0)
34 192 Etienne Massip
35
* SQLite 3 (not for multi-user production use!)
36 190 Etienne Massip
37 1 Jean-Philippe Lang
h3. Optional components
38
39
      * SCM binaries (eg. @svn@), for repository browsing (must be available in your PATH). See [[RedmineRepositories]] for SCM compatibility and requirements.
40 193 Mischa The Evil
      * "ImageMagick":http://www.imagemagick.org/ (to enable Gantt export to png image).
41
      * "Ruby OpenID Library":http://openidenabled.com/ruby-openid/ (to enable OpenID support). Version 2 or greater is required.
42 1 Jean-Philippe Lang
43
h2. Redmine Version
44
45
It is recommended that the majority of users install the proper point releases of redmine. Redmine currently releases a new version every 6 months, and these releases are considered very usable and stable. It is *not* recommended to install redmine from trunk, unless you are deeply familiar with Ruby on Rails and keep up with the changes - Trunk _does_ break from time-to-time.
46
47 114 Etienne Massip
h2. Installation procedure
48 35 Jean-Philippe Lang
49 165 Etienne Massip
h3. Step 1 - Redmine application
50 26 Jean-Philippe Lang
51 165 Etienne Massip
Get the Redmine source code by either downloading a packaged release or checking out the code repository.
52 1 Jean-Philippe Lang
53 174 Etienne Massip
See the [[Download|download page]] for details.
54 165 Etienne Massip
55 202 Jean-Philippe Lang
h3. Step 2 - Create an empty database and accompanying user
56 165 Etienne Massip
57 1 Jean-Philippe Lang
Redmine database user will be named @redmine@ hereafter but it can be changed to anything else.
58 165 Etienne Massip
59 1 Jean-Philippe Lang
h4. MySQL
60 166 Etienne Massip
61 165 Etienne Massip
<pre>
62 39 Yclept Nemo
create database redmine character set utf8;
63
create user 'redmine'@'localhost' identified by 'my_password';
64
grant all privileges on redmine.* to 'redmine'@'localhost';
65 1 Jean-Philippe Lang
</pre>
66 88 Sean Farrell
67
For versions of MySQL prior to 5.0.2 - skip the 'create user' step and instead:
68 1 Jean-Philippe Lang
<pre>
69 88 Sean Farrell
grant all privileges on redmine.* to 'redmine'@'localhost' identified by 'my_password';
70 1 Jean-Philippe Lang
</pre>
71
72
h4. PostgreSQL
73 166 Etienne Massip
74 1 Jean-Philippe Lang
<pre>
75
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
76
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
77
</pre>
78 166 Etienne Massip
79 202 Jean-Philippe Lang
h3. Step 3 - Database connection configuration
80 1 Jean-Philippe Lang
81 165 Etienne Massip
Copy @config/database.yml.example@ to @config/database.yml@ and edit this file in order to configure your database settings for "production" environment.
82
83 147 Jean-Philippe Lang
Example for a MySQL database using ruby1.8 or jruby:
84 88 Sean Farrell
85 63 Thanos Kyritsis
<pre>
86 1 Jean-Philippe Lang
production:
87
  adapter: mysql
88
  database: redmine
89
  host: localhost
90
  username: redmine
91
  password: my_password
92
</pre>
93
94
Example for a MySQL database using ruby1.9 (adapter must be set to @mysql2@):
95
96
<pre>
97
production:
98
  adapter: mysql2
99
  database: redmine
100
  host: localhost
101
  username: redmine
102
  password: my_password
103
</pre>
104
105
If your server is not running on the standard port (3306), use this configuration instead:
106
107
<pre>
108
production:
109
  adapter: mysql
110
  database: redmine
111
  host: localhost
112
  port: 3307
113
  username: redmine
114
  password: my_password
115
</pre>
116
117
118
Example for a PostgreSQL database (default port):
119
120
<pre>
121
production:
122
  adapter: postgresql
123
  database: <your_database_name>
124 63 Thanos Kyritsis
  host: <postgres_host>
125
  username: <postgres_user>
126
  password: <postgres_user_password>
127 64 Thanos Kyritsis
  encoding: utf8
128 63 Thanos Kyritsis
  schema_search_path: <database_schema> (default - public)
129 202 Jean-Philippe Lang
</pre>
130
131
132
h3. Step 4 - Dependencies installation
133
134
Redmine uses "Bundler":http://gembundler.com/ to manage gems dependencies.
135
136
You need to install Bundler first:
137
138
  gem install bundler
139
140
Then you can install all the gems required by Redmine using the following command:
141
142
  bundle install --without development test
143
144
h4. Optional dependencies
145
146
h5. RMagick (allows the use of ImageMagick to manipulate images for PDF and PNG export)
147
148
If ImageMagick is not installed on your system, you should skip the installation of the rmagick gem using:
149
150
 @bundle install --without development test rmagick@
151
152
153
If you have trouble installing @rmagick@ on Windows, refer to [[HowTo_install_rmagick_gem_on_Windows|this HowTo]].
154
155
h5. Database adapters
156
157
Only the gems that are needed by the adapters you've specified in your database configuration file are actually installed (eg. if your config/database.yml uses the 'mysql2' adapter, then only the mysql2 gem will be installed). Don't forget to re-run `bundle install` when you change config/database.yml for using other database adapters.
158
159
h4. Additional dependencies (@Gemfile.local@)
160
161
If you need to load gems that are not required by Redmine core (eg. Puma, fcgi), create a file named @Gemfile.local@ at the root of your redmine directory. It will be loaded automatically when running @bundle install@.
162
163
Example:
164
<pre>
165
# Gemfile.local
166
gem 'puma'
167 1 Jean-Philippe Lang
</pre>
168
169 165 Etienne Massip
h3. Step 5 - Session store secret generation
170 1 Jean-Philippe Lang
171 165 Etienne Massip
This step generates a random key used by Rails to encode cookies storing session data thus preventing their tampering.
172
Generating a new secret token invalidates all existing sessions after restart.
173
174 151 Jean-Philippe Lang
* with Redmine 1.4.x:
175
176
<pre>
177
rake generate_session_store
178 1 Jean-Philippe Lang
</pre>
179 151 Jean-Philippe Lang
180 1 Jean-Philippe Lang
* with Redmine 2.x:
181
182 151 Jean-Philippe Lang
<pre>
183 1 Jean-Philippe Lang
rake generate_secret_token
184
</pre>
185 90 Jiongliang Zhang
186 165 Etienne Massip
h3. Step 6 - Database schema objects creation
187 90 Jiongliang Zhang
188 165 Etienne Massip
Create the database structure, by running the following command under the application root directory:
189
190 1 Jean-Philippe Lang
  RAILS_ENV=production rake db:migrate
191
192 184 Etienne Massip
Windows syntax:
193 1 Jean-Philippe Lang
194 184 Etienne Massip
 set RAILS_ENV=production
195
rake db:migrate
196
197
It will create tables by running all migrations one by one then create the set of the permissions and the application administrator account, named @admin@.
198
199
+Ubuntu troubleshooting:+
200 1 Jean-Philippe Lang
201 165 Etienne Massip
If you get this error with Ubuntu:
202 90 Jiongliang Zhang
<pre>
203 114 Etienne Massip
Rake aborted!
204 1 Jean-Philippe Lang
no such file to load -- net/https
205
</pre>
206
207 165 Etienne Massip
Then you need to install @libopenssl-ruby1.8@ just like this: @apt-get install libopenssl-ruby1.8@.
208 1 Jean-Philippe Lang
209 165 Etienne Massip
h3. Step 7 - Database default data set
210 1 Jean-Philippe Lang
211 165 Etienne Massip
Insert default configuration data in database, by running the following command:
212
213 1 Jean-Philippe Lang
  RAILS_ENV=production rake redmine:load_default_data
214 62 Vladimir L
215 171 Etienne Massip
Redmine will prompt you for the data set language that should be loaded; you can also define the @REDMINE_LANG@ environment variable before running the command to a value which will be automatically and silently picked up by the task.
216
217
E.g.:
218
219
Unices:
220
221
  RAILS_ENV=production REDMINE_LANG=fr rake redmine:load_default_data
222
223
Windows:
224
<pre>
225
set RAILS_ENV=production
226
set REDMINE_LANG=fr
227
rake redmine:load_default_data
228
</pre>
229 32 Jean-Philippe Lang
230 167 Etienne Massip
h3. Step 8 - File system permissions
231 32 Jean-Philippe Lang
232 165 Etienne Massip
NB: _Windows users can skip this section._
233 14 Jean-Philippe Lang
234 165 Etienne Massip
The user account running the application must have write permission on the following subdirectories:
235 1 Jean-Philippe Lang
236 165 Etienne Massip
# @files@ (storage of attachments)
237
# @log@ (application log file @production.log@)
238 167 Etienne Massip
# @tmp@ and @tmp/pdf@ (create these ones if not present, used to generate PDF documents among other things)
239 1 Jean-Philippe Lang
240 167 Etienne Massip
E.g., assuming you run the application with a redmine user account:
241 165 Etienne Massip
242 1 Jean-Philippe Lang
<pre>
243 167 Etienne Massip
mkdir tmp tmp/pdf public/plugin_assets
244 1 Jean-Philippe Lang
sudo chown -R redmine:redmine files log tmp public/plugin_assets
245
sudo chmod -R 755 files log tmp public/plugin_assets
246
</pre>
247
248 165 Etienne Massip
h3. Step 9 - Test the installation
249 1 Jean-Philippe Lang
250 165 Etienne Massip
Test the installation by running WEBrick web server:
251
252 1 Jean-Philippe Lang
* with Redmine 1.4.x:
253
254 151 Jean-Philippe Lang
<pre>
255
ruby script/server webrick -e production
256 1 Jean-Philippe Lang
</pre>
257
258 151 Jean-Philippe Lang
* with Redmine 2.x:
259
260
<pre>
261
ruby script/rails server webrick -e production
262
</pre>
263
264
Once WEBrick has started, point your browser to http://localhost:3000/. You should now see the application welcome page.
265
266 165 Etienne Massip
> Note: Webrick is *not* suitable for production use, please only use webrick for testing that the installation up to this point is functional. Use one of the many other guides in this wiki to setup redmine to use either Passenger (aka @mod_rails@), FCGI or a Rack server (Unicorn, Thin, Puma, hellip;) to serve up your redmine.
267 14 Jean-Philippe Lang
268 165 Etienne Massip
h3. Step 10 - Logging into the application
269 158 Etienne Massip
270 165 Etienne Massip
Use default administrator account to log in:
271
272 1 Jean-Philippe Lang
    * login: admin
273
    * password: admin
274 14 Jean-Philippe Lang
275 165 Etienne Massip
You can go to ??Administration?? menu and choose ??Settings?? to modify most of the application settings.
276
277 130 Etienne Massip
h2. Configuration
278 1 Jean-Philippe Lang
279 185 Etienne Massip
Redmine settings are defined in a file named @config/configuration.yml@.
280 1 Jean-Philippe Lang
281 185 Etienne Massip
If you need to override default application settings, simply copy @config/configuration.yml.example@ to @config/configuration.yml@ and edit the new file; the file is well commented by itself, so you should have a look at it.
282 1 Jean-Philippe Lang
283 185 Etienne Massip
These settings may be defined per Rails environment (@production@/@development@/@test@).
284 131 Etienne Massip
285
+Important+ : don't forget to restart the application after any change.
286
287 130 Etienne Massip
h3. Email / SMTP server settings
288
289 132 Etienne Massip
Email configuration is described in a [[EmailConfiguration|dedicated page]].
290 1 Jean-Philippe Lang
291
h3. SCM settings
292
293 133 Etienne Massip
This configuration section allows you to:
294 131 Etienne Massip
* override default commands names if the SCM binaries present in the @PATH@ variable doesn't use the standard name (Windows .bat/.cmd names won't work)
295
* specify the full path to the binary
296
297 133 Etienne Massip
Examples (with Subversion):
298 131 Etienne Massip
299 133 Etienne Massip
Command name override:
300 131 Etienne Massip
301
 scm_subversion_command: "svn_replacement.exe"
302
303 133 Etienne Massip
Absolute path:
304 1 Jean-Philippe Lang
305
 scm_subversion_command: "C:\Program Files\Subversion\bin\svn.exe"
306
307
h3. Attachment storage settings
308
309 133 Etienne Massip
You can set a path where Redmine attachments will be stored which is different from the default 'files' directory of your Redmine instance using the @attachments_storage_path@ setting.
310
311
Examples:
312
313
 attachments_storage_path: /var/redmine/files
314
315
 attachments_storage_path: D:/redmine/files
316 130 Etienne Massip
317
h2. Logging configuration
318
319 101 T. Hauptman
Redmine defaults to a log level of :info, writing to the @log@ subdirectory. Depending on site usage, this can be a lot of data so to avoid the contents of the logfile growing without bound, consider rotating them, either through a system utility like @logrotate@ or via the @config/additional_environment.rb@ file.
320 21 Jean-Philippe Lang
321
To use the latter, copy @config/additional_environment.rb.example@ to @config/additional_environment.rb@ and add the following lines. Note that the new logger defaults to a high log level and hence has to be explicitly set to @info@.
322 123 Jean-Philippe Lang
<pre><code class="ruby">
323 21 Jean-Philippe Lang
#Logger.new(PATH,NUM_FILES_TO_ROTATE,FILE_SIZE)
324 162 Jean-Philippe Lang
config.logger = Logger.new('/path/to/logfile.log', 2, 1000000)
325 11 Jean-Philippe Lang
config.logger.level = Logger::INFO
326
</code></pre>
327
328
h2. Backups
329
330
Redmine backups should include:
331
* data (stored in your redmine database)
332
* attachments (stored in the @files@ directory of your Redmine install)
333
334
Here is a simple shell script that can be used for daily backups (assuming you're using a mysql database):
335
336
<pre>
337
# Database
338 55 Lukasz Slonina
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz
339 11 Jean-Philippe Lang
340
# Attachments
341 1 Jean-Philippe Lang
rsync -a /path/to/redmine/files /path/to/backup/files
342
</pre>
343 69 Giuliano Simoncelli
344
h2. Notes on Windows installation
345
346 156 Etienne Massip
There is an prebuilt installer of Ruby MRI available from http://rubyinstaller.org.
347
After installing it, select _Start Command Prompt with Ruby_ in the start menu.
348 1 Jean-Philippe Lang
349 156 Etienne Massip
+Specifying the @RAILS_ENV@ environment variable:+
350 69 Giuliano Simoncelli
351 156 Etienne Massip
When running command as described in this guide, you have to set the @RAILS_ENV@ environment variable using a separate command.
352 1 Jean-Philippe Lang
353 156 Etienne Massip
I.e. commands with the following syntaxes:
354 69 Giuliano Simoncelli
355 156 Etienne Massip
<pre>RAILS_ENV=production <any commmand></pre>
356 69 Giuliano Simoncelli
357 156 Etienne Massip
<pre><any commmand> RAILS_ENV=production</pre>
358 1 Jean-Philippe Lang
359 156 Etienne Massip
have to be turned into 2 subsequent commands:
360 69 Giuliano Simoncelli
361 156 Etienne Massip
<pre>set RAILS_ENV=production
362
<any commmand></pre>
363
364
+MySQL gem installation issue:+
365
366
You may need to manually install the mysql gem using the following command:
367
368 69 Giuliano Simoncelli
<pre>
369
gem install mysql
370
</pre>
371 1 Jean-Philippe Lang
372 156 Etienne Massip
And in some case it is required to copy the _libmysql.dll_ file in your ruby/bin directory.
373
Not all libmysql.dll are ok this seem to works http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll.
374
375 186 Jan Niggemann (redmine.org team member)
*Important note for Win7 and later*
376
On Win7 and later, @localhost@ is commented out in the hosts file[1] and IPV6 is the default[2]. As the mysql2 gem does no support IPV6 addresses[3], a connection can't be established and you get the error "@Can't connect to MySQL server on 'localhost' (10061)@".
377
You can confirm this by pinging @localhost@, if ping targets "::1:" IPV6 is being used.
378
379
+Workaround:+
380
Replace @localhost@ with @127.0.0.1@ in database.yml.
381
382
fn1. http://serverfault.com/questions/4689/windows-7-localhost-name-resolution-is-handled-within-dns-itself-why
383
384
fn2. http://www.victor-ratajczyk.com/post/2012/02/25/mysql-fails-to-resolve-localhost-disable-ipv6-on-windows.aspx
385
386
fn3. https://github.com/brianmario/mysql2/issues/279
387
388 80 Jean-Philippe Lang
389
h2. Alternative to manual installation
390
391
Some users may prefer to skip manual installation by using one of the [[Download#Third-party-Redmine-bundles|third-party Redmine bundles]] on the download page.