Project

General

Profile

RedmineInstall » History » Version 210

Etienne Massip, 2013-03-25 10:21

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 204 Etienne Massip
|current trunk     |ruby 1.8.7, 1.9.2, 1.9.3, 2.0.0[1], 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[1], jruby-1.6.7, jruby-1.7.2|Rails 3.2.13         |RubyGems <= 1.8|
20 1 Jean-Philippe Lang
|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 204 Etienne Massip
22 210 Etienne Massip
fn1. At time of writing (3/19/2013), SQL Server support is reported broken with *ruby 2.0.0 under Windows* because of database adapter gem incompatibilities
23 1 Jean-Philippe Lang
24 164 Etienne Massip
h3. Supported database back-ends
25 92 Knight Samar
26 146 Etienne Massip
* MySQL 5.0 or higher (recommended)
27 35 Jean-Philippe Lang
28 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@.
29 1 Jean-Philippe Lang
30 191 Etienne Massip
* PostgreSQL 8.2 or higher
31 117 Etienne Massip
32 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";@
33 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
34 1 Jean-Philippe Lang
35 201 Jean-Philippe Lang
* Microsoft SQL Server 2008 or higher (since Redmine 2.3.0)
36 192 Etienne Massip
37
* SQLite 3 (not for multi-user production use!)
38 190 Etienne Massip
39 1 Jean-Philippe Lang
h3. Optional components
40
41
      * SCM binaries (eg. @svn@), for repository browsing (must be available in your PATH). See [[RedmineRepositories]] for SCM compatibility and requirements.
42 193 Mischa The Evil
      * "ImageMagick":http://www.imagemagick.org/ (to enable Gantt export to png image).
43
      * "Ruby OpenID Library":http://openidenabled.com/ruby-openid/ (to enable OpenID support). Version 2 or greater is required.
44 1 Jean-Philippe Lang
45
h2. Redmine Version
46
47
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.
48
49 114 Etienne Massip
h2. Installation procedure
50 35 Jean-Philippe Lang
51 165 Etienne Massip
h3. Step 1 - Redmine application
52 26 Jean-Philippe Lang
53 165 Etienne Massip
Get the Redmine source code by either downloading a packaged release or checking out the code repository.
54 1 Jean-Philippe Lang
55 174 Etienne Massip
See the [[Download|download page]] for details.
56 165 Etienne Massip
57 202 Jean-Philippe Lang
h3. Step 2 - Create an empty database and accompanying user
58 165 Etienne Massip
59 1 Jean-Philippe Lang
Redmine database user will be named @redmine@ hereafter but it can be changed to anything else.
60 165 Etienne Massip
61 1 Jean-Philippe Lang
h4. MySQL
62 166 Etienne Massip
63 208 Etienne Massip
<pre><code class="sql">
64
CREATE DATABASE redmine CHARACTER SET utf8;
65
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';
66
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
67
</code></pre>
68 1 Jean-Philippe Lang
69 88 Sean Farrell
For versions of MySQL prior to 5.0.2 - skip the 'create user' step and instead:
70 208 Etienne Massip
<pre><code class="sql">
71
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'my_password';
72
</code></pre>
73
74 1 Jean-Philippe Lang
75
h4. PostgreSQL
76 166 Etienne Massip
77 205 Etienne Massip
<pre><code class="sql">
78 1 Jean-Philippe Lang
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
79
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
80 205 Etienne Massip
</code></pre>
81
82
h4. SQL Server
83
84
The database, login and user can be created within ??SQL Server Management Studio?? with a few clicks.
85
86
If you prefer the command line option with @SQLCMD@, here's some basic example:
87 206 Etienne Massip
88
{{collapse(Show SQL,Hide SQL)
89 205 Etienne Massip
<pre><code class="sql">
90
USE [master]
91
GO
92
93
-- Very basic DB creation
94
CREATE DATABASE [REDMINE]
95 1 Jean-Philippe Lang
GO
96
97 206 Etienne Massip
-- Creation of a login with SQL Server login/password authentication and no password expiration policy
98
CREATE LOGIN [REDMINE] WITH PASSWORD=N'redminepassword', DEFAULT_DATABASE=[REDMINE], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
99 205 Etienne Massip
GO
100
101
-- User creation using previously created login authentication
102
USE [REDMINE]
103
GO
104
CREATE USER [REDMINE] FOR LOGIN [REDMINE]
105
GO
106
-- User permissions set via roles
107 207 Etienne Massip
EXEC sp_addrolemember N'db_datareader', N'REDMINE'
108 205 Etienne Massip
GO
109 207 Etienne Massip
EXEC sp_addrolemember N'db_datawriter', N'REDMINE'
110 1 Jean-Philippe Lang
GO
111 205 Etienne Massip
</code></pre>
112 206 Etienne Massip
}}
113 166 Etienne Massip
114 202 Jean-Philippe Lang
h3. Step 3 - Database connection configuration
115 1 Jean-Philippe Lang
116 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.
117
118 209 Etienne Massip
Example for a MySQL database using ruby 1.8 or jruby:
119 88 Sean Farrell
120 209 Etienne Massip
<pre><code class="yml">
121 1 Jean-Philippe Lang
production:
122
  adapter: mysql
123
  database: redmine
124
  host: localhost
125
  username: redmine
126
  password: my_password
127 209 Etienne Massip
</code></pre>
128 1 Jean-Philippe Lang
129 209 Etienne Massip
Example for a MySQL database using ruby 1.9 (adapter must be set to @mysql2@):
130 1 Jean-Philippe Lang
131 209 Etienne Massip
<pre><code class="yml">
132 1 Jean-Philippe Lang
production:
133
  adapter: mysql2
134
  database: redmine
135
  host: localhost
136
  username: redmine
137
  password: my_password
138 209 Etienne Massip
</code></pre>
139 1 Jean-Philippe Lang
140
If your server is not running on the standard port (3306), use this configuration instead:
141
142 209 Etienne Massip
<pre><code class="yml">
143 1 Jean-Philippe Lang
production:
144
  adapter: mysql
145
  database: redmine
146
  host: localhost
147
  port: 3307
148
  username: redmine
149
  password: my_password
150 209 Etienne Massip
</code></pre>
151 1 Jean-Philippe Lang
152
Example for a PostgreSQL database (default port):
153
154 209 Etienne Massip
<pre><code class="yml">
155 1 Jean-Philippe Lang
production:
156
  adapter: postgresql
157
  database: <your_database_name>
158
  host: <postgres_host>
159
  username: <postgres_user>
160
  password: <postgres_user_password>
161
  encoding: utf8
162
  schema_search_path: <database_schema> (default - public)
163 209 Etienne Massip
</code></pre>
164 1 Jean-Philippe Lang
165 209 Etienne Massip
Example for a SQL Server database (default host @localhost@, default port @1433@):
166
<pre><code class="yml">
167
production:
168
  adapter: sqlserver
169
  database: redmine
170
  username: redmine # should match the database user name
171
  password: redminepassword # should match the login password
172
</code></pre>
173 202 Jean-Philippe Lang
174
h3. Step 4 - Dependencies installation
175
176
Redmine uses "Bundler":http://gembundler.com/ to manage gems dependencies.
177
178
You need to install Bundler first:
179
180
  gem install bundler
181
182
Then you can install all the gems required by Redmine using the following command:
183
184
  bundle install --without development test
185
186
h4. Optional dependencies
187
188
h5. RMagick (allows the use of ImageMagick to manipulate images for PDF and PNG export)
189
190
If ImageMagick is not installed on your system, you should skip the installation of the rmagick gem using:
191
192
 @bundle install --without development test rmagick@
193
194
195
If you have trouble installing @rmagick@ on Windows, refer to [[HowTo_install_rmagick_gem_on_Windows|this HowTo]].
196
197
h5. Database adapters
198
199
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.
200
201
h4. Additional dependencies (@Gemfile.local@)
202
203
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@.
204
205
Example:
206
<pre>
207
# Gemfile.local
208
gem 'puma'
209 1 Jean-Philippe Lang
</pre>
210
211 165 Etienne Massip
h3. Step 5 - Session store secret generation
212 1 Jean-Philippe Lang
213 165 Etienne Massip
This step generates a random key used by Rails to encode cookies storing session data thus preventing their tampering.
214
Generating a new secret token invalidates all existing sessions after restart.
215
216 151 Jean-Philippe Lang
* with Redmine 1.4.x:
217
218
<pre>
219
rake generate_session_store
220 1 Jean-Philippe Lang
</pre>
221 151 Jean-Philippe Lang
222 1 Jean-Philippe Lang
* with Redmine 2.x:
223
224 151 Jean-Philippe Lang
<pre>
225 1 Jean-Philippe Lang
rake generate_secret_token
226
</pre>
227 90 Jiongliang Zhang
228 165 Etienne Massip
h3. Step 6 - Database schema objects creation
229 90 Jiongliang Zhang
230 165 Etienne Massip
Create the database structure, by running the following command under the application root directory:
231
232 1 Jean-Philippe Lang
  RAILS_ENV=production rake db:migrate
233
234 184 Etienne Massip
Windows syntax:
235 1 Jean-Philippe Lang
236 184 Etienne Massip
 set RAILS_ENV=production
237
rake db:migrate
238
239
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@.
240
241
+Ubuntu troubleshooting:+
242 1 Jean-Philippe Lang
243 165 Etienne Massip
If you get this error with Ubuntu:
244 90 Jiongliang Zhang
<pre>
245 114 Etienne Massip
Rake aborted!
246 1 Jean-Philippe Lang
no such file to load -- net/https
247
</pre>
248
249 165 Etienne Massip
Then you need to install @libopenssl-ruby1.8@ just like this: @apt-get install libopenssl-ruby1.8@.
250 1 Jean-Philippe Lang
251 165 Etienne Massip
h3. Step 7 - Database default data set
252 1 Jean-Philippe Lang
253 165 Etienne Massip
Insert default configuration data in database, by running the following command:
254
255 1 Jean-Philippe Lang
  RAILS_ENV=production rake redmine:load_default_data
256 62 Vladimir L
257 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.
258
259
E.g.:
260
261
Unices:
262
263
  RAILS_ENV=production REDMINE_LANG=fr rake redmine:load_default_data
264
265
Windows:
266
<pre>
267
set RAILS_ENV=production
268
set REDMINE_LANG=fr
269
rake redmine:load_default_data
270
</pre>
271 32 Jean-Philippe Lang
272 167 Etienne Massip
h3. Step 8 - File system permissions
273 32 Jean-Philippe Lang
274 165 Etienne Massip
NB: _Windows users can skip this section._
275 14 Jean-Philippe Lang
276 165 Etienne Massip
The user account running the application must have write permission on the following subdirectories:
277 1 Jean-Philippe Lang
278 165 Etienne Massip
# @files@ (storage of attachments)
279
# @log@ (application log file @production.log@)
280 167 Etienne Massip
# @tmp@ and @tmp/pdf@ (create these ones if not present, used to generate PDF documents among other things)
281 1 Jean-Philippe Lang
282 167 Etienne Massip
E.g., assuming you run the application with a redmine user account:
283 165 Etienne Massip
284 1 Jean-Philippe Lang
<pre>
285 167 Etienne Massip
mkdir tmp tmp/pdf public/plugin_assets
286 1 Jean-Philippe Lang
sudo chown -R redmine:redmine files log tmp public/plugin_assets
287
sudo chmod -R 755 files log tmp public/plugin_assets
288
</pre>
289
290 165 Etienne Massip
h3. Step 9 - Test the installation
291 1 Jean-Philippe Lang
292 165 Etienne Massip
Test the installation by running WEBrick web server:
293
294 1 Jean-Philippe Lang
* with Redmine 1.4.x:
295
296 151 Jean-Philippe Lang
<pre>
297
ruby script/server webrick -e production
298 1 Jean-Philippe Lang
</pre>
299
300 151 Jean-Philippe Lang
* with Redmine 2.x:
301
302
<pre>
303
ruby script/rails server webrick -e production
304
</pre>
305
306
Once WEBrick has started, point your browser to http://localhost:3000/. You should now see the application welcome page.
307
308 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.
309 14 Jean-Philippe Lang
310 165 Etienne Massip
h3. Step 10 - Logging into the application
311 158 Etienne Massip
312 165 Etienne Massip
Use default administrator account to log in:
313
314 1 Jean-Philippe Lang
    * login: admin
315
    * password: admin
316 14 Jean-Philippe Lang
317 165 Etienne Massip
You can go to ??Administration?? menu and choose ??Settings?? to modify most of the application settings.
318
319 130 Etienne Massip
h2. Configuration
320 1 Jean-Philippe Lang
321 185 Etienne Massip
Redmine settings are defined in a file named @config/configuration.yml@.
322 1 Jean-Philippe Lang
323 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.
324 1 Jean-Philippe Lang
325 185 Etienne Massip
These settings may be defined per Rails environment (@production@/@development@/@test@).
326 131 Etienne Massip
327
+Important+ : don't forget to restart the application after any change.
328
329 130 Etienne Massip
h3. Email / SMTP server settings
330
331 132 Etienne Massip
Email configuration is described in a [[EmailConfiguration|dedicated page]].
332 1 Jean-Philippe Lang
333
h3. SCM settings
334
335 133 Etienne Massip
This configuration section allows you to:
336 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)
337
* specify the full path to the binary
338
339 133 Etienne Massip
Examples (with Subversion):
340 131 Etienne Massip
341 133 Etienne Massip
Command name override:
342 131 Etienne Massip
343
 scm_subversion_command: "svn_replacement.exe"
344
345 133 Etienne Massip
Absolute path:
346 1 Jean-Philippe Lang
347
 scm_subversion_command: "C:\Program Files\Subversion\bin\svn.exe"
348
349
h3. Attachment storage settings
350
351 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.
352
353
Examples:
354
355
 attachments_storage_path: /var/redmine/files
356
357
 attachments_storage_path: D:/redmine/files
358 130 Etienne Massip
359
h2. Logging configuration
360
361 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.
362 21 Jean-Philippe Lang
363
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@.
364 123 Jean-Philippe Lang
<pre><code class="ruby">
365 21 Jean-Philippe Lang
#Logger.new(PATH,NUM_FILES_TO_ROTATE,FILE_SIZE)
366 162 Jean-Philippe Lang
config.logger = Logger.new('/path/to/logfile.log', 2, 1000000)
367 11 Jean-Philippe Lang
config.logger.level = Logger::INFO
368
</code></pre>
369
370
h2. Backups
371
372
Redmine backups should include:
373
* data (stored in your redmine database)
374
* attachments (stored in the @files@ directory of your Redmine install)
375
376
Here is a simple shell script that can be used for daily backups (assuming you're using a mysql database):
377
378
<pre>
379
# Database
380 55 Lukasz Slonina
/usr/bin/mysqldump -u <username> -p<password> <redmine_database> | gzip > /path/to/backup/db/redmine_`date +%y_%m_%d`.gz
381 11 Jean-Philippe Lang
382
# Attachments
383 1 Jean-Philippe Lang
rsync -a /path/to/redmine/files /path/to/backup/files
384
</pre>
385 69 Giuliano Simoncelli
386
h2. Notes on Windows installation
387
388 156 Etienne Massip
There is an prebuilt installer of Ruby MRI available from http://rubyinstaller.org.
389
After installing it, select _Start Command Prompt with Ruby_ in the start menu.
390 1 Jean-Philippe Lang
391 156 Etienne Massip
+Specifying the @RAILS_ENV@ environment variable:+
392 69 Giuliano Simoncelli
393 156 Etienne Massip
When running command as described in this guide, you have to set the @RAILS_ENV@ environment variable using a separate command.
394 1 Jean-Philippe Lang
395 156 Etienne Massip
I.e. commands with the following syntaxes:
396 69 Giuliano Simoncelli
397 156 Etienne Massip
<pre>RAILS_ENV=production <any commmand></pre>
398 69 Giuliano Simoncelli
399 156 Etienne Massip
<pre><any commmand> RAILS_ENV=production</pre>
400 1 Jean-Philippe Lang
401 156 Etienne Massip
have to be turned into 2 subsequent commands:
402 69 Giuliano Simoncelli
403 156 Etienne Massip
<pre>set RAILS_ENV=production
404
<any commmand></pre>
405
406
+MySQL gem installation issue:+
407
408
You may need to manually install the mysql gem using the following command:
409
410 69 Giuliano Simoncelli
<pre>
411
gem install mysql
412
</pre>
413 1 Jean-Philippe Lang
414 156 Etienne Massip
And in some case it is required to copy the _libmysql.dll_ file in your ruby/bin directory.
415
Not all libmysql.dll are ok this seem to works http://instantrails.rubyforge.org/svn/trunk/InstantRails-win/InstantRails/mysql/bin/libmySQL.dll.
416
417 186 Jan Niggemann (redmine.org team member)
*Important note for Win7 and later*
418
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)@".
419
You can confirm this by pinging @localhost@, if ping targets "::1:" IPV6 is being used.
420
421
+Workaround:+
422
Replace @localhost@ with @127.0.0.1@ in database.yml.
423
424
fn1. http://serverfault.com/questions/4689/windows-7-localhost-name-resolution-is-handled-within-dns-itself-why
425
426
fn2. http://www.victor-ratajczyk.com/post/2012/02/25/mysql-fails-to-resolve-localhost-disable-ipv6-on-windows.aspx
427
428
fn3. https://github.com/brianmario/mysql2/issues/279
429
430 80 Jean-Philippe Lang
431
h2. Alternative to manual installation
432
433
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.