Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 37

João Lencart e Silva, 2012-07-09 15:42

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