Project

General

Profile

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

Lee Butler, 2013-01-12 20:16

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