Project

General

Profile

HowTo Install Redmine in Ubuntu » History » Version 3

Sam Wilson, 2010-05-31 07:56

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