Project

General

Profile

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

Dietmar H, 2013-01-16 16:59
added toc

1 1 Lee Butler
h1. HowTo Install Redmine on Ubuntu step by step
2
3 17 Dietmar H
{{>toc}}
4
5 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.
6
7 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.
8 1 Lee Butler
9 3 Lee Butler
h2. Prerequisites:  Apache, mod-passenger, and MySQL
10 1 Lee Butler
11 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.
12
<pre>$ sudo apt-get install apache2 libapache2-mod-passenger</pre>
13 1 Lee Butler
14 3 Lee Butler
Installing mysql takes just a little more, so the details are spelled out.
15
16
<pre>$ sudo apt-get install mysql-server mysql-client </pre>
17
18 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.
19
20
<pre>Package configuration                                                           
21
22
  ┌────────────────────┤ Configuring mysql-server-5.5 ├─────────────────────┐   
23
  │ While not mandatory, it is highly recommended that you set a password   │   
24
  │ for the MySQL administrative "root" user.                               │   
25
  │                                                                         │   
26
  │ If this field is left blank, the password will not be changed.          │   
27
  │                                                                         │   
28
  │ New password for the MySQL "root" user:                                 │   
29
  │                                                                         │   
30
  │ _______________________________________________________________________ │   
31
  │                                                                         │   
32
  │                                 <Ok>                                    │   
33
  │                                                                         │   
34
  └─────────────────────────────────────────────────────────────────────────┘   
35
</pre>
36
<pre>
37
  ┌────┤ Configuring mysql-server-5.5 ├──────────┐
38
  │                                              │
39
  │ Repeat password for the MySQL "root" user.   │
40
  │                                              │
41
  │                                              │
42
  │ ____________________________________________ │
43
  │                                              │
44
  │                   <Ok>                       │
45
  │                                              │
46
  └──────────────────────────────────────────────┘
47
</pre>
48
49 3 Lee Butler
h2. Installing and configuring the Ubuntu Redmine package
50
51 2 Lee Butler
p. Now it is time to install redmine itself.  
52
<pre>
53 1 Lee Butler
$ sudo apt-get install redmine redmine-mysql
54
</pre>
55
56
57
p. You want to allow dbconfig-common to configure the database when prompted so select *Yes* from the prompt in the panel below.
58
<pre>
59
Package configuration                                                           
60
                                                                                
61
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
62
 │                                                                           │  
63
 │ The redmine/instances/default package must have a database installed and  │  
64
 │ configured before it can be used.  This can be optionally handled with    │  
65
 │ dbconfig-common.                                                          │  
66
 │                                                                           │  
67
 │ If you are an advanced database administrator and know that you want to   │  
68
 │ perform this configuration manually, or if your database has already      │  
69
 │ been installed and configured, you should refuse this option.  Details    │  
70
 │ on what needs to be done should most likely be provided in                │  
71
 │ /usr/share/doc/redmine/instances/default.                                 │  
72
 │                                                                           │  
73
 │ Otherwise, you should probably choose this option.                        │  
74
 │                                                                           │  
75
 │ Configure database for redmine/instances/default with dbconfig-common?    │  
76
 │                                                                           │  
77
 │                    <Yes>                       <No>                       │  
78
 │                                                                           │  
79
 └───────────────────────────────────────────────────────────────────────────┘  
80
</pre>
81
82
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.
83
84
<pre>
85
Package configuration                                                           
86
                                                                                
87
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
88
 │ Please provide the password for hte administrative account with which     │  
89
 │ this package should create its MySQL database and user.                   │  
90
 │                                                                           │  
91
 │ Password of the database's administrative user:                           │  
92
 │                                                                           │  
93
 │ ******__________________________________________________________________  │  
94
 │                                                                           │  
95
 │                   <Ok>                       <Cancel>                     │  
96
 │                                                                           │  
97
 └───────────────────────────────────────────────────────────────────────────┘  
98
</pre>
99
100
p. Tell the redmine installer we are using mysql for this installation by highlighting "mysql" from the list of database choices:
101
102
<pre>
103
Package configuration                                                           
104
                                                                                
105
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
106
 │ The redmine/instances/default package can be configured to use one of     │  
107
 │ several database types. Below, you will be presented with the available   │  
108
 │ choices.                                                                  │  
109
 │                                                                           │  
110
 │ Database type to be used by redmine/instances/default:                    │  
111
 │                                                                           │  
112
 │                                  sqlite3                                  │  
113
 │                                  pgsql                                    │  
114
 │                                  mysql                                    │  
115
 │                                                                           │  
116
 │                                                                           │  
117
 │                    <Ok>                        <Cancel>                   │  
118
 │                                                                           │  
119
 └───────────────────────────────────────────────────────────────────────────┘  
120
</pre>
121
122
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.
123
124
<pre>
125
Package configuration                                                           
126
127
 ┌──────────────────────────┤ Configuring redmine ├──────────────────────────┐  
128
 │ Please provide a password for redmine/instances/default to register with  │  
129
 │ the database server.  If left blank, a random password will be            │  
130
 │ generated.                                                                │  
131
 │                                                                           │  
132
 │ MySQL application password for redmine/instances/default:                 │  
133
 │                                                                           │  
134
 │ *******__________________________________________________________________ │  
135
 │                                                                           │  
136
 │                    <Ok>                        <Cancel>                   │  
137
 │                                                                           │  
138
 └───────────────────────────────────────────────────────────────────────────┘ 
139
</pre>
140
141
Now confirm the redmine password.
142
143
<pre>
144
Package configuration                                                           
145
                                                                                
146
   ┌────┤ Configuring redmine ├─────┐                       
147
   │                                │                       
148
   │                                │                       
149
   │ Password confirmation:         │                       
150
   │                                │                       
151
   │ *******_______________________ │                       
152
   │                                │                       
153
   │     <Ok>         <Cancel>      │                       
154
   │                                │                       
155
   └────────────────────────────────┘   
156
</pre>
157
158 3 Lee Butler
h2. Configuring Apache
159
160 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:
161
<pre>
162
<IfModule mod_passenger.c>
163
  PassengerDefaultUser www-data
164
  PassengerRoot /usr
165
  PassengerRuby /usr/bin/ruby
166
</IfModule>
167
</pre>
168
169
Now create a symlink to connect Redmine into the web document space:
170
<pre>
171
$ sudo ln -s /usr/share/redmine/public /var/www/redmine
172
</pre>
173
174
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:
175
<pre>
176
<Directory /var/www/redmine>
177
	RailsBaseURI /redmine
178
	PassengerResolveSymlinksInDocumentRoot on
179
</Directory>
180
</pre>
181
182
Now restart apache:
183
<pre>
184
$ sudo service apache2 restart
185
</pre>
186
187
p. You should now be able to access redmine from the local host
188
<pre>$ firefox http://127.0.0.1/redmine
189
</pre>
190
191
192
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.
193
194
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.
195 3 Lee Butler
196 4 Lee Butler
197 5 Lee Butler
h2. Backing up Redmine
198 4 Lee Butler
199 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:
200
<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.
201 1 Lee Butler
202 14 Lee Butler
p. The attachments are stashed in /var/lib/redmine/default/files and can be backed up with something like:
203
<pre>rsync -a /var/lib/redmine/default/files /path/to/backups/files</pre>
204 13 Lee Butler
205 14 Lee Butler
p. You can have these commands run automatically by creating a script called /etc/cron.daily/redmine that contains:
206
<pre>#!/bin/sh
207 4 Lee Butler
/usr/bin/mysqldump -u root -p<password> redmine_default | gzip > /path/to/backups/redmine_db_`date +%y_%m_%d`.gz
208 14 Lee Butler
rsync -a /var/lib/redmine/default/files /path/to/backups/files</pre>
209 13 Lee Butler
210 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.
211 14 Lee Butler
212 16 Lee Butler
h1. Additional semi-optional packages
213 3 Lee Butler
214
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.
215
216 16 Lee Butler
h2. Email setup
217 3 Lee Butler
218 10 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 *exim4* package.  There is a good description of this "here":https://help.ubuntu.com/12.04/installation-guide/i386/mail-setup.html.  Unless everyone has an email account on the redmine server you will want to set up external email either as a full internet host, or with a "smarthost" that relays mail for the Redmine server.  Once email service is installed, you will have to restart apache for Redmine to know that it has access to email services.
219 3 Lee Butler
220
<pre>$ sudo apt-get install exim4
221 1 Lee Butler
$ dpkg-reconfigure exim4-config
222
</pre>
223
224 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:
225
<pre>
226
production:
227
  email_delivery:
228
    delivery_method: :sendmail
229
</pre>
230
231
Then restart apache so that Redmine reloads the configuration file:
232
233
<pre>$ sudo service apache2 restart</pre>
234
235
h2. Revision control repository setup
236 3 Lee Butler
237
p. In order to have your software repository on the system Redmine will need the corresponding software installed.  
238
239
<pre>$ sudo apt-get install git subversion cvs mercurial
240
$ sudo service apache2 restart
241
</pre>
242
243
That covers it as far as I have gotten in my use of Redmine to date.