Project

General

Profile

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

Revision 9 (André Domarques, 2013-09-12 07:50) → Revision 10/19 (André Domarques, 2013-11-14 18:41)

h1. HowTo Install Redmine 2 integrated with Gitolite 2 on Debian Wheezy with Apache and Phusion Passenger 

 h2. About 

 A quick step-by-step for install Redmine and Gitolite plugin on Debian Wheezy mainly using default packages. 

 If I missed something, "let me know":http://www.redmine.org/users/85560 

 h2. Required packages 

 <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> 

 h2. Users and ssh-key 

 Create an user for Redmine and another for Gitolite: 

 <pre>adduser --system --shell /bin/bash --gecos 'Git Administrator' --group --disabled-password --home /opt/gitolite git 
 adduser --system --shell /bin/bash --gecos 'Redmine Administrator' --group --disabled-password --home /opt/redmine redmine</pre> 

 Generate a ssh-key for *redmine* user. This user will be used as admin of Gitolite. The name of key should be *gitolite_admin_id_rsa*. 

 <pre>sudo su - redmine 
 ssh-keygen -t rsa -N '' -f ~/.ssh/gitolite_admin_id_rsa 
 exit</pre> 

 h2. Configuring Gitolite 

 <pre>dpkg-reconfigure gitolite</pre> 

 Type data bellow: 

 * user: git 
 * repos path: /opt/gitolite 
 * admin ssh-key: /opt/redmine/.ssh/gitolite_admin_id_rsa.pub 

 {{collapse(Note about SSH) 

 If you try to connect gitolite (user: git) using redmine user via ssh, will be prompted password... OMG! See what happens: 

 <pre>redmine@redmine:~$ ssh -v git@localhost 
 ... 
 The authenticity of host 'localhost (::1)' can't be established. 
 ECDSA key fingerprint is d5:da:b9:10:c4:9b:51:75:65:f3:64:81:b5:6c:1a:1a. 
 Are you sure you want to continue connecting (yes/no)? yes 
 ... 
 ... 
 *debug1: Trying private key: /opt/redmine/.ssh/id_rsa* 
 *debug1: Trying private key: /opt/redmine/.ssh/id_dsa* 
 *debug1: Trying private key: /opt/redmine/.ssh/id_ecdsa* 
 debug1: Next authentication method: password 
 git@localhost's password:</pre> 

 You can solve this by simply creating a symbolic link: 

 <pre>ln -s /opt/redmine/.ssh/gitolite_admin_id_rsa /opt/redmine/.ssh/id_rsa</pre> 

 Or even using ssh -i identity_file (check http://unixhelp.ed.ac.uk/CGI/man-cgi?ssh+1 for more details) 

 }} 

 h2. Visudo configuration 

 <pre>visudo</pre> 

 Add the following lines: 

 <pre># temp - remove after installation 
 redmine      ALL=(ALL)        NOPASSWD:ALL 

 # redmine gitolite integration 
 redmine      ALL=(git)        NOPASSWD:ALL 
 git          ALL=(redmine)    NOPASSWD:ALL</pre> 

 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. 

 h2. Redmine installation 

 The installation and configuration is like the official documentation. Simply reproducing to maintain the flow on this how-to. 

 <pre>sudo su - redmine 
 cd ~ 
 wget http://rubyforge.org/frs/download.php/77023/redmine-2.3.2.tar.gz 
 tar zxf redmine-2.3.2.tar.gz 
 mv redmine-2.3.2/* . 
 rm -Rf redmine-2.3.2 
 </pre> 

 h3. Create database and user 

 <pre>mysql -u root -p 

 CREATE DATABASE redmine CHARACTER SET utf8; 
 CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'redmine'; 
 GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';</pre> 

 h3. Configure database and email 

 <pre>cd /opt/redmine/config 
 cp database.yml.example database.yml 
 cp configuration.yml.example configuration.yml</pre> 

 Check more at:  
 * http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Step-3-Database-connection-configuration 
 * http://www.redmine.org/projects/redmine/wiki/RedmineInstall#Configuration 

 Create plugin assets directory 

 <pre>cd ~ 
 mkdir public/plugin_assets 
 </pre> 

 Now finish the installation. 

 <pre>sudo gem install bundler 
 bundle install --without development test postgresql sqlite 
 rake generate_secret_token 
 RAILS_ENV=production rake db:migrate 
 RAILS_ENV=production rake redmine:load_default_data</pre> 

 

 h2. Redmine Gitolite integration 

 The plugin used on this how-to is the fork of jbox-web, you can get more information at: 
 * http://www.redmine.org/plugins/redmine-gitolite 
 * http://jbox-web.github.io/redmine_git_hosting/ 
 * https://github.com/jbox-web/redmine_git_hosting 

 Download. 

 <pre>cd ~/plugins 
 git clone https://github.com/jbox-web/redmine_git_hosting.git 
 git clone https://github.com/jbox-web/redmine_plugin_views_revisions.git</pre> https://github.com/jbox-web/redmine_git_hosting.git</pre> 

 Install. It's necessary to run bundle again to install some new gems required by redmine_git_hosting plugin. 

 <pre>cd ~ 
 bundle install 
 RAILS_ENV=production rake redmine:plugins:migrate 
 rake redmine_git_hosting:install_scripts RAILS_ENV=production WEB_USER=redmine</pre> 

 

 h2. Apache mod_passenger configuration 

 Create a symbolic link. 

 <pre>su root 
 cd /var/www 
 ln -s /opt/redmine/public redmine</pre> 

 Configure the site. 

 <pre>vi /etc/apache2/sites-available/redmine</pre> 

 With following content: 

 <pre>RailsBaseURI /redmine 
 PassengerUserSwitching on 
 PassengerUser redmine 
 PassengerGroup redmine</pre> 

 Enable the site and restart apache. 

 <pre>a2ensite redmine 
 service apache2 restart</pre> 


 {{collapse(Environment details) 

 Debian Wheezy (netinst - only with basic packages plus ssh server) 

 <pre>cat /etc/debian_version 

 7.1</pre> 

 <pre>uname -a 

 Linux redmine 3.2.0-4-amd64 #1 SMP Debian 3.2.46-1+deb7u1 x86_64 GNU/Linux)</pre> 

 <pre>cat /etc/hostname 

 redmine</pre> 

 <pre>dpkg -l 

 ii    apache2                              2.2.22-13 
 ii    git                                  1:1.7.10.4-1+wheezy1 
 ii    gitolite                             2.3-1 
 ii    libapache2-mod-passenger             3.0.13debian-1 
 ii    libmagickcore-dev                    8:6.7.7.10-5+deb7u2 
 ii    libmagickwand-dev                    8:6.7.7.10-5+deb7u2 
 ii    mysql-server                         5.5.31+dfsg-0+wheezy1 
 ii    ruby1.9.1-dev                        1.9.3.194-8.1+deb7u1 
 </pre> 

 <pre>gem env 

 RubyGems Environment: 
   - RUBYGEMS VERSION: 1.8.23 
   - RUBY VERSION: 1.9.3 (2012-04-20 patchlevel 194) [x86_64-linux] 
   - INSTALLATION DIRECTORY: /var/lib/gems/1.9.1 
   - RUBY EXECUTABLE: /usr/bin/ruby1.9.1 
   - EXECUTABLE DIRECTORY: /usr/local/bin 
   - RUBYGEMS PLATFORMS: 
     - ruby 
     - x86_64-linux 
   - GEM PATHS: 
      - /var/lib/gems/1.9.1 
      - /opt/redmine/.gem/ruby/1.9.1 
   - GEM CONFIGURATION: 
      - :update_sources => true 
      - :verbose => true 
      - :benchmark => false 
      - :backtrace => false 
      - :bulk_threshold => 1000 
   - REMOTE SOURCES: 
      - http://rubygems.org/</pre> 
 }} 

 Hope this helps =D.