Project

General

Profile

HowTo Install Redmine on Ubuntu step by step » History » Version 21

Anonymous, 2014-02-26 08:53

1 1 Lee Butler
h1. HowTo Install Redmine on Ubuntu step by step
2
3 17 Dietmar H
{{>toc}}
4
5 21 Anonymous
p. Before using or studying this guid you should check which Redmine version you are going for. Be aware that only latest stable releases will be fully compatible with current releases of plugins.
6
To check redmine versions versus your ubuntu version have a look at http://www.ubuntuupdates.org/pm/redmine
7
Generally you could also consider only installing ruby from ubuntu-repos and then heading for a release of redmine from redmine's download page: http://www.redmine.org/projects/redmine/wiki/Download 
8
9 1 Lee Butler
p. This tutorial walks you step-by-step through installing Redmine on a clean/fresh Ubuntu 12.04 installation.  This is intended to be a complete cookbook method for getting Redmine installed and running.  It makes no assumptions about other things being installed or configured.  Since I have had some issues when using the graphical package managers, we will be doing this from the command line prompt to keep things as clear and clean as possible.
10
11 6 Lee Butler
p. I recommend that you install any Ubuntu updates prior to beginning this process.  There are almost always some waiting to be applied after Ubuntu is first set up.
12 1 Lee Butler
13 3 Lee Butler
h2. Prerequisites:  Apache, mod-passenger, and MySQL
14 1 Lee Butler
15 3 Lee Butler
p. There are several support packages that we will install first.  The apache installation is pretty simple if you just follow the prompts and accept the defaults.
16
<pre>$ sudo apt-get install apache2 libapache2-mod-passenger</pre>
17 1 Lee Butler
18 3 Lee Butler
Installing mysql takes just a little more, so the details are spelled out.
19
20
<pre>$ sudo apt-get install mysql-server mysql-client </pre>
21
22 1 Lee Butler
p. The installation process for mysql is going to prompt you for a password for the "root" access for the database server, then ask you to confirm the password in a follow-up screen.  This sets the database adminstration password.
23
24
<pre>Package configuration                                                           
25
26
  ┌────────────────────┤ Configuring mysql-server-5.5 ├─────────────────────┐   
27
  │ While not mandatory, it is highly recommended that you set a password   │   
28
  │ for the MySQL administrative "root" user.                               │   
29
  │                                                                         │   
30
  │ If this field is left blank, the password will not be changed.          │   
31
  │                                                                         │   
32
  │ New password for the MySQL "root" user:                                 │   
33
  │                                                                         │   
34
  │ _______________________________________________________________________ │   
35
  │                                                                         │   
36
  │                                 <Ok>                                    │   
37
  │                                                                         │   
38
  └─────────────────────────────────────────────────────────────────────────┘   
39
</pre>
40
<pre>
41
  ┌────┤ Configuring mysql-server-5.5 ├──────────┐
42
  │                                              │
43
  │ Repeat password for the MySQL "root" user.   │
44
  │                                              │
45
  │                                              │
46
  │ ____________________________________________ │
47
  │                                              │
48
  │                   <Ok>                       │
49
  │                                              │
50
  └──────────────────────────────────────────────┘
51
</pre>
52
53 3 Lee Butler
h2. Installing and configuring the Ubuntu Redmine package
54
55 2 Lee Butler
p. Now it is time to install redmine itself.  
56
<pre>
57 1 Lee Butler
$ sudo apt-get install redmine redmine-mysql
58
</pre>
59
60
61
p. You want to allow dbconfig-common to configure the database when prompted so select *Yes* from the prompt in the panel below.
62
<pre>
63
Package configuration                                                           
64
                                                                                
65
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
66
 │                                                                           │  
67
 │ The redmine/instances/default package must have a database installed and  │  
68
 │ configured before it can be used.  This can be optionally handled with    │  
69
 │ dbconfig-common.                                                          │  
70
 │                                                                           │  
71
 │ If you are an advanced database administrator and know that you want to   │  
72
 │ perform this configuration manually, or if your database has already      │  
73
 │ been installed and configured, you should refuse this option.  Details    │  
74
 │ on what needs to be done should most likely be provided in                │  
75
 │ /usr/share/doc/redmine/instances/default.                                 │  
76
 │                                                                           │  
77
 │ Otherwise, you should probably choose this option.                        │  
78
 │                                                                           │  
79
 │ Configure database for redmine/instances/default with dbconfig-common?    │  
80
 │                                                                           │  
81
 │                    <Yes>                       <No>                       │  
82
 │                                                                           │  
83
 └───────────────────────────────────────────────────────────────────────────┘  
84
</pre>
85
86
p. Then you want to provide the "root" password for the database, so that the installer can create the redmine database.  This is the password set when you installed mysql.
87
88
<pre>
89
Package configuration                                                           
90
                                                                                
91
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
92
 │ Please provide the password for hte administrative account with which     │  
93
 │ this package should create its MySQL database and user.                   │  
94
 │                                                                           │  
95
 │ Password of the database's administrative user:                           │  
96
 │                                                                           │  
97
 │ ******__________________________________________________________________  │  
98
 │                                                                           │  
99
 │                   <Ok>                       <Cancel>                     │  
100
 │                                                                           │  
101
 └───────────────────────────────────────────────────────────────────────────┘  
102
</pre>
103
104
p. Tell the redmine installer we are using mysql for this installation by highlighting "mysql" from the list of database choices:
105
106
<pre>
107
Package configuration                                                           
108
                                                                                
109
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
110
 │ The redmine/instances/default package can be configured to use one of     │  
111
 │ several database types. Below, you will be presented with the available   │  
112
 │ choices.                                                                  │  
113
 │                                                                           │  
114
 │ Database type to be used by redmine/instances/default:                    │  
115
 │                                                                           │  
116
 │                                  sqlite3                                  │  
117
 │                                  pgsql                                    │  
118
 │                                  mysql                                    │  
119
 │                                                                           │  
120
 │                                                                           │  
121
 │                    <Ok>                        <Cancel>                   │  
122
 │                                                                           │  
123
 └───────────────────────────────────────────────────────────────────────────┘  
124
</pre>
125
126
p. Now you are asked to provide a password that will be used to protect the redmine database.  Redmine itself will use this when it wants to access mysql.
127
128
<pre>
129
Package configuration                                                           
130
131
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
132
 │ Please provide a password for redmine/instances/default to register with  │  
133
 │ the database server.  If left blank, a random password will be            │  
134
 │ generated.                                                                │  
135
 │                                                                           │  
136
 │ MySQL application password for redmine/instances/default:                 │  
137
 │                                                                           │  
138
 │ *******__________________________________________________________________ │  
139
 │                                                                           │  
140
 │                    <Ok>                        <Cancel>                   │  
141
 │                                                                           │  
142
 └───────────────────────────────────────────────────────────────────────────┘ 
143
</pre>
144
145
Now confirm the redmine password.
146
147
<pre>
148
Package configuration                                                           
149
                                                                                
150
   ┌────┤ Configuring redmine ├─────┐                       
151
   │                                │                       
152
   │                                │                       
153
   │ Password confirmation:         │                       
154
   │                                │                       
155
   │ *******_______________________ │                       
156
   │                                │                       
157
   │     <Ok>         <Cancel>      │                       
158
   │                                │                       
159
   └────────────────────────────────┘   
160
</pre>
161
162 3 Lee Butler
h2. Configuring Apache
163
164 1 Lee Butler
p. You need to modify two files for apache.  The first is /etc/apache2/mods-available/passenger.conf which needs the text *PassengerDefaultUser www-data* added as seen here:
165
<pre>
166
<IfModule mod_passenger.c>
167
  PassengerDefaultUser www-data
168
  PassengerRoot /usr
169
  PassengerRuby /usr/bin/ruby
170
</IfModule>
171
</pre>
172
173
Now create a symlink to connect Redmine into the web document space:
174
<pre>
175
$ sudo ln -s /usr/share/redmine/public /var/www/redmine
176
</pre>
177
178
p. And modify /etc/apache2/sites-available/default to insert the following with the other <Directory> sections so that apache knows to follow the symlink into Rails:
179
<pre>
180
<Directory /var/www/redmine>
181
	RailsBaseURI /redmine
182
	PassengerResolveSymlinksInDocumentRoot on
183
</Directory>
184
</pre>
185
186
Now restart apache:
187
<pre>
188
$ sudo service apache2 restart
189
</pre>
190
191
p. You should now be able to access redmine from the local host
192
<pre>$ firefox http://127.0.0.1/redmine
193
</pre>
194
195
196
p. In the upper right corner of the browser window you should see the "Sign in" link.  Click that and enter "admin" at both the *Login:* and *Password:* prompts.  Note: _this is not the password you set during the installation process_.  Click the *Login* button.
197
198
p. I recommend that the next thing you do is to click on *My account* in the upper right corner and change that password.  In the page that is displayed there should be a *Change password* link in the upper right of the white area of the page.  Click to change the password.
199 3 Lee Butler
200 4 Lee Butler
201 5 Lee Butler
h2. Backing up Redmine
202 4 Lee Butler
203 14 Lee Butler
p. You should arrange a regular backup of the Redmine database and the files that users upload/attach.  The database can be dumped to a text file with:
204
<pre>/usr/bin/mysqldump -u root -p<password> redmine_default | gzip > /path/to/backups/redmine_db_`date +%y_%m_%d`.gz</pre>where <password> is the one you set when installing mysql.
205 1 Lee Butler
206 14 Lee Butler
p. The attachments are stashed in /var/lib/redmine/default/files and can be backed up with something like:
207
<pre>rsync -a /var/lib/redmine/default/files /path/to/backups/files</pre>
208 13 Lee Butler
209 14 Lee Butler
p. You can have these commands run automatically by creating a script called /etc/cron.daily/redmine that contains:
210
<pre>#!/bin/sh
211 4 Lee Butler
/usr/bin/mysqldump -u root -p<password> redmine_default | gzip > /path/to/backups/redmine_db_`date +%y_%m_%d`.gz
212 14 Lee Butler
rsync -a /var/lib/redmine/default/files /path/to/backups/files</pre>
213 13 Lee Butler
214 15 Lee Butler
p. Again, be sure to substitute the mysql root password for <password> in the mysqldump command line.  The file should be protected so that only root has read permission because you are storing the root password for your mysql installation in this file.  That the first line creates a new file every time the script is run.  This can eventually create a large number of backups of your database files.  You should have a script that purges old ones periodically.
215 14 Lee Butler
216 16 Lee Butler
h1. Additional semi-optional packages
217 3 Lee Butler
218
There are some services that Redmine can use that are not absolutely necessary, but are useful.  These are email and software repository/revision control systems.
219
220 16 Lee Butler
h2. Email setup
221 3 Lee Butler
222 19 Lee Butler
p. At some point you will probably want Redmine to be able to send email.  For this you will need to install and configure email.  This can be achieved by installing the *postfix* package.  I do not recommend the exim4 package, as there have been some incompatibilities in the way the "sendmail" command line is handled between Redmine and exim4.  Unless everyone has an email account on the redmine server you will want to set up external email as a full internet host.  Once email service is installed, you will have to restart apache for Redmine to know that it has access to email services.
223 3 Lee Butler
224 20 Lee Butler
<pre>$ sudo apt-get install postfix</pre>
225 1 Lee Butler
226 16 Lee Butler
p. Now that you can send email, you have to tell Redmine about it.  You need to create/edit the file */etc/redmine/default/configuration.yml* and add the following lines:
227
<pre>
228
production:
229
  email_delivery:
230
    delivery_method: :sendmail
231
</pre>
232
233
Then restart apache so that Redmine reloads the configuration file:
234
235 18 Lee Butler
<pre>$ sudo service apache2 restart</pre>
236
237 16 Lee Butler
h2. Revision control repository setup
238 3 Lee Butler
239
p. In order to have your software repository on the system Redmine will need the corresponding software installed.  
240
241
<pre>$ sudo apt-get install git subversion cvs mercurial
242
$ sudo service apache2 restart
243
</pre>
244
245
That covers it as far as I have gotten in my use of Redmine to date.