Project

General

Profile

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

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

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