Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 23

Anthony C, 2011-01-27 17:13
clarified the redmine URL after install

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