Project

General

Profile

HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger » History » Version 3

André Domarques, 2013-09-12 05:50

1 1 André Domarques
h1. HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger
2
3
HowTo Install Redmine 2.x (MySQL) integrated with Gitolite 2.x on Debian Wheezy with Apache and Phusion Passenger.
4
5
About:
6
A quick step-by-step for install Redmine and Gitolite plugin on Debian Wheezy mainly using default packages.
7
8
If I missed something, please "let me know":http://www.redmine.org/users/85560
9
10
h2. Required packages
11
12
<pre>apt-get -y install sudo ssh bzip2 zip unzip apache2 libapache2-mod-passenger mysql-server libmysqlclient-dev ruby ruby1.9.1-dev git git-core gitolite libmagickcore-dev libmagickwand-dev</pre>
13
14
h2. Users and ssh-key
15
16
Create an user for Redmine and another for Gitolite:
17
18
<pre>adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitolite git
19
adduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine</pre>
20
21
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*.
22
23
<pre>sudo su - redmine
24
ssh-keygen -t rsa -N '' -f ~/.ssh/redmine_gitolite_admin_id_rsa
25
exit</pre>
26
27
h2. Configuring Gitolite
28
29
<pre>dpkg-reconfigure gitolite</pre>
30
31
Type data bellow:
32
33
# user: git
34
# repos path: /opt/gitolite
35
# admin ssh-key: /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa.pub
36
37 3 André Domarques
{{collapse(Note about SSH)
38 2 André Domarques
39 1 André Domarques
If you try to connect gitolite (user: git) using redmine user via ssh, will be prompted password... OMG! but both users wasn't created without password? See what happens:
40
41
<pre>redmine@redmine:~$ ssh -v git@localhost</pre>
42
...
43
The authenticity of host 'localhost (::1)' can't be established.
44
ECDSA key fingerprint is d5:da:b9:10:c4:9b:51:75:65:f3:64:81:b5:6c:1a:1a.
45
Are you sure you want to continue connecting (yes/no)? yes
46
...
47
...
48
*debug1: Trying private key: /opt/redmine/.ssh/id_rsa*
49
*debug1: Trying private key: /opt/redmine/.ssh/id_dsa*
50
*debug1: Trying private key: /opt/redmine/.ssh/id_ecdsa*
51
debug1: Next authentication method: password
52
git@localhost's password:
53
54
You can solve this by simply creating a symbolic link:
55
56
<pre>ln -s /opt/redmine/.ssh/redmine_gitolite_admin_id_rsa /opt/redmine/.ssh/id_rsa</pre>
57
58
Or even using ssh -i identity_file (check http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1 for more details)
59 2 André Domarques
60 1 André Domarques
}}
61
62
h2. Visudo confguration
63
64
<pre>visudo</pre>
65
66
Add the following lines:
67
68
<pre># temp - remove after installation
69
redmine    ALL=(ALL)      NOPASSWD:ALL
70
71
# redmine gitolite integration
72
redmine    ALL=(git)      NOPASSWD:ALL
73
git        ALL=(redmine)  NOPASSWD:ALL</pre>
74
75
Note that redmine user will be able to run root commands, but this is just to simplify the next steps, remove that line after installation.
76
77
h2. Redmine installation
78
79
The installation and configuration is like the official documentation. Simply reproducing to maintain the flow on this how-to.
80
81
<pre>sudo su - redmine
82
cd ~
83
wget http://rubyforge.org/frs/download.php/77023/redmine-2.3.2.tar.gz
84
tar zxf redmine-2.3.2.tar.gz
85
mv redmine-2.3.2/* .
86
rm -Rf redmine-2.3.2
87
</pre>
88
89
h3. Create database and user
90
91
<pre>mysql -u root -p
92
93
CREATE DATABASE redmine CHARACTER SET utf8;
94
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine';
95
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';</pre>
96
97
h3. Configure database and email
98
99
<pre>cd /opt/redmine/config
100
cp database.yml.example database.yml
101
cp configuration.yml.example configuration.yml</pre>
102
103
Check more at: 
104
* http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-3-Database-connection-configuration
105
* http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Configuration
106
107
Create plugin assets directory
108
109
<pre>cd ~
110
mkdir public/plugin_assets
111
</pre>
112
113
Now finish the installation.
114
115
<pre>sudo gem install bundler
116
bundle install --without development test postgresql sqlite
117
rake generate_secret_token
118
RAILS_ENV=production rake db:migrate
119
RAILS_ENV=production rake redmine:load_default_data</pre>
120
121
h2. Redmine Gitolite integration
122
123
The plugin used on this how-to is the fork of jbox-web, you can get more information at:
124
http://www.redmine.org/plugins/redmine-gitolite
125
http://jbox-web.github.io/redmine_git_hosting/
126
https://github.com/jbox-web/redmine_git_hosting
127
128
Download.
129
130
<pre>cd ~/plugins
131
git clone https://github.com/jbox-web/redmine_git_hosting.git</pre>
132
133
Install. It's necessary to run bundle again to install some new gems required by redmine_git_hosting plugin.
134
135
<pre>cd ~
136
bundle install
137
RAILS_ENV=production rake redmine:plugins:migrate
138
rake redmine_git_hosting:install_scripts RAILS_ENV=production WEB_USER=redmine</pre>
139
140
h2. Apache mod_passenger configuration
141
142
Create a symbolic link.
143
144
<pre>su root
145
cd /var/www
146
ln -s /opt/redmine/public redmine</pre>
147
148
Configure the site
149
150
<pre>vi /etc/apache2/sites-available/redmine</pre>
151
RailsBaseURI /redmine
152
PassengerUserSwitching on
153
PassengerUser redmine
154
PassengerGroup redmine
155
156
Enable the site and restart apache.
157
158
<pre>a2ensite redmine
159
service apache2 restart</pre>
160
161
162 3 André Domarques
{{collapse(h2. Environment details)
163 1 André Domarques
164
Debian Wheezy (netinst - only with basic packages plus ssh server)
165
166
@cat /etc/debian_version@
167
168
<pre>7.1</pre>
169
170
@uname -a@
171
172
<pre>Linux redmine 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux)</pre>
173
174
@cat /etc/hostname@
175
<pre>redmine</pre>
176
177
@dpkg -l@
178
179
<pre>ii  apache2                            2.2.22-13
180
ii  git                                1:1.7.10.4-1+wheezy1
181
ii  gitolite                           2.3-1
182
ii  libapache2-mod-passenger           3.0.13debian-1
183
ii  libmagickcore-dev                  8:6.7.7.10-5+deb7u2
184
ii  libmagickwand-dev                  8:6.7.7.10-5+deb7u2
185
ii  mysql-server                       5.5.31+dfsg-0+wheezy1
186
ii  ruby1.9.1-dev                      1.9.3.194-8.1+deb7u1
187
</pre>
188
189
@gem env@
190
191
<pre>RubyGems Environment:
192
  - RUBYGEMS VERSION: 1.8.23
193
  - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux]
194
  - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1
195
  - RUBY EXECUTABLE: /usr/bin/ruby1.9.1
196
  - EXECUTABLE DIRECTORY: /usr/local/bin
197
  - RUBYGEMS PLATFORMS:
198
    - ruby
199
    - x86_64-linux
200
  - GEM PATHS:
201
     - /var/lib/gems/1.9.1
202
     - /opt/redmine/.gem/ruby/1.9.1
203
  - GEM CONFIGURATION:
204
     - :update_sources => true
205
     - :verbose => true
206
     - :benchmark => false
207
     - :backtrace => false
208
     - :bulk_threshold => 1000
209
  - REMOTE SOURCES:
210
     - http://rubygems.org/</pre>
211
}}
212
213
Hope this help =D.