HowTo Install Redmine in Ubuntu » History » Version 69

James Wilmot, 2013-10-07 06:50
'data base' is one word

1 43 Recent Coin
h1. Step-by-step for Ubuntu 12.04  or Ubuntu 10.04 using Passenger
2 41 Lee Butler
3 41 Lee Butler
[[HowTo_Install_Redmine_on_Ubuntu_step_by_step|A step-by-step guide]] to getting Redmine running on a fresh installation of Ubuntu.
4 41 Lee Butler
5 43 Recent Coin
h2. Assumptions In This Document 
6 36 Anonymous
7 48 Recent Coin
These instructions assume that you have a basic Ubuntu server installation with command line access.  they assume that you have the rights to install a web server (Apache2) and a database (PostgreSQL or MySQL).  They also assume that you have the ability to carry out sudo commands and that you have at least a passing familiarity with the linux OS and file system.  Lines you should type in will be on their own line and will be preceded by a vertical grey bar.
8 36 Anonymous
9 43 Recent Coin
h2. Become root or be prepared to type sudo before every command.  
10 36 Anonymous
11 43 Recent Coin
You can also save yourself a lot of time if you are doing a big install/configuration job by simply becoming 'real root' instead of typing sudo before everything by typing in either of these commands;
12 36 Anonymous
13 43 Recent Coin
>sudo -s
14 1 Umit Uzun
15 43 Recent Coin
 - OR - 
16 1 Umit Uzun
17 43 Recent Coin
>sudo -i
18 1 Umit Uzun
19 43 Recent Coin
Both will ask you to supply your password again and then you will get a # prompt which shows that you are "root" and no longer have to keep typing sudo. 
20 1 Umit Uzun
21 43 Recent Coin
h2. Be sure to run your updates before you start.  
22 1 Umit Uzun
23 43 Recent Coin
Be sure to check your /etc/apt/sources.list  You will probably want to comment out the "backports" and uncomment the extras and partners.  
24 43 Recent Coin
25 43 Recent Coin
>apt-get update
26 43 Recent Coin
27 43 Recent Coin
If you get any key errors for any of the repositories, you can fix them easily.  
28 43 Recent Coin
29 43 Recent Coin
A key error will look something like this:
30 43 Recent Coin
31 43 Recent Coin
W: GPG error: http://extras.ubuntu.com quantal Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 16126D3A3E5C1192
32 43 Recent Coin
33 43 Recent Coin
>gpg --keyserver hkp://subkeys.pgp.net --recv-keys 16126D3A3E5C1192
34 43 Recent Coin
>gpg --export --armor 16126D3A3E5C1192 | sudo apt-key add - 
35 43 Recent Coin
36 43 Recent Coin
Note that the key (16126D3A3E5C1192) is the same in the error message, the key fetch request and the key import request.  What ever key you are missing can be fixed by through this process.  
37 43 Recent Coin
38 43 Recent Coin
39 43 Recent Coin
>apt-get update && apt-get dist-upgrade
40 43 Recent Coin
41 69 James Wilmot
h2. Have your web server and database installed
42 43 Recent Coin
43 43 Recent Coin
Installing Ubuntu's entire LAMP stack also installs PHP as well as the PHP connectors for apache, mysql, etc. If you are using RoR, installing all of that is probably unnecessary.  As a general rule of practice, it is best not to install anything you don't actually need.  That which isn't installed is not a potential security hole.  The statements below will install apache2 and the proper database.  
44 43 Recent Coin
45 52 Recent Coin
For MySQL: >apt-get install apache2 software-properties-common librmagick-ruby ruby-rmagick mysql-server mysql-client mysql-common 
46 52 Recent Coin
For PostgreSQL:   >apt-get install apache2 software-properties-common librmagick-ruby ruby-rmagick postgresql
47 43 Recent Coin
48 43 Recent Coin
49 69 James Wilmot
If you want to use another web server or database, that is outside the scope of this document.
50 43 Recent Coin
51 43 Recent Coin
h2. You must install mod_passenger for Apache2. 
52 43 Recent Coin
> apt-get install libapache2-mod-passenger
53 43 Recent Coin
54 43 Recent Coin
Wait for the install to complete then you must enable the module and restart Apache2.
55 43 Recent Coin
56 43 Recent Coin
>a2enmod passenger
57 43 Recent Coin
>service apache2 restart
58 43 Recent Coin
 - OR -
59 43 Recent Coin
>/etc/init.d/apache2 restart
60 43 Recent Coin
61 43 Recent Coin
Mod_passenger should now be enabled and visible to apache.
62 43 Recent Coin
63 58 Recent Coin
h2. Turn off apparmor for a bit so that it doesn't complain while we're installing everything
64 43 Recent Coin
65 43 Recent Coin
> service apparmor stop
66 43 Recent Coin
 - OR -
67 43 Recent Coin
>/etc/init.d/apparmor stop
68 43 Recent Coin
69 1 Umit Uzun
You can restart it once everything has been configured.
70 58 Recent Coin
71 58 Recent Coin
Alternatively, you can set it into "whine" mode.
72 58 Recent Coin
73 58 Recent Coin
> aa-complain /usr/sbin/mysqld
74 1 Umit Uzun
75 69 James Wilmot
h2. Create your database and your user for your redmine installation.
76 1 Umit Uzun
77 44 Recent Coin
There are a great many GUI's out there for most databases.  It is strongly recommended never to run your application as your "root" user on your database (e.g. MySQL root for MySQL or 'postgres' user for PostgreSQL).  There are also any number of tutorials on the creation of databases and granting of rights on them, so that it is really outside the scope of this document. These are pretty trivial to find on Google and if you are going to administer database driven applications its very advisable for you to become at least passingly familiar with SQL statements.
78 44 Recent Coin
79 67 Peter I
For MySQL:  <pre>CREATE 'user'@'hostname' IDENTIFIED BY 'password';  CREATE DATABASE myredminedb; GRANT ALL ON myredminedb.* TO 'user'@'hostname'; FLUSH PRIVILEGES;</pre>
80 44 Recent Coin
81 44 Recent Coin
For PostgreSQL: CREATE USER user WITH PASSWORD 'password'; CREATE DATABASE myredminedb;GRANT ALL PRIVILEGES ON DATABASE myredminedb to user;
82 44 Recent Coin
83 46 Recent Coin
NOTE for PostgreSQL Users:  You will have to set the postgres user password before you can connect remotely.  MySQL will force you to set this during the installation but Postgres does not. To so do:
84 46 Recent Coin
85 46 Recent Coin
>su - postgres
86 46 Recent Coin
>psql
87 46 Recent Coin
88 46 Recent Coin
This will take you to the postgres database prompt.  
89 46 Recent Coin
90 46 Recent Coin
>ALTER USER postgres with password 'my-secure-password';
91 46 Recent Coin
92 46 Recent Coin
This will set the password.  You can now proceed to editing the postgres configuration files so that you can connect remotely.
93 46 Recent Coin
94 44 Recent Coin
h2. Install Redmine.
95 44 Recent Coin
96 43 Recent Coin
---If you are happy with the packaged version, the you can use the packages from the Ubuntu repository.   The Ubuntu 10.04 package is stuck in the 0.9.x branch and the Ubuntu 12.04 package is stuck in the 1.3.x branch.
97 43 Recent Coin
98 43 Recent Coin
For MySQL: >apt-get install redmine redmine-mysql
99 47 Recent Coin
For PostgreSQL: >apt-get install redmine redmine-pgsql
100 49 Recent Coin
For SQLite: 
101 43 Recent Coin
102 1 Umit Uzun
103 49 Recent Coin
The PostgreSQL installation will ask for the postgres user password so that it can create its own user, password, database, etc.  
104 49 Recent Coin
105 36 Anonymous
106 36 Anonymous
The installation process should prompt you for all the interesting details.
107 36 Anonymous
108 45 Recent Coin
Redmine will now be installed in @/usr/share/redmine@ and the configuration files will be located in @/etc/redmine@
109 36 Anonymous
110 36 Anonymous
h2. Installing the latest Redmine
111 53 Recent Coin
112 51 Recent Coin
--If you are not happy with the older versions of Redmine that are in the official Ubuntu repositories (10.04 is stuck 0.9.x and 12.04 is stuck at 1.3.x while the current version is 2.2), this section is for you.  You still need to follow the steps in the other sections but this will get you the newer versions from the PPA/Launchpad here: https://launchpad.net/~ondrej/+archive/redmine
113 1 Umit Uzun
114 51 Recent Coin
*NOTE:* If your server is behind a firewall, you will need to export your firewall settings before running add-apt-repository. Otherwise, the command will hang.
115 1 Umit Uzun
116 51 Recent Coin
Run the following commands to export your proxy settings for both http (port 80) and https (port 443):
117 51 Recent Coin
>export http_proxy="http://proxy.your.server:port" 
118 51 Recent Coin
>export https_proxy="http:proxy.your.server:port"
119 1 Umit Uzun
120 1 Umit Uzun
121 51 Recent Coin
Otherwise, proceed to add the PPA to the list of repositories for your machine:
122 51 Recent Coin
123 51 Recent Coin
>add-apt-repository ppa:ondrej/redmine
124 51 Recent Coin
>apt-get update
125 51 Recent Coin
126 51 Recent Coin
127 51 Recent Coin
For MySQL: >apt-get install redmine redmine-mysql
128 51 Recent Coin
For PostgreSQL: apt-get install redmine redmine-pgsql
129 36 Anonymous
130 66 Recent Coin
h2. The Long Way Home 
131 64 Recent Coin
132 66 Recent Coin
There is now a PPA for Quantal.  As I have not gotten the manual process to work properly, I will leave it to someone else to write this section.
133 55 Recent Coin
134 54 Recent Coin
h2. Apache Configuration
135 1 Umit Uzun
136 57 Recent Coin
You have two choices.  You can install Redmine as a dedicated server where www.example.com will serve Redmine by default.  You can also install Redmine for use as a directory on another server (e.g. www.example.com/redmine).
137 1 Umit Uzun
138 57 Recent Coin
h3.  Common configuration issues
139 57 Recent Coin
By default, passenger runs as 'nobody', so you'll need to fix that. 
140 57 Recent Coin
141 57 Recent Coin
>cd /etc/apache2/mods-available
142 57 Recent Coin
143 57 Recent Coin
edit the passenger.conf by adding the line below 
144 57 Recent Coin
<pre>PassengerDefaultUser www-data</pre>
145 57 Recent Coin
146 57 Recent Coin
> cd /etc/apache2/conf.d
147 57 Recent Coin
148 57 Recent Coin
edit security
149 57 Recent Coin
Change ServerTokens OS to read ServerTokens Prod
150 57 Recent Coin
Save the file
151 57 Recent Coin
152 57 Recent Coin
153 57 Recent Coin
154 54 Recent Coin
h3. *Dedicated Server Configuration*
155 54 Recent Coin
>cd /etc/apache2/sites-available
156 54 Recent Coin
157 1 Umit Uzun
edit default with your choice of editor. 
158 1 Umit Uzun
ServerAdministrator youremail@email.com
159 57 Recent Coin
ServerName www.mydomain.com
160 57 Recent Coin
ServerAlias mydomain.com
161 54 Recent Coin
162 54 Recent Coin
Directly under this directive is 
163 54 Recent Coin
<pre>
164 54 Recent Coin
DocumentRoot /var/www
165 54 Recent Coin
        <Directory />
166 54 Recent Coin
                Options FollowSymLinks
167 54 Recent Coin
                AllowOverride None
168 54 Recent Coin
        </Directory>
169 54 Recent Coin
</pre>
170 54 Recent Coin
171 54 Recent Coin
 
172 54 Recent Coin
Change this to
173 54 Recent Coin
<pre>
174 54 Recent Coin
DocumentRoot /var/www
175 54 Recent Coin
        <Directory />
176 54 Recent Coin
                Options FollowSymLinks
177 54 Recent Coin
                RailsBaseURI /
178 68 Paul Preibisch
                PassengerResolveSymlinksinDocumentRoot on               
179 1 Umit Uzun
                AllowOverride None
180 1 Umit Uzun
        </Directory>
181 56 Recent Coin
</pre>
182 1 Umit Uzun
183 56 Recent Coin
184 57 Recent Coin
If you want to force or not the www at the beginning of the URL
185 57 Recent Coin
>a2enmod rewrite
186 57 Recent Coin
Then add the appropriate rules to either the default file or a .htaccess file located in the new root directory.  
187 56 Recent Coin
188 57 Recent Coin
189 56 Recent Coin
>cd /var
190 54 Recent Coin
>mv www ww2
191 36 Anonymous
>ln -s /usr/share/redmine/public www
192 36 Anonymous
>service apache2 restart
193 36 Anonymous
194 1 Umit Uzun
Go browse your server.  You should be able to log in with the default user of "admin" and the default password of "admin".  
195 1 Umit Uzun
Change the user name and password immediately.
196 1 Umit Uzun
197 1 Umit Uzun
h3. *Shared Server Configuration*
198 1 Umit Uzun
199 57 Recent Coin
>cd /var/www
200 1 Umit Uzun
201 57 Recent Coin
Decide on the "folder" you want the webserver to run this out of - redmine, projects, tickets, etc.  Be sure to change the "myfoldername" in the directions to whatever you have decided to use.  
202 1 Umit Uzun
203 57 Recent Coin
>ln -s /usr/share/redmine/public myfoldername
204 1 Umit Uzun
205 1 Umit Uzun
206 57 Recent Coin
Now you must edit the default site (or other virtual host file)
207 57 Recent Coin
208 57 Recent Coin
>cd /etc/apache2/sites-available
209 57 Recent Coin
210 57 Recent Coin
edit default and add the following
211 57 Recent Coin
212 57 Recent Coin
<pre>ServerAdministrator youremail@email.com
213 57 Recent Coin
ServerName www.mydomain.com
214 57 Recent Coin
ServerAlias mydomain.com
215 57 Recent Coin
</pre>
216 57 Recent Coin
217 57 Recent Coin
<pre><Directory /var/www/myfoldername>
218 1 Umit Uzun
RailsBaseURI /myfoldername
219 68 Paul Preibisch
PassengerAppRoot /usr/share/myfoldername
220 36 Anonymous
PassengerResolveSymlinksInDocumentRoot on
221 1 Umit Uzun
</Directory>
222 36 Anonymous
</pre>
223 1 Umit Uzun
224 59 Recent Coin
h3. Apparmor
225 36 Anonymous
226 59 Recent Coin
If you shut it down, now is the time to restart it.
227 1 Umit Uzun
228 59 Recent Coin
>service apparmor start
229 59 Recent Coin
 -OR-
230 1 Umit Uzun
231 59 Recent Coin
>/etc/init.d/apparmor tart
232 1 Umit Uzun
233 59 Recent Coin
If you had it configured to complain, you should enable it again.  
234 1 Umit Uzun
235 59 Recent Coin
>aa-enforce /usr/sbin/mysqld
236 1 Umit Uzun
237 59 Recent Coin
238 59 Recent Coin
h3. Final Steps
239 59 Recent Coin
    
240 59 Recent Coin
>service apache2 restart
241 59 Recent Coin
242 59 Recent Coin
- OR -
243 59 Recent Coin
244 59 Recent Coin
>/etc/init.d/apache2 restart
245 59 Recent Coin
246 59 Recent Coin
You may also want to consider installing something like fail2ban as well.
247 59 Recent Coin
248 59 Recent Coin
h3. Known Issues
249 59 Recent Coin
250 36 Anonymous
If you receive a "403: Forbidden" error after setting up Redmine, the Redmine 'public' folder may have incorrect permissions set. The executable bit on the public folder must be enabled or you will receive a "403: Forbidden" error when attempting to access Redmine.
251 36 Anonymous
252 59 Recent Coin
>chmod a+x /usr/share/redmine/public
253 59 Recent Coin
-OR-
254 59 Recent Coin
chmod 755 /usr/share/redmine/public
255 36 Anonymous
256 36 Anonymous
h1. Ubuntu 10.04 or 12.04 using WEBrick
257 36 Anonymous
258 39 Yu Kobayashi
Using Passenger is recommended for the heavy load server. But WEBrick uses less memory.
259 38 Yu Kobayashi
260 38 Yu Kobayashi
Install Redmine: (See also _Installing the latest Redmine_ above)
261 36 Anonymous
262 36 Anonymous
> $ sudo apt-get install redmine redmine-mysql
263 36 Anonymous
264 36 Anonymous
Then, create this for /etc/init/redmine.conf
265 36 Anonymous
266 36 Anonymous
<pre>
267 36 Anonymous
# Redmine
268 36 Anonymous
269 36 Anonymous
description "Redmine"
270 36 Anonymous
271 36 Anonymous
start on runlevel [2345]
272 36 Anonymous
stop on runlevel [!2345]
273 36 Anonymous
274 36 Anonymous
expect daemon
275 36 Anonymous
exec ruby /usr/share/redmine/script/server webrick -e production -b 0.0.0.0 -d
276 36 Anonymous
</pre>
277 36 Anonymous
278 36 Anonymous
You can start Redmine by this. You can access by http://example.com:3000/
279 36 Anonymous
280 36 Anonymous
> $ sudo service redmine start
281 36 Anonymous
282 36 Anonymous
You can stop by this.
283 36 Anonymous
284 36 Anonymous
> $ sudo service redmine stop
285 36 Anonymous
286 36 Anonymous
h1. Ubuntu 10.04 using mod_cgi
287 36 Anonymous
288 36 Anonymous
The installation assumes that the web server and database are already in place, so you probably want to install the LAMP stack first if you don't already have it:
289 36 Anonymous
290 36 Anonymous
> $ sudo tasksel install lamp-server
291 36 Anonymous
292 36 Anonymous
Also, the default AppArmor configuration can get in the way, so you may need to set the mysqld profile to complain:
293 36 Anonymous
294 36 Anonymous
> $ sudo aa-complain /usr/sbin/mysqld
295 36 Anonymous
296 36 Anonymous
As of 10.04, Redmine is available through Ubuntu's package manager, and installation is simple:
297 36 Anonymous
298 36 Anonymous
> $ sudo apt-get install redmine redmine-mysql subversion
299 36 Anonymous
300 36 Anonymous
The second package, _redmine-mysql_, can be replaced by either _redmine-pgsql_ or _redmine-sqlite_ if you want to use either of those databases.
301 36 Anonymous
302 36 Anonymous
The installation process should prompt you for all the interesting details.
303 36 Anonymous
304 36 Anonymous
Redmine will now be installed in @/usr/share/redmine@ and @/etc/redmine@
305 36 Anonymous
306 36 Anonymous
If you set your AppArmor mysqld profile to complain you ought to set it back to enforce:
307 36 Anonymous
308 36 Anonymous
> $ sudo aa-enforce /usr/sbin/mysqld
309 36 Anonymous
310 36 Anonymous
h2. Configuration
311 36 Anonymous
312 36 Anonymous
> *Using Ubuntu Server 10.04.1, configuring Redmine via mod_cgi as described in this section does not seem to work. If you can successfully make this work, please update these instructions! Otherwise follow the instructions in the next section for installing on Ubuntu 10.04 using Passenger or WEBrick if mod_cgi does not work for you.*
313 36 Anonymous
314 36 Anonymous
Symlink @/usr/share/redmine/public@ to your desired web-accessible location. E.g.:
315 36 Anonymous
316 42 Roland Giesler
> $ sudo ln -s /usr/share/redmine/public /var/www/redmine
317 42 Roland Giesler
318 42 Roland Giesler
Also symlink @/var/cache/redmine/default/plugin_assets@ to your redmine directory. E.g.:
319 42 Roland Giesler
320 42 Roland Giesler
> $ sudo ln -s /var/cache/redmine/default/plugin_assets /usr/share/redmine/public/
321 42 Roland Giesler
322 36 Anonymous
This will ensure that any graphics or other resources are displayed in any installed add-ons.
323 36 Anonymous
324 36 Anonymous
The other files that you need to modify/create are as follows:
325 36 Anonymous
326 36 Anonymous
@/etc/redmine/default/database.yml@:
327 36 Anonymous
328 36 Anonymous
<pre>
329 36 Anonymous
production:
330 36 Anonymous
adapter: mysql
331 36 Anonymous
database: redmine
332 36 Anonymous
host: localhost
333 36 Anonymous
username: redmine
334 36 Anonymous
password: pa55w0rd
335 36 Anonymous
encoding: utf8
336 36 Anonymous
</pre>
337 36 Anonymous
338 36 Anonymous
@/usr/share/redmine/public/dispatch.cgi@:
339 36 Anonymous
340 36 Anonymous
<pre>
341 36 Anonymous
#!/usr/bin/ruby
342 36 Anonymous
343 36 Anonymous
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
344 36 Anonymous
345 36 Anonymous
require "dispatcher"
346 36 Anonymous
347 36 Anonymous
ADDITIONAL_LOAD_PATHS.reverse.each { |dir| $:.unshift(dir) if File.directory?(dir) } if defined?(Apache::RubyRun)
348 36 Anonymous
Dispatcher.dispatch
349 36 Anonymous
</pre>
350 36 Anonymous
351 36 Anonymous
@/usr/share/redmine/public/.htaccess@:
352 36 Anonymous
353 36 Anonymous
<pre>
354 36 Anonymous
RewriteEngine On
355 36 Anonymous
RewriteBase /redmine
356 36 Anonymous
RewriteRule ^$ index.html [QSA]
357 36 Anonymous
RewriteRule ^([^.]+)$ $1.html [QSA]
358 36 Anonymous
RewriteCond %{REQUEST_FILENAME} !-f
359 36 Anonymous
RewriteRule ^(.*)$ dispatch.cgi [QSA,L]
360 36 Anonymous
</pre>
361 36 Anonymous
362 36 Anonymous
And that's it! If these instructions didn't work for you, please expand them to include whatever is needed.
363 36 Anonymous
364 36 Anonymous
h1. Redmine Installation on Virtual or Normal Ubuntu < 10.04
365 36 Anonymous
366 36 Anonymous
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 have installed your Redmine server successfully in almost an hour.
367 36 Anonymous
368 36 Anonymous
h2. Step 1: Install Ubuntu
369 36 Anonymous
370 36 Anonymous
If you are installing on a non-virtual Ubuntu instance, please skip this section.
371 36 Anonymous
372 36 Anonymous
*Installing VirtualBox:*
373 36 Anonymous
374 36 Anonymous
1.Download the latest version of Sun VirtualBox (version 3.0.10 or newer).
375 36 Anonymous
2.Install VirtualBox by following the instructions.
376 36 Anonymous
377 36 Anonymous
*Installing Ubuntu on VirtualBox:*
378 36 Anonymous
379 36 Anonymous
1.Download the latest version of Ubuntu (version 9.10 or newer).
380 36 Anonymous
2.After installing VirtualBox 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 Google.
381 36 Anonymous
382 36 Anonymous
3.While installing Ubuntu you should enter the following configuration:
383 36 Anonymous
(This suggested configuration is optional, you can enter any names you want.)
384 36 Anonymous
Q: What is your name? A: Redmine Server
385 36 Anonymous
Q: What name do you want to use to login? A: redmine
386 36 Anonymous
Q: Choose to password to keep your account safe? A: redmine
387 36 Anonymous
Q: What is the name of this computer? A: redmine-server
388 36 Anonymous
Choose “Log in automatically.” radio button.
389 36 Anonymous
390 36 Anonymous
4.When you've finished the installation, open up your new VirtualBox Ubuntu OS and open up a terminal (console) screen and issue these commands:
391 36 Anonymous
> sudo apt-get update
392 36 Anonymous
> sudo apt-get upgrade
393 36 Anonymous
394 36 Anonymous
*Configuring VirtualBox:*
395 36 Anonymous
396 36 Anonymous
1.If you want to reach your VirtualBox Ubuntu OS from a different machine, you have to configure VirtualBox Ubuntu OS's network settings to Bridged Adapter. So you can reach your VirtualBox Ubuntu from an internal IP address easily. Because it get's the same IP block as you from DHCP easily. I mean your guest and host computer is same IP block as different network client.
397 36 Anonymous
398 36 Anonymous
2.If you had assigned a static IP to your Network Consult by giving your static ethernet MAC address, you have to assign the unique MAC address your VirtualBox Ubuntu OS by Setting->Network->MAC address initialization box. By this MAC address, you can get a static IP easily or you can configure your Ubuntu system to not use DHCP, instead of that you can assign a static IP manually.
399 36 Anonymous
400 36 Anonymous
h2. Step 2: Install Redmine
401 36 Anonymous
402 36 Anonymous
Once you have a functioning Ubuntu operating system up and running, you can continue with installing Redmine.
403 36 Anonymous
404 36 Anonymous
h3. Install dependencies
405 36 Anonymous
406 36 Anonymous
The following packages are required to install and run Redmine. Please install them by running @apt-get@ as root:
407 36 Anonymous
408 36 Anonymous
>sudo apt-get install package-name
409 36 Anonymous
410 36 Anonymous
where @package-name@ is each of:
411 36 Anonymous
* apache2
412 36 Anonymous
* apache2-threaded-dev
413 36 Anonymous
* build-essential
414 36 Anonymous
* libapache-dbi-perl
415 36 Anonymous
* libapache2-mod-perl2
416 36 Anonymous
* libapache2-svn
417 36 Anonymous
* libdigest-sha1-perl
418 36 Anonymous
* libgemplugin-ruby
419 36 Anonymous
* libgemplugin-ruby1.8
420 36 Anonymous
* libruby-extras
421 36 Anonymous
* libruby1.8-extras
422 36 Anonymous
* mongrel
423 36 Anonymous
* mysql-server
424 36 Anonymous
* rails
425 36 Anonymous
* rake
426 36 Anonymous
* ruby
427 36 Anonymous
* rubygems
428 36 Anonymous
* rubygems1.8
429 36 Anonymous
* ruby1.8-dev
430 36 Anonymous
* subversion
431 36 Anonymous
432 36 Anonymous
_(Could someone please clean up this list?)_
433 36 Anonymous
434 36 Anonymous
h3. Package Installation and Setup
435 36 Anonymous
436 36 Anonymous
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:
437 36 Anonymous
> sudo apt-get install
438 36 Anonymous
> sudo apt-get install
439 36 Anonymous
(_Surely some missing package names above?_)
440 36 Anonymous
441 36 Anonymous
The packages we’re installing above are MySQL, phpMyAdmin, Rails, Ruby Gems, Mongrel and Ruby Dev environment.
442 36 Anonymous
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 phpMyAdmin. To make things simple you can set all passwords to “redmine”.
443 36 Anonymous
444 36 Anonymous
2.Create a new directory for Redmine. I put mine in /opt/redmine. And download the latest version of Redmine in to it with the wget command line downloader and extract it by issuing:
445 36 Anonymous
> sudo mkdir /opt/redmine
446 36 Anonymous
> sudo cd /opt/redmine
447 36 Anonymous
> sudo wget http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz
448 36 Anonymous
> tar -xvf redmine-0.8.6.tar.gz
449 36 Anonymous
450 36 Anonymous
h3. Database Setup
451 36 Anonymous
452 36 Anonymous
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.
453 36 Anonymous
Type in “root” and the MySQL “password” you created when installing MySQL.
454 36 Anonymous
455 36 Anonymous
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”.
456 36 Anonymous
457 36 Anonymous
3.Now, go back to the home screen and click on:
458 36 Anonymous
“Privileges”
459 36 Anonymous
“Add a new User”
460 36 Anonymous
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.
461 36 Anonymous
In the “Database for user” section, check “Create database with same name and grant all privileges” and click on the “Go” button.
462 36 Anonymous
463 36 Anonymous
4.Log out of phpMyAdmin.
464 36 Anonymous
465 36 Anonymous
h3. Redmine Database Connection Configuration
466 36 Anonymous
467 36 Anonymous
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:
468 36 Anonymous
> sudo cd /opt/redmine/redmine-0.8.6/config
469 36 Anonymous
470 36 Anonymous
2.So now, assuming you’re in the “/opt/redmine/redmine-0.8.6/config” directory, issue:
471 36 Anonymous
> sudo cp database.yml.example database.yml
472 36 Anonymous
473 36 Anonymous
3.Then, open the “database.yml” file, issue:
474 36 Anonymous
> sudo gedit database.yml
475 36 Anonymous
… and edit it as in the example for a MySQL database below:
476 36 Anonymous
477 36 Anonymous
production:
478 36 Anonymous
adapter: mysql
479 36 Anonymous
socket: /var/run/mysqld/mysqld.sock
480 36 Anonymous
database: redmine
481 36 Anonymous
host: localhost
482 36 Anonymous
username: redmine
483 36 Anonymous
password: [password]
484 36 Anonymous
485 36 Anonymous
Then save the “database.yml” file and exit to the command prompt.
486 36 Anonymous
On Ubuntu the “mysql.sock” is located in /var/run/mysqld/mysqld.sock, as noted in the “config” above.
487 36 Anonymous
(The standard Redmine installation assumes the socket is located in “/opt/redmine/redmine-0.8.6/tmp/mysqld.sock”.)
488 36 Anonymous
489 36 Anonymous
4.Create the database structure, by running the following command under the application root directory (I mean “/opt/redmine/redmine-0.8.6”):
490 36 Anonymous
> sudo rake db:migrate RAILS_ENV="production"
491 36 Anonymous
It will create the necessary tables in the redmine database you created earlier and an administrator account.
492 36 Anonymous
493 36 Anonymous
5.Insert the default configuration data in to the database, by issuing:
494 36 Anonymous
> sudo rake redmine:load_default_data RAILS_ENV="production"
495 36 Anonymous
(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.)
496 36 Anonymous
497 36 Anonymous
h3. Setting up Permissions
498 36 Anonymous
499 36 Anonymous
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:
500 36 Anonymous
> sudo mkdir /opt/redmine/redmine-0.8.6
501 36 Anonymous
502 36 Anonymous
2.If you haven’t created a Redmine user, do it now by issuing:
503 36 Anonymous
> sudo useradd redmine
504 36 Anonymous
505 36 Anonymous
3.Now, assuming you run Redmine with a redmine user, from your /opt/redmine/redmine-0.8.6 directory issue:
506 36 Anonymous
> sudo chown -R redmine:redmine files log tmp
507 36 Anonymous
> sudo chmod -R 755 files log tmp
508 36 Anonymous
509 36 Anonymous
h3. Testing the Installation
510 36 Anonymous
511 36 Anonymous
1.It should all be working now. Test the installation by running the WEBrick web server issue:
512 36 Anonymous
> sudo cd /opt/redmine/redmine-0.8.6
513 36 Anonymous
> sudo ruby script/server -e production
514 36 Anonymous
515 36 Anonymous
Once WEBrick has started, point your browser to http://localhost:3000/. Or, if you are using a browser on a computer other than the one 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.
516 36 Anonymous
517 36 Anonymous
*Log in:*
518 36 Anonymous
519 36 Anonymous
1.Use default administrator account to log in:
520 36 Anonymous
Login : admin
521 36 Anonymous
Password : admin
522 36 Anonymous
523 36 Anonymous
2.You can go to Admin & Settings to modify application settings.
524 36 Anonymous
525 36 Anonymous
h3. Setting Up Static IP
526 36 Anonymous
527 36 Anonymous
1.An easier 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.
528 36 Anonymous
529 36 Anonymous
2.Or you should determine the configuration parameters given below, and then you can configure your system to have a static IP address:
530 36 Anonymous
The desired IP address
531 36 Anonymous
Network mask and broadcast address
532 36 Anonymous
Gateway address
533 36 Anonymous
Your local DNS server address(es)
534 36 Anonymous
535 36 Anonymous
h3. Assigning Host Name and Domain for VirtualBox OS
536 36 Anonymous
537 36 Anonymous
1.An easier method for adding your IP address - Host name pair configuration to your DNS server . Consult your network administrator.
538 36 Anonymous
539 36 Anonymous
h2. Configuring the Passenger Apache module
540 36 Anonymous
541 36 Anonymous
Passenger is a module for apache2 that allows Apache to run Ruby on Rails applications. Install it thus:
542 36 Anonymous
543 36 Anonymous
>$ sudo gem install passenger
544 36 Anonymous
545 36 Anonymous
Then go to the passenger apache2 module installation directory and run @passenger-install-apache2-module@
546 36 Anonymous
547 36 Anonymous
> $ cd /var/lib/gems/1.X/gems/passenger-X.X.X/
548 36 Anonymous
549 36 Anonymous
> $ sudo bin/passenger-install-apache2-module
550 36 Anonymous
551 36 Anonymous
Next, configure Apache:
552 36 Anonymous
553 36 Anonymous
In /etc/apache2/mods-available/passenger.load we will add next line
554 36 Anonymous
555 36 Anonymous
> LoadModule passenger_module /var/lib/gems/1.X/gems/passenger-X.X.X/ext/apache2/mod_passenger.so
556 36 Anonymous
557 36 Anonymous
We have to edit the conf of the passenger apache2 module in /etc/apache2/mods-available/passenger.conf
558 36 Anonymous
559 36 Anonymous
> PassengerRoot /var/lib/gems/1.X/gems/passenger-X.X.X
560 36 Anonymous
> PassengerRuby /usr/bin/ruby1.X
561 36 Anonymous
562 36 Anonymous
And now we activate the module
563 36 Anonymous
564 36 Anonymous
> $ sudo a2enmod passenger
565 36 Anonymous
566 36 Anonymous
Apache virtualhost for redmine web app
567 36 Anonymous
568 36 Anonymous
<pre>
569 36 Anonymous
<VirtualHost *:80>
570 36 Anonymous
ServerName redmine.server.com
571 36 Anonymous
572 36 Anonymous
DocumentRoot /var/www/redmine/public
573 36 Anonymous
574 36 Anonymous
ServerAdmin user@server.com
575 36 Anonymous
LogLevel warn
576 36 Anonymous
ErrorLog /var/log/apache2/redmine_error
577 36 Anonymous
CustomLog /var/log/apache2/redmine_access combined
578 36 Anonymous
579 36 Anonymous
<Directory /var/www/redmine/public>
580 36 Anonymous
Options Indexes FollowSymLinks MultiViews
581 36 Anonymous
AllowOverride None
582 36 Anonymous
Order allow,deny
583 36 Anonymous
allow from all
584 36 Anonymous
</Directory>
585 36 Anonymous
</VirtualHost>
586 36 Anonymous
</pre>
587 36 Anonymous
588 36 Anonymous
subversion server config in apache
589 36 Anonymous
590 36 Anonymous
<pre>
591 36 Anonymous
<VirtualHost *:80>
592 36 Anonymous
ServerName svn.server.com
593 36 Anonymous
ServerAdmin user@server.com
594 36 Anonymous
ErrorLog /var/log/apache2/svn_error
595 36 Anonymous
CustomLog /var/log/apache2/svn_access combined
596 36 Anonymous
<Location /project>
597 36 Anonymous
DAV svn
598 36 Anonymous
SVNPath /var/lib/svn/project
599 36 Anonymous
600 36 Anonymous
AuthType Basic
601 36 Anonymous
AuthName "Trac system for Server projects"
602 36 Anonymous
AuthUserFile "/var/lib/svn/.htpasswd"
603 36 Anonymous
Require valid-user
604 36 Anonymous
<LimitExcept GET PROPFIND OPTIONS REPORT>
605 36 Anonymous
Require valid-user
606 36 Anonymous
</LimitExcept>
607 36 Anonymous
</Location>
608 36 Anonymous
</Virtualhost>
609 36 Anonymous
</pre>
610 36 Anonymous
611 36 Anonymous
h2. Sendmail Server Configuration
612 36 Anonymous
613 36 Anonymous
1.Before configuring email support for Redmine, we should download the sendmail application for Ubuntu, issue:
614 36 Anonymous
615 36 Anonymous
> sudo apt-get install sendmail
616 36 Anonymous
617 36 Anonymous
> sudo sendmailconfig
618 36 Anonymous
619 36 Anonymous
(Answer Yes to all questions which you will be asked)
620 36 Anonymous
621 36 Anonymous
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:
622 37 João Lencart e Silva
> sudo cd /opt/redmine/redmine-0.8.6/config
623 37 João Lencart e Silva
624 36 Anonymous
625 36 Anonymous
626 36 Anonymous
3.So now, assuming you’re in the “/config” directory, issue:
627 36 Anonymous
> sudo cp email.yml.example email.yml
628 36 Anonymous
629 36 Anonymous
4.Then, open the “email.yml” file, issue:
630 36 Anonymous
> sudo gedit email.yml
631 36 Anonymous
… and edit it as in the example for sendmail configuration below:
632 36 Anonymous
633 36 Anonymous
production:
634 36 Anonymous
delivery_method: :sendmail
635 36 Anonymous
sendmail_settings:
636 36 Anonymous
location: /usr/sbin/sendmail
637 36 Anonymous
arguments: -i -t
638 36 Anonymous
address: smtp.example.net
639 36 Anonymous
port: 25
640 36 Anonymous
domain: example.net
641 36 Anonymous
authentication: :none
642 36 Anonymous
user_name: redmine@example.net
643 36 Anonymous
password: redmine
644 36 Anonymous
645 36 Anonymous
Then save “email.yml” file and exit to the command prompt.
646 37 João Lencart e Silva
647 37 João Lencart e Silva
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”.
648 37 João Lencart e Silva
649 37 João Lencart e Silva
h2. Email configuration for Ubuntu 12.04 with redmine >v1.4.3
650 37 João Lencart e Silva
651 37 João Lencart e Silva
1. Instead of creating an email.yml, edit config/configuration.yml and add a section
652 37 João Lencart e Silva
<pre>
653 37 João Lencart e Silva
production:
654 37 João Lencart e Silva
   email_delivery:
655 37 João Lencart e Silva
     delivery_method: :smtp
656 37 João Lencart e Silva
...</pre>
657 37 João Lencart e Silva
658 37 João Lencart e Silva
or
659 37 João Lencart e Silva
660 37 João Lencart e Silva
<pre>production:
661 37 João Lencart e Silva
   email_delivery:
662 37 João Lencart e Silva
     delivery_method: :sendmail
663 37 João Lencart e Silva
...</pre>
664 37 João Lencart e Silva
665 37 João Lencart e Silva
Please see http://www.redmine.org/projects/redmine/wiki/EmailConfiguration for the correct format of the full email block.
666 37 João Lencart e Silva
667 37 João Lencart e Silva
2. **DO NOT CHANGE** environment.rb config.action_mailer.perform_deliveries. The correct way is changing configuration.yml and leaving the default config.action_mailer.perform_deliveries setting to false:
668 37 João Lencart e Silva
@config.action_mailer.perform_deliveries = false@
669 37 João Lencart e Silva
670 37 João Lencart e Silva
671 36 Anonymous
672 36 Anonymous
673 36 Anonymous
674 36 Anonymous
h2. Subversion Installation and Configuration
675 36 Anonymous
676 36 Anonymous
1.Before configuring Subversion support for Redmine, we should download the Subversion application for Ubuntu, issue:
677 36 Anonymous
> sudo apt-get install subversion
678 36 Anonymous
679 36 Anonymous
2.If your Redmine can't find the “subversion” command you can help to find by issuing:
680 36 Anonymous
· > sudo cd /opt/redmine/redmine-0.8.6/config
681 36 Anonymous
· > sudo gedit environment.rb
682 36 Anonymous
· Add ENV['PATH'] = "#{ENV['PATH']}:/subversion/path" line in it.
683 36 Anonymous
· Save and close the “environment.rb”
684 36 Anonymous
685 36 Anonymous
h2. Start Application at Boot Time
686 36 Anonymous
687 36 Anonymous
1.To automatically start the application on booting your server you need to modify your “crontab”, issue:
688 36 Anonymous
> export EDITOR=gedit
689 36 Anonymous
> crontab -e
690 36 Anonymous
691 36 Anonymous
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):
692 36 Anonymous
@reboot cd /opt/redmine/redmine-0.8.6 ; rm -f log/mongrel.pid ; mongrel_rails start -e production -p 3000 -d
693 36 Anonymous
694 36 Anonymous
h2. Backup
695 36 Anonymous
696 36 Anonymous
1.Running backups is always a good idea. Redmine backups should include:
697 36 Anonymous
* data (stored in your redmine database)
698 36 Anonymous
/usr/bin/mysqldump -u -p | gzip > /path/to/redmine/backup/db/redmine_`date +%y_%m_%d`.gz
699 36 Anonymous
* attachments (stored in the files directory of your Redmine install)
700 36 Anonymous
rsync -a /path/to/redmine/files /path/to/redmine/backup/files
701 36 Anonymous
702 36 Anonymous
2.Or you can use the bash shell to automate this kind of operation, issue:
703 36 Anonymous
> sudo cd /opt/redmine/redmine-0.8.6
704 36 Anonymous
> sudo mkdir backup
705 36 Anonymous
> sudo mkdir backup/db
706 36 Anonymous
> sudo mkdir backup/files
707 36 Anonymous
> sudo gedit backup/runRedmineBackup.bash
708 36 Anonymous
709 36 Anonymous
And after open “runRedmineBackup.bash” with gedit, write all commands below:
710 36 Anonymous
<pre>
711 36 Anonymous
#!/bin/bash
712 36 Anonymous
data=`date -I`
713 36 Anonymous
mysqldump --user=root --password="redmine" --all-databases | gzip > db/backup-$data.sql.gz
714 36 Anonymous
cd db
715 36 Anonymous
ftp -i -n << EOF
716 36 Anonymous
open ftpserver.example.net
717 36 Anonymous
user username password
718 36 Anonymous
bin
719 36 Anonymous
mput backup-$data.sql.gz
720 36 Anonymous
bye
721 36 Anonymous
EOF
722 36 Anonymous
</pre>
723 36 Anonymous
Then save the “runRedmineBackup.bash” file and exit to the command prompt. After creation of runRedmineBackup.bash you can add this bash script to run continually between specified periods. Issue:
724 36 Anonymous
725 36 Anonymous
> export EDITOR=gedit
726 36 Anonymous
> crontab -e
727 36 Anonymous
Add 0 0 * * 0 cd /opt/redmine/redmine-0.8.6/backup ; sh runRedmineBackup.bash commands to crontab to backup database weekly.
728 36 Anonymous
729 36 Anonymous
For this to work without any permission problems you have to change the permissions of the files to maximum, issue:
730 36 Anonymous
731 36 Anonymous
> sudo chmod -R 777 backup
732 36 Anonymous
> sudo chown -R redmine:redmine backup
733 36 Anonymous
734 36 Anonymous
That's all. Now we have completely installed Redmine on our virtual Ubuntu OS and can reach it from any machine in our network easily. Congratulations..!
735 36 Anonymous
736 36 Anonymous
h2. Sources & contributors.
737 36 Anonymous
738 36 Anonymous
* Ümit Uzun 06/11/2009.
739 36 Anonymous
* 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.
740 36 Anonymous
* Sam Wilson 2010-05-26, formatting changes.
741 36 Anonymous
* Allen Yeh 2010-09-08, Added apt-get install subversion into instructions for 10.04 otherwise once redmine is setup an error like this will result this error -> +*The entry or revision was not found in the repository.*+
742 36 Anonymous
743 40 Mohd Shakir Zakaria
h2. Additional Sources
744 1 Umit Uzun
745 1 Umit Uzun
* http://docs.oseems.com/general/web/redmine/install-in-ubuntu