Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 24

John Hogenmiller, 2011-02-14 21:09
added notes for the newer redmine provided by PPA

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