HowTo Install Redmine on Debian Squeeze with Postgresql Ruby-on-Rails and Apache2-Passenger » History » Version 11
C. X., 2011-05-19 11:39
1 | 1 | Kaj Ailomaa | h1. HowTo Install Redmine on Debian Squeeze with Postgresql Ruby-on-Rails and Apache2-Passenger |
---|---|---|---|
2 | |||
3 | 7 | Kaj Ailomaa | This howto is similar to the [[HowTo Install Redmine on Debian with Ruby-on-Rails and Apache2-Passenger]], but a little shorter and uses Postgresql instead of Mysql as the database server. |
4 | It should be noted that Redmine and all it's dependencies are available as packages in Debians' repo's, so there is no need to download Redmine from svn as we will do in this howto. |
||
5 | 1 | Kaj Ailomaa | |
6 | First we become root and install some needed packages: |
||
7 | <pre> |
||
8 | su |
||
9 | apt-get install postgresql-8.4 apache2 subversion rake rubygems libopenssl-ruby libpgsql-ruby libapache2-mod-passenger |
||
10 | 3 | Kaj Ailomaa | gem install -v=2.3.5 rails |
11 | 1 | Kaj Ailomaa | </pre> |
12 | 8 | Kaj Ailomaa | Before configuring redmine we need to create a user and a database in Postresql. Make sure to replace <password> with your password. |
13 | 1 | Kaj Ailomaa | <pre> |
14 | su postgres |
||
15 | psql |
||
16 | postgres=# CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD '<password>' NOINHERIT VALID UNTIL 'infinity'; |
||
17 | 9 | Frédéric Stemmelin | postgres=# CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine TEMPLATE template0; |
18 | 2 | Kaj Ailomaa | postgres=# \q |
19 | exit |
||
20 | 1 | Kaj Ailomaa | </pre> |
21 | 7 | Kaj Ailomaa | Now, let's download Redmine and configure it |
22 | 1 | Kaj Ailomaa | <pre> |
23 | 6 | Kaj Ailomaa | cd /tmp |
24 | 1 | Kaj Ailomaa | svn co http://redmine.rubyforge.org/svn/branches/1.0-stable redmine-1.0 |
25 | mv redmine-1.0/ /var/lib/redmine |
||
26 | cd /var/lib/redmine |
||
27 | </pre> |
||
28 | First some database stuff. Replace <password> with your password. |
||
29 | <pre> |
||
30 | echo "production: |
||
31 | adapter: postgresql |
||
32 | database: redmine |
||
33 | host: localhost |
||
34 | username: redmine |
||
35 | password: <password> |
||
36 | encoding: utf8 |
||
37 | schema_search_path: public" > config/database.yml |
||
38 | |||
39 | RAILS_ENV=production rake config/initializers/session_store.rb |
||
40 | rake generate_session_store |
||
41 | RAILS_ENV=production rake db:migrate |
||
42 | RAILS_ENV=production rake redmine:load_default_data |
||
43 | </pre> |
||
44 | Finally, we setup Apache. A symbolic link to the www dir and ownership given to www-data. |
||
45 | <pre> |
||
46 | ln -s /var/lib/redmine/public /var/www/redmine |
||
47 | chown -R www-data:www-data /var/www/redmine |
||
48 | </pre> |
||
49 | 7 | Kaj Ailomaa | We enable the site and restart Apache. |
50 | 1 | Kaj Ailomaa | <pre> |
51 | echo "RailsBaseURI /redmine" > /etc/apache2/sites-available/redmine |
||
52 | a2ensite redmine |
||
53 | /etc/init.d/apache2 restart |
||
54 | </pre> |
||
55 | 7 | Kaj Ailomaa | That's it. You will find Redmine at either: |
56 | 5 | Kaj Ailomaa | |
57 | localhost/redmine |
||
58 | your-ip/redmine or |
||
59 | 1 | Kaj Ailomaa | your-domain/redmine |
60 | 10 | Carlos Miranda Molina | |
61 | |||
62 | 11 | C. X. | +If you need run redmine with a normal domain without alias (/redmine) you can follow the following instructions.+ |
63 | |||
64 | There are two possibilities: |
||
65 | * use mod_fcgid |
||
66 | * use the already installed mod_passenger |
||
67 | |||
68 | *Use mod_fcgid* |
||
69 | 10 | Carlos Miranda Molina | Install fcgid module for Apache |
70 | <pre> |
||
71 | aptitude install libapache2-mod-fcgid |
||
72 | </pre> |
||
73 | |||
74 | Configure a example VirtualHost /etc/apache2/sites-available/yourvirtualhost |
||
75 | <pre> |
||
76 | <VirtualHost *:80> |
||
77 | ServerAdmin mail@yourserver |
||
78 | ServerName www.redmine.org |
||
79 | |||
80 | DefaultInitEnv RAILS_ENV production |
||
81 | DefaultInitEnv GEM_PATH /var/lib/gems/1.8 |
||
82 | |||
83 | DocumentRoot /var/lib/redmine/public |
||
84 | <Directory /var/lib/redmine/public> |
||
85 | Options +FollowSymLinks +ExecCGI |
||
86 | RewriteEngine On |
||
87 | RewriteRule ^$ index.html [QSA] |
||
88 | RewriteRule ^([^.]+)$ $1.html [QSA] |
||
89 | RewriteCond %{REQUEST_FILENAME} !-f |
||
90 | RewriteRule ^(.*)$ dispatch.fcgi [QSA,L] |
||
91 | ErrorDocument 500 "<h2>Application error</h2>Rails application failed to start properly" |
||
92 | AllowOverride None |
||
93 | #AllowOverride all |
||
94 | Order allow,deny |
||
95 | allow from all |
||
96 | </Directory> |
||
97 | # Possible values include: debug, info, notice, warn, error, crit, |
||
98 | # alert, emerg. |
||
99 | LogLevel warn |
||
100 | |||
101 | CustomLog /var/log/apache2/access.log combined |
||
102 | ErrorLog /var/log/apache2/error.log |
||
103 | |||
104 | ServerSignature Off |
||
105 | </VirtualHost> |
||
106 | </pre> |
||
107 | |||
108 | Enable the new VirtualHost and restart Apache mod-rewrite also needs |
||
109 | <pre> |
||
110 | cd /etc/apache2/sites-available |
||
111 | a2ensite yourvirtualhost |
||
112 | a2enmod rewrite |
||
113 | /etc/init.d/apache2 restart |
||
114 | </pre> |
||
115 | |||
116 | Remember change owner and permissions of /var/lib/redmine/files/ (for upload files) |
||
117 | <pre> |
||
118 | chown -R www-data:www-data /var/lib/redmine/files/ |
||
119 | chmod -R 0777 /var/lib/redmine/files/ |
||
120 | </pre> |
||
121 | 5 | Kaj Ailomaa | |
122 | 1 | Kaj Ailomaa | Log in with user: admin, password: admin |
123 | 11 | C. X. | |
124 | *Use the already installed mod_passenger* |
||
125 | (_Tested with Debian 6.0.1, Apache 2.2.16 and mod_passenger 2.2.11_) |
||
126 | |||
127 | Create a simple configuration file under /etc/apache2/sites-available: |
||
128 | <pre> |
||
129 | <VirtualHost *:80> |
||
130 | ServerAdmin mail@yourserver |
||
131 | ServerName www.redmine.org |
||
132 | |||
133 | DocumentRoot /var/lib/redmine/public |
||
134 | <Directory /var/lib/redmine/public> |
||
135 | Options -MultiViews |
||
136 | allow from all |
||
137 | </Directory> |
||
138 | # Possible values include: debug, info, notice, warn, error, crit, |
||
139 | # alert, emerg. |
||
140 | LogLevel warn |
||
141 | |||
142 | CustomLog /var/log/apache2/access.log combined |
||
143 | ErrorLog /var/log/apache2/error.log |
||
144 | |||
145 | ServerSignature Off |
||
146 | </VirtualHost> |
||
147 | </pre> |
||
148 | |||
149 | Note: Remember to do the changes with owner and permissions. |