HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger » History » Version 15
André Domarques, 2014-09-12 14:31
Updated to redmine v 2.5.2 plugin version 0.7.7
1 | 14 | André Domarques | h2. HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger |
---|---|---|---|
2 | 1 | André Domarques | |
3 | 14 | André Domarques | h3. About |
4 | 1 | André Domarques | |
5 | A quick step-by-step for install Redmine and Gitolite plugin on Debian Wheezy mainly using default packages. |
||
6 | |||
7 | 5 | André Domarques | If I missed something, "let me know":http://www.redmine.org/users/85560 |
8 | 1 | André Domarques | |
9 | 14 | André Domarques | h3. Last update |
10 | 1 | André Domarques | |
11 | 15 | André Domarques | <pre>Date: 2014-09-12 |
12 | Sumary: Updated to Redmine *2.5.2* and redmine_git_hosting *0.7.7*. |
||
13 | 14 | André Domarques | See doc history for more info and/or instructions for redmine_git_hosting 0.6.x (deprecated).</pre> |
14 | 1 | André Domarques | |
15 | 14 | André Domarques | h3. Required packages |
16 | 1 | André Domarques | |
17 | 14 | André Domarques | <pre>aptitude update && aptitude -y install sudo ssh bzip2 zip unzip apache2 libapache2-mod-passenger mysql-server libmysqlclient-dev ruby ruby-dev git git-core gitolite libmagickcore-dev libmagickwand-dev libicu-dev</pre> |
18 | 1 | André Domarques | |
19 | 14 | André Domarques | h3. Users and ssh-key |
20 | 1 | André Domarques | |
21 | 14 | André Domarques | Create an user for Redmine (*redmine*) and another for Gitolite (*git*): |
22 | |||
23 | 1 | André Domarques | <pre>adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitolite git |
24 | adduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine</pre> |
||
25 | |||
26 | 14 | André Domarques | Generate a ssh-key for *redmine* user. This user will be used as admin of Gitolite. The name of key should be *redmine_gitolite_admin_id_rsa*. |
27 | 8 | André Domarques | |
28 | 14 | André Domarques | <pre>su redmine |
29 | ssh-keygen -t rsa -N '' -f ~/.ssh/redmine_gitolite_admin_id_rsa |
||
30 | 1 | André Domarques | exit</pre> |
31 | |||
32 | 14 | André Domarques | h3. Configuring Gitolite |
33 | 1 | André Domarques | |
34 | <pre>dpkg-reconfigure gitolite</pre> |
||
35 | |||
36 | Type data bellow: |
||
37 | |||
38 | * user: git |
||
39 | * repos path: /opt/gitolite |
||
40 | 14 | André Domarques | * admin ssh-key: /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub |
41 | 5 | André Domarques | |
42 | 14 | André Domarques | h4. Note about SSH |
43 | |||
44 | Click bellow to expand. |
||
45 | |||
46 | 1 | André Domarques | {{collapse(Note about SSH) |
47 | 4 | André Domarques | |
48 | 14 | André Domarques | If you try to connect gitolite (user: *git*) using *redmine* user via ssh, will be prompted password... See what happens: |
49 | 1 | André Domarques | |
50 | <pre>redmine@redmine:~$ ssh -v git@localhost |
||
51 | ... |
||
52 | The authenticity of host 'localhost (::1)' can't be established. |
||
53 | ECDSA key fingerprint is d5:da:b9:10:c4:9b:51:75:65:f3:64:81:b5:6c:1a:1a. |
||
54 | Are you sure you want to continue connecting (yes/no)? yes |
||
55 | ... |
||
56 | ... |
||
57 | *debug1: Trying private key: /opt/redmine/.ssh/id_rsa* |
||
58 | *debug1: Trying private key: /opt/redmine/.ssh/id_dsa* |
||
59 | 4 | André Domarques | *debug1: Trying private key: /opt/redmine/.ssh/id_ecdsa* |
60 | 1 | André Domarques | debug1: Next authentication method: password |
61 | git@localhost's password:</pre> |
||
62 | |||
63 | 8 | André Domarques | You can solve this by simply creating a symbolic link: |
64 | 1 | André Domarques | |
65 | 14 | André Domarques | <pre>su redmine |
66 | ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa /opt/redmine/.ssh/id_rsa |
||
67 | ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub /opt/redmine/.ssh/id_rsa.pub</pre> |
||
68 | 1 | André Domarques | |
69 | Or even using ssh -i identity_file (check http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1 for more details) |
||
70 | }} |
||
71 | |||
72 | 14 | André Domarques | h3. Visudo configuration |
73 | 1 | André Domarques | |
74 | <pre>visudo</pre> |
||
75 | |||
76 | Add the following lines: |
||
77 | |||
78 | 14 | André Domarques | <pre># temp - *REMOVE* after installation |
79 | 1 | André Domarques | redmine ALL=(ALL) NOPASSWD:ALL |
80 | |||
81 | # redmine gitolite integration |
||
82 | redmine ALL=(git) NOPASSWD:ALL |
||
83 | git ALL=(redmine) NOPASSWD:ALL</pre> |
||
84 | |||
85 | 14 | André Domarques | Note that redmine user will be able to run root commands, but this is just to simplify the next steps. *REMOVE* this line after installation. |
86 | 1 | André Domarques | |
87 | 14 | André Domarques | h3. Redmine installation |
88 | 1 | André Domarques | |
89 | The installation and configuration is like the official documentation. Simply reproducing to maintain the flow on this how-to. |
||
90 | |||
91 | 14 | André Domarques | h4. Download |
92 | |||
93 | 1 | André Domarques | <pre>sudo su - redmine |
94 | cd ~ |
||
95 | 15 | André Domarques | wget http://www.redmine.org/releases/redmine-2.5.2.tar.gz |
96 | tar zxf redmine-2.5.2.tar.gz |
||
97 | mv redmine-2.5.2/* . |
||
98 | rm -Rf redmine-2.5.2 |
||
99 | 1 | André Domarques | </pre> |
100 | |||
101 | 14 | André Domarques | h4. Create database and user |
102 | 1 | André Domarques | |
103 | 14 | André Domarques | <pre>mysql -u root -p -v -e "CREATE DATABASE redmine CHARACTER SET utf8; |
104 | 1 | André Domarques | CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine'; |
105 | 14 | André Domarques | GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';"</pre> |
106 | 1 | André Domarques | |
107 | 14 | André Domarques | h4. Configure database and email |
108 | 1 | André Domarques | |
109 | <pre>cd /opt/redmine/config |
||
110 | cp database.yml.example database.yml |
||
111 | cp configuration.yml.example configuration.yml</pre> |
||
112 | |||
113 | Check more at: |
||
114 | * http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-3-Database-connection-configuration |
||
115 | * http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Configuration |
||
116 | |||
117 | 14 | André Domarques | h4. Finishing the installation |
118 | |||
119 | 1 | André Domarques | Create plugin assets directory |
120 | |||
121 | <pre>cd ~ |
||
122 | mkdir public/plugin_assets |
||
123 | </pre> |
||
124 | |||
125 | 14 | André Domarques | Now, complete the installation. |
126 | 1 | André Domarques | |
127 | <pre>sudo gem install bundler |
||
128 | bundle install --without development test postgresql sqlite |
||
129 | rake generate_secret_token |
||
130 | RAILS_ENV=production rake db:migrate |
||
131 | RAILS_ENV=production rake redmine:load_default_data</pre> |
||
132 | |||
133 | 14 | André Domarques | h3. Redmine Gitolite integration |
134 | 1 | André Domarques | |
135 | The plugin used on this how-to is the fork of JBox Web, you can get more information at: |
||
136 | * http://www.redmine.org/plugins/redmine_git_hosting |
||
137 | * http://jbox-web.github.io/redmine_git_hosting/ |
||
138 | * https://github.com/jbox-web/redmine_git_hosting |
||
139 | |||
140 | 14 | André Domarques | h4. Download |
141 | 1 | André Domarques | |
142 | <pre>cd ~/plugins |
||
143 | 14 | André Domarques | git clone https://github.com/jbox-web/redmine_bootstrap_kit.git |
144 | 1 | André Domarques | git clone https://github.com/jbox-web/redmine_git_hosting.git |
145 | 14 | André Domarques | cd redmine_git_hosting |
146 | 15 | André Domarques | git checkout v0.7.7</pre> |
147 | 1 | André Domarques | |
148 | 14 | André Domarques | h4. Create symlinks |
149 | 1 | André Domarques | |
150 | 15 | André Domarques | The current version of the plugin (0.7.7) now uses the directory /opt/redmine/plugins/redmine_git_hosting/ssh_keys/ to keep the ssh keys. So let's just create some symbolic links: |
151 | 14 | André Domarques | |
152 | <pre>ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa /opt/redmine/plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa |
||
153 | ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub /opt/redmine/plugins/redmine_git_hosting/ssh_keys/redmine_gitolite_admin_id_rsa.pub</pre> |
||
154 | |||
155 | h4. Configure GL_GITCONFIG_KEYS |
||
156 | |||
157 | This version now use some hooks that, by default on gitolite *v2*, will be blocked by the var GL_GITCONFIG_KEYS. On gitolite *v3*, this var is named GIT_CONFIG_KEYS. |
||
158 | |||
159 | <pre>sudo su - git |
||
160 | sed -i 's/$GL_GITCONFIG_KEYS = ""/$GL_GITCONFIG_KEYS = ".*"/g' /opt/gitolite/.gitolite.rc |
||
161 | exit</pre> |
||
162 | |||
163 | h4. Configure Automatic Repository Initialization (optional) |
||
164 | |||
165 | To configure the new feature "Automatic Repository Initialization" (optional), is necessary to customize the gitolite.conf file. |
||
166 | |||
167 | 1 | André Domarques | <pre>cd ~ |
168 | 14 | André Domarques | git clone git@localhost:gitolite-admin.git |
169 | cd gitolite-admin/ |
||
170 | echo "repo @all |
||
171 | RW+ = admin" >> conf/gitolite.conf |
||
172 | git commit -m 'Automatic Repository Initialization' conf/gitolite.conf |
||
173 | git push |
||
174 | cd ~ |
||
175 | rm -rf gitolite-admin</pre> |
||
176 | |||
177 | Remember that this repository will be managed by redmine and their plugin. |
||
178 | |||
179 | h4. Plugin installation |
||
180 | |||
181 | It's necessary to run bundle again to install some new gems required by the plugins. |
||
182 | |||
183 | <pre>cd ~ |
||
184 | bundle install --without development |
||
185 | 1 | André Domarques | RAILS_ENV=production rake redmine:plugins:migrate |
186 | 14 | André Domarques | </pre> |
187 | 1 | André Domarques | |
188 | |||
189 | 14 | André Domarques | h3. Apache mod_passenger configuration |
190 | 1 | André Domarques | |
191 | 14 | André Domarques | Create a symbolic link, configure and enable the site and restart apache. |
192 | |||
193 | 1 | André Domarques | <pre>su root |
194 | cd /var/www |
||
195 | 14 | André Domarques | ln -s /opt/redmine/public redmine |
196 | echo "RailsBaseURI /redmine |
||
197 | PassengerUserSwitching on |
||
198 | PassengerUser redmine |
||
199 | PassengerGroup redmine" > /etc/apache2/sites-available/redmine |
||
200 | a2ensite redmine |
||
201 | service apache2 reload</pre> |
||
202 | 1 | André Domarques | |
203 | 14 | André Domarques | h3. Post-install configuration tasks |
204 | 1 | André Domarques | |
205 | 14 | André Domarques | Remember to remove the sudo temp configuration: |
206 | 1 | André Domarques | |
207 | 14 | André Domarques | <pre>visudo |
208 | # temp - *REMOVE* after installation |
||
209 | redmine ALL=(ALL) NOPASSWD:ALL</pre> |
||
210 | 1 | André Domarques | |
211 | 14 | André Domarques | You'll need to do some configuration on Redmine and git_hosting plugin. |
212 | 1 | André Domarques | |
213 | 14 | André Domarques | h4. Redmine |
214 | 1 | André Domarques | |
215 | 14 | André Domarques | Configure the Redmine default URL (*important*): |
216 | 1 | André Domarques | |
217 | 14 | André Domarques | Administration > Settings > General |
218 | http://your_ip_or_fqdn/redmine/settings?tab=general |
||
219 | 1 | André Domarques | |
220 | 14 | André Domarques | This is set, by default, to localhost:3000, change it to your IP or FQDN. |
221 | |||
222 | h5. Set the available repositories |
||
223 | |||
224 | Administration > Settings > Repositories |
||
225 | http://your_ip_or_fqdn/redmine/settings?tab=repositories |
||
226 | |||
227 | Uncheck what you don't have installed on your system. Just to avoid unnecessary log messages. |
||
228 | |||
229 | h4. Redmine Git Hosting Plugin |
||
230 | |||
231 | h5. First of all, check the configuration |
||
232 | |||
233 | Administration > Redmine Git Hosting Plugin > Config Test |
||
234 | http://your_ip_or_fqdn/redmine/settings/plugin/redmine_git_hosting?tab=gitolite_config_test |
||
235 | |||
236 | Ensure if all settings are correct (users, paths, versions etc.). |
||
237 | |||
238 | h5. Set your IP or FQDN to SSH, HTTP and/or HTTPS |
||
239 | |||
240 | Administration > Redmine Git Hosting Plugin > Acess |
||
241 | http://your_ip_or_fqdn/redmine/settings/plugin/redmine_git_hosting?tab=gitolite_config_access |
||
242 | |||
243 | Those settings will be also used on git operations (clone, pull, push etc.). |
||
244 | |||
245 | h3. Troubleshooting |
||
246 | |||
247 | h4. Logs |
||
248 | |||
249 | If you have some trouble during the installation, you can check the following files: |
||
250 | |||
251 | * /opt/gitolite/.gitolite/logs/gitolite-`date +%Y\-%m`.log |
||
252 | * /opt/redmine/log/git_hosting.log |
||
253 | * /var/log/apache2/error.log |
||
254 | |||
255 | If you use multitail: |
||
256 | |||
257 | <pre> |
||
258 | 15 | André Domarques | multitail /opt/gitolite/.gitolite/logs/gitolite-`date +%Y\-%m`.log /opt/redmine/log/git_hosting.log /var/log/apache2/error.log |
259 | 14 | André Domarques | </pre> |
260 | |||
261 | h4. Plugin |
||
262 | |||
263 | You also must check, regarding the plugin: |
||
264 | |||
265 | https://github.com/jbox-web/redmine_git_hosting/wiki/Troubleshooting |
||
266 | |||
267 | h4. Environment details |
||
268 | |||
269 | Click bellow to expand. |
||
270 | |||
271 | 1 | André Domarques | {{collapse(Environment details) |
272 | 5 | André Domarques | |
273 | 14 | André Domarques | Debian Wheezy (netinst iso - installed only with basic packages and ssh server profiles) |
274 | 5 | André Domarques | |
275 | 1 | André Domarques | <pre>cat /etc/debian_version |
276 | 5 | André Domarques | |
277 | 14 | André Domarques | 7.5</pre> |
278 | 5 | André Domarques | |
279 | <pre>uname -a |
||
280 | |||
281 | 14 | André Domarques | Linux redmine 3.2.0-4-amd64 #1 SMP Debian 3.2.57-3+deb7u2 x86_64 GNU/Linux</pre> |
282 | 1 | André Domarques | |
283 | <pre>cat /etc/hostname |
||
284 | |||
285 | redmine</pre> |
||
286 | |||
287 | <pre>dpkg -l |
||
288 | |||
289 | 14 | André Domarques | ii apache2 2.2.22-13+deb7u1 |
290 | 5 | André Domarques | ii git 1:1.7.10.4-1+wheezy1 |
291 | 1 | André Domarques | ii gitolite 2.3-1 |
292 | 14 | André Domarques | ii libapache2-mod-passenger 3.0.13debian-1+deb7u2 |
293 | ii libmagickcore-dev 8:6.7.7.10-5+deb7u3 |
||
294 | ii libmagickwand-dev 8:6.7.7.10-5+deb7u3 |
||
295 | ii mysql-server 5.5.37-0+wheezy1 |
||
296 | ii ruby-dev 1:1.9.3 |
||
297 | 1 | André Domarques | </pre> |
298 | |||
299 | <pre>gem env |
||
300 | |||
301 | RubyGems Environment: |
||
302 | - RUBYGEMS VERSION: 1.8.23 |
||
303 | - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux] |
||
304 | - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1 |
||
305 | - RUBY EXECUTABLE: /usr/bin/ruby1.9.1 |
||
306 | - EXECUTABLE DIRECTORY: /usr/local/bin |
||
307 | - RUBYGEMS PLATFORMS: |
||
308 | - ruby |
||
309 | - x86_64-linux |
||
310 | - GEM PATHS: |
||
311 | - /var/lib/gems/1.9.1 |
||
312 | - /opt/redmine/.gem/ruby/1.9.1 |
||
313 | - GEM CONFIGURATION: |
||
314 | 6 | André Domarques | - :update_sources => true |
315 | 1 | André Domarques | - :verbose => true |
316 | - :benchmark => false |
||
317 | - :backtrace => false |
||
318 | - :bulk_threshold => 1000 |
||
319 | - REMOTE SOURCES: |
||
320 | - http://rubygems.org/</pre> |
||
321 | }} |
||
322 | |||
323 | Hope this helps =D. |