Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 10

Daniel Maas, 2010-07-09 11:16

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