====== 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:
DocumentRoot /var/www/redmine
PassengerDefaultUser www-data
RailsEnv production
RailsBaseURI /
SetEnv X_DEBIAN_SITEID "default"
Order allow,deny
Allow from all
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:
- Usuario: ''gitolite''
- Directorio: ''/var/lib/gitolite''
- 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 =====
* Cambiar idioma por defecto al gallego
* Configurar LDAP
* Deshabilitar SVN, CVS, etc. dejando habilitado únicamente Git
* Configurar correo
* Crear archivo ''/etc/redmine/default/configuration.yml'' con la configuración del servidor de correo, por ejemplo:
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: smtp.usc.es
port: 25
domain: usc.es
authentication: :none
* Modificar el archivo ''/usr/share/redmine/vendor/plugins/redmine_git_hosting/app/views/repositories/git_instructions.html.erb'' para especificar la URL correcta al repositorio GIT:
<% #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' %>