Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 41

Lee Butler, 2013-01-09 06:57

1 41 Lee Butler
h1. Step-by-step for Ubuntu 12.04
2
3
[[HowTo_Install_Redmine_on_Ubuntu_step_by_step|A step-by-step guide]] to getting Redmine running on a fresh installation of Ubuntu.
4
5 36 Anonymous
h1. Ubuntu 10.04 or 12.04 using Passenger
6
7
The installation assumes that the web server and database are already in place, so you probably want to install the LAMP stack first if you don't already have it:
8
9
> $ sudo tasksel install lamp-server
10
11
You will also need to install the Passenger apache module.
12
13
> $ sudo apt-get install libapache2-mod-passenger
14
15
Also, the default AppArmor configuration can get in the way, so you may need to set the mysqld profile to complain:
16
17
> $ sudo aa-complain /usr/sbin/mysqld
18
19
h2. Installing Redmine 0.9.3 (Ubuntu 10.04) or Redmine 1.3.2 (Ubuntu 12.04)
20
21
As of 10.04 and 12.04, Redmine is available through Ubuntu's package manager, and installation is simple:
22
23 38 Yu Kobayashi
> $ sudo apt-get install redmine redmine-mysql
24 36 Anonymous
25
The second package, _redmine-mysql_, can be replaced by either _redmine-pgsql_ or _redmine-sqlite_ if you want to use either of those databases.
26
27
The installation process should prompt you for all the interesting details.
28
29
Redmine will now be installed in @/usr/share/redmine@ and @/etc/redmine@
30
31
h2. Installing the latest Redmine
32
33
The package with Ubuntu 10.04 is stuck in the 0.9.x branch and Ubuntu 12.04 is stuck in the 1.3.x branch. A PPA exists that has the latest branch here: https://launchpad.net/~ondrej/+archive/redmine
34
35
To install redmine using the PPA:
36
37 38 Yu Kobayashi
> $ sudo add-apt-repository ppa:ondrej/redmine
38
> $ sudo apt-get update
39
> $ sudo apt-get install redmine redmine-mysql
40 36 Anonymous
41
Note: If your server is behind a firewall, you will need to export your firewall settings before running @add-apt-repository@. Otherwise, the command will hang.
42
Run the following <pre>export http_proxy="http://proxy.your.server:port" and export https_proxy="http:proxy.your.server:port".</pre>
43
44
h2. Configuration
45
46
Symlink @/usr/share/redmine/public@ to your desired web-accessible location. E.g.:
47
48
> $ sudo ln -s /usr/share/redmine/public /var/www/redmine
49
50
By default, passenger runs as 'nobody', so you'll need to fix that. In @/etc/apache2/mods-available/passenger.conf@, add:
51
52 38 Yu Kobayashi
<pre>PassengerDefaultUser www-data</pre>
53 36 Anonymous
54
You'll also need to configure the @/var/www/redmine@ location in @/etc/apache2/sites-available/default@ by adding:
55
56
<pre><Directory /var/www/redmine>
57
RailsBaseURI /redmine
58
PassengerResolveSymlinksInDocumentRoot on
59
</Directory>
60
</pre>
61
62
If you set your AppArmor mysqld profile to complain you ought to set it back to enforce:
63
64
> $ sudo aa-enforce /usr/sbin/mysqld
65
66
Enable passenger:
67
68
> $ sudo a2enmod passenger
69
70
Restart apache2
71
72
> $ sudo service apache2 restart
73
74
and you should be able to access Redmine at: http://redmine.server.ip.address/redmine
75
76
If you receive a "403: Forbidden" error after setting up Redmine, the Redmine 'public' folder may have incorrect permissions set. The executable bit on the public folder must be enabled or you will receive a "403: Forbidden" error when attempting to access Redmine.
77
78
> $ sudo chmod a+x /usr/share/redmine/public
79
80
h1. Ubuntu 10.04 or 12.04 using WEBrick
81
82
Using Passenger is recommended for the heavy load server. But WEBrick uses less memory.
83
84 39 Yu Kobayashi
Install Redmine: (See also _Installing the latest Redmine_ above)
85 38 Yu Kobayashi
86
> $ sudo apt-get install redmine redmine-mysql
87 36 Anonymous
88
Then, create this for /etc/init/redmine.conf
89
90
<pre>
91
# Redmine
92
93
description "Redmine"
94
95
start on runlevel [2345]
96
stop on runlevel [!2345]
97
98
expect daemon
99
exec ruby /usr/share/redmine/script/server webrick -e production -b 0.0.0.0 -d
100
</pre>
101
102
You can start Redmine by this. You can access by http://example.com:3000/
103
104
> $ sudo service redmine start
105
106
You can stop by this.
107
108
> $ sudo service redmine stop
109
110
h1. Ubuntu 10.04 using mod_cgi
111
112
The installation assumes that the web server and database are already in place, so you probably want to install the LAMP stack first if you don't already have it:
113
114
> $ sudo tasksel install lamp-server
115
116
Also, the default AppArmor configuration can get in the way, so you may need to set the mysqld profile to complain:
117
118
> $ sudo aa-complain /usr/sbin/mysqld
119
120
As of 10.04, Redmine is available through Ubuntu's package manager, and installation is simple:
121
122
> $ sudo apt-get install redmine redmine-mysql subversion
123
124
The second package, _redmine-mysql_, can be replaced by either _redmine-pgsql_ or _redmine-sqlite_ if you want to use either of those databases.
125
126
The installation process should prompt you for all the interesting details.
127
128
Redmine will now be installed in @/usr/share/redmine@ and @/etc/redmine@
129
130
If you set your AppArmor mysqld profile to complain you ought to set it back to enforce:
131
132
> $ sudo aa-enforce /usr/sbin/mysqld
133
134
h2. Configuration
135
136
> *Using Ubuntu Server 10.04.1, configuring Redmine via mod_cgi as described in this section does not seem to work. If you can successfully make this work, please update these instructions! Otherwise follow the instructions in the next section for installing on Ubuntu 10.04 using Passenger or WEBrick if mod_cgi does not work for you.*
137
138
Symlink @/usr/share/redmine/public@ to your desired web-accessible location. E.g.:
139
140
> $ sudo ln -s /usr/share/redmine/public /var/www/redmine
141
142
The other files that you need to modify/create are as follows:
143
144
@/etc/redmine/default/database.yml@:
145
146
<pre>
147
production:
148
adapter: mysql
149
database: redmine
150
host: localhost
151
username: redmine
152
password: pa55w0rd
153
encoding: utf8
154
</pre>
155
156
@/usr/share/redmine/public/dispatch.cgi@:
157
158
<pre>
159
#!/usr/bin/ruby
160
161
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
162
163
require "dispatcher"
164
165
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
166
Dispatcher.dispatch
167
</pre>
168
169
@/usr/share/redmine/public/.htaccess@:
170
171
<pre>
172
RewriteEngine On
173
RewriteBase /redmine
174
RewriteRule ^$ index.html [QSA]
175
RewriteRule ^([^.]+)$ $1.html [QSA]
176
RewriteCond %{REQUEST_FILENAME} !-f
177
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
178
</pre>
179
180
And that's it! If these instructions didn't work for you, please expand them to include whatever is needed.
181
182
h1. Redmine Installation on Virtual or Normal Ubuntu < 10.04
183
184
This page is a guide to installing Redmine on either a virtual or actual installation of the Ubuntu operating system. If you follow all instructions correctly you will have installed your Redmine server successfully in almost an hour.
185
186
h2. Step 1: Install Ubuntu
187
188
If you are installing on a non-virtual Ubuntu instance, please skip this section.
189
190
*Installing VirtualBox:*
191
192
1.Download the latest version of Sun VirtualBox (version 3.0.10 or newer).
193
2.Install VirtualBox by following the instructions.
194
195
*Installing Ubuntu on VirtualBox:*
196
197
1.Download the latest version of Ubuntu (version 9.10 or newer).
198
2.After installing VirtualBox you will create a new virtual operating which will be Linux type and Ubuntu subtype. If you don't know anything about VirtualBox and/or its usage please refer to Google.
199
200
3.While installing Ubuntu you should enter the following configuration:
201
(This suggested configuration is optional, you can enter any names you want.)
202
Q: What is your name? A: Redmine Server
203
Q: What name do you want to use to login? A: redmine
204
Q: Choose to password to keep your account safe? A: redmine
205
Q: What is the name of this computer? A: redmine-server
206
Choose “Log in automatically.” radio button.
207
208
4.When you've finished the installation, open up your new VirtualBox Ubuntu OS and open up a terminal (console) screen and issue these commands:
209
> sudo apt-get update
210
> sudo apt-get upgrade
211
212
*Configuring VirtualBox:*
213
214
1.If you want to reach your VirtualBox Ubuntu OS from a different machine, you have to configure VirtualBox Ubuntu OS's network settings to Bridged Adapter. So you can reach your VirtualBox Ubuntu from an internal IP address easily. Because it get's the same IP block as you from DHCP easily. I mean your guest and host computer is same IP block as different network client.
215
216
2.If you had assigned a static IP to your Network Consult by giving your static ethernet MAC address, you have to assign the unique MAC address your VirtualBox Ubuntu OS by Setting->Network->MAC address initialization box. By this MAC address, you can get a static IP easily or you can configure your Ubuntu system to not use DHCP, instead of that you can assign a static IP manually.
217
218
h2. Step 2: Install Redmine
219
220
Once you have a functioning Ubuntu operating system up and running, you can continue with installing Redmine.
221
222
h3. Install dependencies
223
224
The following packages are required to install and run Redmine. Please install them by running @apt-get@ as root:
225
226
>sudo apt-get install package-name
227
228
where @package-name@ is each of:
229
* apache2
230
* apache2-threaded-dev
231
* build-essential
232
* libapache-dbi-perl
233
* libapache2-mod-perl2
234
* libapache2-svn
235
* libdigest-sha1-perl
236
* libgemplugin-ruby
237
* libgemplugin-ruby1.8
238
* libruby-extras
239
* libruby1.8-extras
240
* mongrel
241
* mysql-server
242
* rails
243
* rake
244
* ruby
245
* rubygems
246
* rubygems1.8
247
* ruby1.8-dev
248
* subversion
249
250
_(Could someone please clean up this list?)_
251
252
h3. Package Installation and Setup
253
254
1.Once you’ve installed the VirtualBox Ubuntu OS and updated it, you need to install a bunch of packages that we will prepare the server for the Redmine installation. So, as root, install the following packages by issuing:
255
> sudo apt-get install
256
> sudo apt-get install
257
(_Surely some missing package names above?_)
258
259
The packages we’re installing above are MySQL, phpMyAdmin, Rails, Ruby Gems, Mongrel and Ruby Dev environment.
260
During the installation of the packages, when MySQL is installed, it will prompt you to create a password. Make sure you remember it. You will need it later to log in to phpMyAdmin. To make things simple you can set all passwords to “redmine”.
261
262
2.Create a new directory for Redmine. I put mine in /opt/redmine. And download the latest version of Redmine in to it with the wget command line downloader and extract it by issuing:
263
> sudo mkdir /opt/redmine
264
> sudo cd /opt/redmine
265
> sudo wget http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz
266
> tar -xvf redmine-0.8.6.tar.gz
267
268
h3. Database Setup
269
270
1.Now it’s time to create an empty database for Redmine. As you may have noticed, we installed phpMyAdmin earlier. phpMyAdmin will come in handy now. Head over to http://localhost/phpmyadmin. You should be presented with the phpMyAdmin login screen.
271
Type in “root” and the MySQL “password” you created when installing MySQL.
272
273
2.First, click on “Databases” then, at the bottom of the screen, in the “Create new database” text box create a new database called “redmine” and set “Collation” to “utf8_general_ci”.
274
275
3.Now, go back to the home screen and click on:
276
“Privileges”
277
“Add a new User”
278
Fill out the “Login Information” boxes. Call your user “redmine”. Make sure you remember password you create here. It will be used when you set up the database connection details in Redmine.
279
In the “Database for user” section, check “Create database with same name and grant all privileges” and click on the “Go” button.
280
281
4.Log out of phpMyAdmin.
282
283
h3. Redmine Database Connection Configuration
284
285
1.It’s time to configure the database connection. If you installed Redmine as I did above, then copy “config/database.yml.example” to “config/database.yml” and edit this file in order to configure your database settings for “production” environment. You’ll find the “database.yml.example” issuing:
286
> sudo cd /opt/redmine/redmine-0.8.6/config
287
288
2.So now, assuming you’re in the “/opt/redmine/redmine-0.8.6/config” directory, issue:
289
> sudo cp database.yml.example database.yml
290
291
3.Then, open the “database.yml” file, issue:
292
> sudo gedit database.yml
293
… and edit it as in the example for a MySQL database below:
294
295
production:
296
adapter: mysql
297
socket: /var/run/mysqld/mysqld.sock
298
database: redmine
299
host: localhost
300
username: redmine
301
password: [password]
302
303
Then save the “database.yml” file and exit to the command prompt.
304
On Ubuntu the “mysql.sock” is located in /var/run/mysqld/mysqld.sock, as noted in the “config” above.
305
(The standard Redmine installation assumes the socket is located in “/opt/redmine/redmine-0.8.6/tmp/mysqld.sock”.)
306
307
4.Create the database structure, by running the following command under the application root directory (I mean “/opt/redmine/redmine-0.8.6”):
308
> sudo rake db:migrate RAILS_ENV="production"
309
It will create the necessary tables in the redmine database you created earlier and an administrator account.
310
311
5.Insert the default configuration data in to the database, by issuing:
312
> sudo rake redmine:load_default_data RAILS_ENV="production"
313
(This step is optional but highly recommended, as you can define your own configuration from scratch. It will load default roles, trackers, statuses, work flows and enumerations. While loading default data command prompt wants to given language selection by you.)
314
315
h3. Setting up Permissions
316
317
1.The user who runs Redmine must have write permission on the following sub directories: “files”, “log”, “tmp” (create the last one if not present). You probably already have a “tmp” directory in /opt/redmine/redmine-0.8.6, but if you don’t, create one now by issuing:
318
> sudo mkdir /opt/redmine/redmine-0.8.6
319
320
2.If you haven’t created a Redmine user, do it now by issuing:
321
> sudo useradd redmine
322
323
3.Now, assuming you run Redmine with a redmine user, from your /opt/redmine/redmine-0.8.6 directory issue:
324
> sudo chown -R redmine:redmine files log tmp
325
> sudo chmod -R 755 files log tmp
326
327
h3. Testing the Installation
328
329
1.It should all be working now. Test the installation by running the WEBrick web server issue:
330
> sudo cd /opt/redmine/redmine-0.8.6
331
> sudo ruby script/server -e production
332
333
Once WEBrick has started, point your browser to http://localhost:3000/. Or, if you are using a browser on a computer other than the one you installed Redmine on, point your browser to http://192.168.1.10:3000/ (if that’s the IP address you gave your Redmine server). You should now see the application welcome page.
334
335
*Log in:*
336
337
1.Use default administrator account to log in:
338
Login : admin
339
Password : admin
340
341
2.You can go to Admin & Settings to modify application settings.
342
343
h3. Setting Up Static IP
344
345
1.An easier method for configuring a static IP address is to use your local DHCP server to assign a permanent IP to the VirtualBox OS mac address. That way you will not have to do anything inside VBS. Consult your network administrator.
346
347
2.Or you should determine the configuration parameters given below, and then you can configure your system to have a static IP address:
348
The desired IP address
349
Network mask and broadcast address
350
Gateway address
351
Your local DNS server address(es)
352
353
h3. Assigning Host Name and Domain for VirtualBox OS
354
355
1.An easier method for adding your IP address - Host name pair configuration to your DNS server . Consult your network administrator.
356
357
h2. Configuring the Passenger Apache module
358
359
Passenger is a module for apache2 that allows Apache to run Ruby on Rails applications. Install it thus:
360
361
>$ sudo gem install passenger
362
363
Then go to the passenger apache2 module installation directory and run @passenger-install-apache2-module@
364
365
> $ cd /var/lib/gems/1.X/gems/passenger-X.X.X/
366
367
> $ sudo bin/passenger-install-apache2-module
368
369
Next, configure Apache:
370
371
In /etc/apache2/mods-available/passenger.load we will add next line
372
373
> LoadModule passenger_module /var/lib/gems/1.X/gems/passenger-X.X.X/ext/apache2/mod_passenger.so
374
375
We have to edit the conf of the passenger apache2 module in /etc/apache2/mods-available/passenger.conf
376
377
> PassengerRoot /var/lib/gems/1.X/gems/passenger-X.X.X
378
> PassengerRuby /usr/bin/ruby1.X
379
380
And now we activate the module
381
382
> $ sudo a2enmod passenger
383
384
Apache virtualhost for redmine web app
385
386
<pre>
387
<VirtualHost *:80>
388
ServerName redmine.server.com
389
390
DocumentRoot /var/www/redmine/public
391
392
ServerAdmin user@server.com
393
LogLevel warn
394
ErrorLog /var/log/apache2/redmine_error
395
CustomLog /var/log/apache2/redmine_access combined
396
397
<Directory /var/www/redmine/public>
398
Options Indexes FollowSymLinks MultiViews
399
AllowOverride None
400
Order allow,deny
401
allow from all
402
</Directory>
403
</VirtualHost>
404
</pre>
405
406
subversion server config in apache
407
408
<pre>
409
<VirtualHost *:80>
410
ServerName svn.server.com
411
ServerAdmin user@server.com
412
ErrorLog /var/log/apache2/svn_error
413
CustomLog /var/log/apache2/svn_access combined
414
<Location /project>
415
DAV svn
416
SVNPath /var/lib/svn/project
417
418
AuthType Basic
419
AuthName "Trac system for Server projects"
420
AuthUserFile "/var/lib/svn/.htpasswd"
421
Require valid-user
422
<LimitExcept GET PROPFIND OPTIONS REPORT>
423
Require valid-user
424
</LimitExcept>
425
</Location>
426
</Virtualhost>
427
</pre>
428
429
h2. Sendmail Server Configuration
430
431
1.Before configuring email support for Redmine, we should download the sendmail application for Ubuntu, issue:
432
433
> sudo apt-get install sendmail
434
435
> sudo sendmailconfig
436
437
(Answer Yes to all questions which you will be asked)
438
439
2.It’s time to configure the server connection. Copy “config/email.yml.example” to “config/email.yml” and edit this file in order to configure your database settings for “production” environment. You’ll find the “email.yml.example” issue:
440
> sudo cd /opt/redmine/redmine-0.8.6/config
441
442 37 João Lencart e Silva
443
444 36 Anonymous
3.So now, assuming you’re in the “/config” directory, issue:
445
> sudo cp email.yml.example email.yml
446
447
4.Then, open the “email.yml” file, issue:
448
> sudo gedit email.yml
449
… and edit it as in the example for sendmail configuration below:
450
451
production:
452
delivery_method: :sendmail
453
sendmail_settings:
454
location: /usr/sbin/sendmail
455
arguments: -i -t
456
address: smtp.example.net
457
port: 25
458
domain: example.net
459
authentication: :none
460
user_name: redmine@example.net
461
password: redmine
462
463
Then save “email.yml” file and exit to the command prompt.
464
465
5.It’s time to configure the “environmet.rb” configuration. Open up the “environment.rb” and change “config.action_mailer.perform_deliveries = false” to “config.action_mailer.perform_deliveries = true” then save and close the “environment.rb”.
466 37 João Lencart e Silva
467
h2. Email configuration for Ubuntu 12.04 with redmine >v1.4.3
468
469
1. Instead of creating an email.yml, edit config/configuration.yml and add a section
470
<pre>
471
production:
472
   email_delivery:
473
     delivery_method: :smtp
474
...</pre>
475
476
or
477
478
<pre>production:
479
   email_delivery:
480
     delivery_method: :sendmail
481
...</pre>
482
483
Please see http://www.redmine.org/projects/redmine/wiki/EmailConfiguration for the correct format of the full email block.
484
485
2. **DO NOT CHANGE** environment.rb config.action_mailer.perform_deliveries. The correct way is changing configuration.yml and leaving the default config.action_mailer.perform_deliveries setting to false:
486
@config.action_mailer.perform_deliveries = false@
487
488
489
490
491 36 Anonymous
492
h2. Subversion Installation and Configuration
493
494
1.Before configuring Subversion support for Redmine, we should download the Subversion application for Ubuntu, issue:
495
> sudo apt-get install subversion
496
497
2.If your Redmine can't find the “subversion” command you can help to find by issuing:
498
· > sudo cd /opt/redmine/redmine-0.8.6/config
499
· > sudo gedit environment.rb
500
· Add ENV['PATH'] = "#{ENV['PATH']}:/subversion/path" line in it.
501
· Save and close the “environment.rb”
502
503
h2. Start Application at Boot Time
504
505
1.To automatically start the application on booting your server you need to modify your “crontab”, issue:
506
> export EDITOR=gedit
507
> crontab -e
508
509
2.Your “crontab” file will be presented. This is the list of programs that start at certain times or at boot. Add the following to the “crontab” (all on one line):
510
@reboot cd /opt/redmine/redmine-0.8.6 ; rm -f log/mongrel.pid ; mongrel_rails start -e production -p 3000 -d
511
512
h2. Backup
513
514
1.Running backups is always a good idea. Redmine backups should include:
515
* data (stored in your redmine database)
516
/usr/bin/mysqldump -u -p | gzip > /path/to/redmine/backup/db/redmine_`date +%y_%m_%d`.gz
517
* attachments (stored in the files directory of your Redmine install)
518
rsync -a /path/to/redmine/files /path/to/redmine/backup/files
519
520
2.Or you can use the bash shell to automate this kind of operation, issue:
521
> sudo cd /opt/redmine/redmine-0.8.6
522
> sudo mkdir backup
523
> sudo mkdir backup/db
524
> sudo mkdir backup/files
525
> sudo gedit backup/runRedmineBackup.bash
526
527
And after open “runRedmineBackup.bash” with gedit, write all commands below:
528
<pre>
529
#!/bin/bash
530
data=`date -I`
531
mysqldump --user=root --password="redmine" --all-databases | gzip > db/backup-$data.sql.gz
532
cd db
533
ftp -i -n << EOF
534
open ftpserver.example.net
535
user username password
536
bin
537
mput backup-$data.sql.gz
538
bye
539
EOF
540
</pre>
541
Then save the “runRedmineBackup.bash” file and exit to the command prompt. After creation of runRedmineBackup.bash you can add this bash script to run continually between specified periods. Issue:
542
543
> export EDITOR=gedit
544
> crontab -e
545
Add 0 0 * * 0 cd /opt/redmine/redmine-0.8.6/backup ; sh runRedmineBackup.bash commands to crontab to backup database weekly.
546
547
For this to work without any permission problems you have to change the permissions of the files to maximum, issue:
548
549
> sudo chmod -R 777 backup
550
> sudo chown -R redmine:redmine backup
551
552
That's all. Now we have completely installed Redmine on our virtual Ubuntu OS and can reach it from any machine in our network easily. Congratulations..!
553
554
h2. Sources & contributors.
555
556
* Ümit Uzun 06/11/2009.
557
* Some of the above material comes from Macada's wiki, licenced under the GNU Free Documentation License 1.2. See "Redmine in Ubuntu Jaunty 9.04":http://wiki.ousli.org/index.php/Redmine_in_Ubuntu_Jaunty_9.04 by David 'macada', last modified 2010-02-08, accessed 2010-05-26.
558
* Sam Wilson 2010-05-26, formatting changes.
559
* Allen Yeh 2010-09-08, Added apt-get install subversion into instructions for 10.04 otherwise once redmine is setup an error like this will result this error -> +*The entry or revision was not found in the repository.*+
560
561
h2. Additional Sources
562
563 40 Mohd Shakir Zakaria
* http://docs.oseems.com/general/web/redmine/install-in-ubuntu