Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 18

Glenn Gould, 2010-12-13 09:18
added additional Source to an external Redmine-Ubuntu Installation Howto

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