Debian 9 64 bits – Installation Redmine

Auteur : Vince Nadus
Date de publication : 30 juin 2018
lamp apache serveurs web mariadb php

Documentation basé sur :

https://www.hiroom2.com/2017/06/21/debian-9-install-redmine/ 01-Pré-requis

apt-get install libapache2-mod-passenger apache2 apache2-dev mariadb-server default-libmysqlclient-dev gcc build-essential zlib1g zlib1g-dev zlibc ruby-zip libssl-dev libyaml-dev libcurl4-openssl-dev php ruby gem libapr1-dev libxslt1-dev checkinstall libxml2-dev ruby-dev vim libmagickwand-dev imagemagick rails

02- Téléchargement

wget http://www.redmine.org/releases/redmine-3.4.6.tar.gz tar xzf redmine-3.4.6.tar.gz mv redmine-3.4.6 /var/www/html

Site officiel : https://www.redmine.org/projects/redmine/wiki/Download 03-Configuration

Afin de contourner l’erreur « exceed limit » lors de la création de notre base de donnée, nous devons mettre en place un petit fix (merci à Stanislav Tilsh pour son partage)

nano /var/www/html/redmine-3.4.6/config/initializers/ar_innodb_row_format.rb

Collez-y ceci

ActiveSupport.on_load :active_record do module ActiveRecord::ConnectionAdapters class AbstractMysqlAdapter def create_table_with_innodb_row_format(table_name, options = {}) table_options = options.reverse_merge(:options => 'ENGINE=InnoDB ROW_FORMAT=DYNAMIC') create_table_without_innodb_row_format(table_name, table_options) do |td| yield td if block_given? end end alias_method_chain :create_table, :innodb_row_format end end end

Création de la base de données

mysql -u root -p

CREATE DATABASE redmine CHARACTER SET utf8mb4;

CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'my_password';

GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';

exit

Nous venons de créer une nouvelle table : redmine, un utilisateur redmine, enfin nous donnons les droits à ce nouvel utilisateur sur la table. Configuration de la base de données

cd /var/www/html/redmine-3.4.6/config

cp database.yml.example database.yml

nano database.yml

Modifiez le fichier comme suit (attention à bien modifier le champ password)

production: adapter: mysql2 database: redmine host: localhost username: redmine password: my_pasword encoding: utf8

Installer bundler

gem install bundler

Installation des gem nécessaires

bundle install --without development test

Générer le token secret

bundle exec rake generate_secret_token

Déployer et installer la base de données

RAILS_ENV=production bundle exec rake db:migrate RAILS_ENV=production bundle exec rake redmine:load_default_data

Afin de tester notre configuration, exècutez la commande

bundle exec ruby bin/rails server -b IP webrick -e production

Si tout s’est bien passé, Redmine est désormais accessible via : http://Mon_IP:3000

Configuration d’apache

Renommer le répertoire

cd /var/www/html mv redmine-3.4.6 redmine

Mettre à jour les droits

cd /var/www/html/redmine chown -R www-data files log tmp public/plugin_assets chmod -R 755 files log tmp public/plugin_assets

Création du virtualhost apache

nano /etc/apache2/sites-available/redmine.conf

Collez-y ceci

<VirtualHost *:3000> RailsEnv production DocumentRoot /var/www/html/redmine/public <Directory "/var/www/html/redmine/public"> Allow from all Require all granted </Directory> </VirtualHost>

Activer notre nouvelle configuration

a2ensite redmine

Ajouter l’écoute du port 3000 à la configuration d’apache

nano /etc/apache2/ports.conf

Ajouter cette ligne en dessous de Listen 80

Listen 3000

Enfin, nous devons redémarrer apache afin que nos configurations soient bien pris en compte

/etc/init.d/apache2 restart

Redmine est désormais accessible via : http://Mon_IP:3000 !