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

Revision 8 (André Domarques, 2013-09-12 07:50) → Revision 9/19 (André Domarques, 2013-09-12 07:50)

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

 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*. *redmine_gitolite_admin_id_rsa*. 

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


 h2. Configuring Gitolite 

 <pre>dpkg-reconfigure gitolite</pre> 

 Type data bellow: 

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

 {{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 for more details) 


 h2. Visudo configuration 


 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 ~ 
 tar zxf redmine-2.3.2.tar.gz 
 mv redmine-2.3.2/* . 
 rm -Rf redmine-2.3.2 

 h3. Create database and user 

 <pre>mysql -u root -p 

 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:  

 Create plugin assets directory 

 <pre>cd ~ 
 mkdir public/plugin_assets 

 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: 


 <pre>cd ~/plugins 
 git clone</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 


 <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 


 <pre>dpkg -l 

 ii    apache2                              2.2.22-13 
 ii    git                                  1: 
 ii    gitolite                             2.3-1 
 ii    libapache2-mod-passenger             3.0.13debian-1 
 ii    libmagickcore-dev                    8: 
 ii    libmagickwand-dev                    8: 
 ii    mysql-server                         5.5.31+dfsg-0+wheezy1 
 ii    ruby1.9.1-dev               

 <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 
     - ruby 
     - x86_64-linux 
   - GEM PATHS: 
      - /var/lib/gems/1.9.1 
      - /opt/redmine/.gem/ruby/1.9.1 
      - :update_sources => true 
      - :verbose => true 
      - :benchmark => false 
      - :backtrace => false 
      - :bulk_threshold => 1000 

 Hope this helps =D.