Táboa de Contidos

Instalar Redmine con Gitolite en Ubuntu

Instalar Redmine 1.x

apt-get install redmine redmine-mysql

Actualizar a Redmine 2.x (no hacerlo por ahora, ya que no funciona el plugin de Gitolite)

add-apt-repository ppa:brightbox/passenger
add-apt-repository ppa:ondrej/redmine
apt-get update
apt-get install redmine redmine-mysql
sed -i s/AbstractAdapter/AbstractMysqlAdapter/ /usr/share/redmine/config/initializers/10-patches.rb
apt-get -f install

Configurar Apache2 y Passenger

apt-get install libapache2-mod-passenger apache2
ln -s /usr/share/redmine /var/www/redmine

Crear el archivo etc/apache2/sites-available/redmine con el siguiente contenido:

<VirtualHost *:80>
  DocumentRoot /var/www/redmine
  PassengerDefaultUser www-data
  RailsEnv production
  RailsBaseURI /
  SetEnv X_DEBIAN_SITEID "default"
  <Directory /var/www/redmine>
    Order allow,deny
    Allow from all
  </Directory>
</VirtualHost>

Y reiniciar apache:

service apache2 restart

Instalar GIT + Gitolite

sudo useradd gitolite --home-dir=/var/lib/gitolite/ --create-home --shell=/bin/
useradd git --home-dir=/srv/git/ --create-home --shell=/bin/
sudo apt-get install gitolite
su - gitolite
ssh-keygen
gitolite setup -pk /var/lib/gitolite/.ssh/id_rsa.pub
dpkg-reconfigure gitolite

En este punto, responder a las preguntas de dpkg:

  1. Usuario: gitolite
  2. Directorio: /var/lib/gitolite
  3. Clave: /var/lib/gitolite/.ssh/id_rsa.pub

Instalar el plugin de Redmine para Git

mkdir /usr/share/redmine/vendor/plugins
cd /usr/share/redmine/vendor/plugins
git clone https://github.com/ericpaulbishop/redmine_git_hosting
cd redmine_git_hosting
sed -i "s/'git'/'gitolite'/" init.rb
mkdir /usr/share/redmine/.ssh
cp /var/lib/gitolite/.ssh/id_rsa.pub /usr/share/redmine/.ssh/gitolite_admin_id_rsa.pub
cp /var/lib/gitolite/.ssh/id_rsa /usr/share/redmine/.ssh/gitolite_admin_id_rsa
chown -R www-data:www-data /usr/share/redmine/.ssh
chmod 0700 /usr/share/redmine/.ssh
chmod 0600 /usr/share/redmine/.ssh/gitolite_admin_id_rsa
echo -e "www-data    ALL=(gitolite)   NOPASSWD:ALL\ngitolite    ALL=(www-data)   NOPASSWD:ALL" > /etc/sudoers.d/git
chmod 0440 /etc/sudoers.d/git
cd /usr/share/redmine
bundle install
sudo -u www-data env RAILS_ENV=production rake db:migrate_plugins

Pasos postinstalación

production:
  email_delivery:
    delivery_method: :smtp
    smtp_settings:
      address: smtp.usc.es
      port: 25
      domain: usc.es
      authentication: :none
<% #git_ssh_url = Setting.plugin_redmine_git_hosting['gitUser'] + "@" + Setting.plugin_redmine_git_hosting['gitServer'] + ":" + GitHosting.repository_name(@project) + '.git'  %>
<% git_ssh_url = "ssh://" + Setting.plugin_redmine_git_hosting['gitUser'] + "@172.16.242.41:8022/" + GitHosting.repository_name(@project) + '.git'  %>