HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger » History » Version 4
André Domarques, 2013-09-12 05:56
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 | 4 | André Domarques | <pre>redmine@redmine:~$ ssh -v git@localhost |
42 | 1 | André Domarques | ... |
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 | 4 | André Domarques | git@localhost's password:</pre> |
53 | 1 | André Domarques | |
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 | 4 | André Domarques | h2. Visudo configuration |
63 | 1 | André Domarques | |
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 | 4 | André Domarques | * 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 | 1 | André Domarques | |
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 | 4 | André Domarques | Configure the site. |
149 | 1 | André Domarques | |
150 | <pre>vi /etc/apache2/sites-available/redmine</pre> |
||
151 | 4 | André Domarques | |
152 | With following content: |
||
153 | |||
154 | <pre>RailsBaseURI /redmine |
||
155 | 1 | André Domarques | PassengerUserSwitching on |
156 | PassengerUser redmine |
||
157 | 4 | André Domarques | PassengerGroup redmine</pre> |
158 | 1 | André Domarques | |
159 | Enable the site and restart apache. |
||
160 | |||
161 | <pre>a2ensite redmine |
||
162 | service apache2 restart</pre> |
||
163 | |||
164 | |||
165 | 4 | André Domarques | {{collapse(Environment details) |
166 | 1 | André Domarques | |
167 | Debian Wheezy (netinst - only with basic packages plus ssh server) |
||
168 | |||
169 | @cat /etc/debian_version@ |
||
170 | |||
171 | <pre>7.1</pre> |
||
172 | |||
173 | @uname -a@ |
||
174 | |||
175 | <pre>Linux redmine 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux)</pre> |
||
176 | |||
177 | @cat /etc/hostname@ |
||
178 | <pre>redmine</pre> |
||
179 | |||
180 | @dpkg -l@ |
||
181 | |||
182 | <pre>ii apache2 2.2.22-13 |
||
183 | ii git 1:1.7.10.4-1+wheezy1 |
||
184 | ii gitolite 2.3-1 |
||
185 | ii libapache2-mod-passenger 3.0.13debian-1 |
||
186 | ii libmagickcore-dev 8:6.7.7.10-5+deb7u2 |
||
187 | ii libmagickwand-dev 8:6.7.7.10-5+deb7u2 |
||
188 | ii mysql-server 5.5.31+dfsg-0+wheezy1 |
||
189 | ii ruby1.9.1-dev 1.9.3.194-8.1+deb7u1 |
||
190 | </pre> |
||
191 | |||
192 | @gem env@ |
||
193 | |||
194 | <pre>RubyGems Environment: |
||
195 | - RUBYGEMS VERSION: 1.8.23 |
||
196 | - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux] |
||
197 | - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1 |
||
198 | - RUBY EXECUTABLE: /usr/bin/ruby1.9.1 |
||
199 | - EXECUTABLE DIRECTORY: /usr/local/bin |
||
200 | - RUBYGEMS PLATFORMS: |
||
201 | - ruby |
||
202 | - x86_64-linux |
||
203 | - GEM PATHS: |
||
204 | - /var/lib/gems/1.9.1 |
||
205 | - /opt/redmine/.gem/ruby/1.9.1 |
||
206 | - GEM CONFIGURATION: |
||
207 | - :update_sources => true |
||
208 | - :verbose => true |
||
209 | - :benchmark => false |
||
210 | - :backtrace => false |
||
211 | - :bulk_threshold => 1000 |
||
212 | - REMOTE SOURCES: |
||
213 | - http://rubygems.org/</pre> |
||
214 | }} |
||
215 | |||
216 | Hope this help =D. |