Skip to main content

How to Install Redmine 5 on Debian 12

Redmine is a flexible project management web application. Written using the Ruby on Rails framework, it is cross-platform and cross-database. Redmine is open source and released under the terms of the GNU General Public License v2 (GPL).

Install requirements

sudo apt install postgresql ruby ruby-dev build-essential libpq-dev imagemagick ghostscript

Download Redmine

cd /opt/
wget https://www.redmine.org/releases/redmine-5.1.1.tar.gz

Check the SHA256SUM of the downloaded archive:

sha256sum redmine-5.1.1.tar.gz 

Extract the archive:

tar -xf redmine-5.1.1.tar.gz
ln -s /opt/redmine-5.1.1 /opt/redmine

Create an empty database and the user

sudo -u postgres psql
CREATE ROLE redmine LOGIN ENCRYPTED PASSWORD 'my_password' NOINHERIT VALID UNTIL 'infinity';
CREATE DATABASE redmine WITH ENCODING='UTF8' OWNER=redmine;
\c redmine
GRANT ALL ON SCHEMA public TO redmine;

Database configuration

Copy config/database.yml.example to config/database.yml and edit this file in order to configure your database settings for "production" environment.

cp config/database.yml.example config/database.yml
nano config/database.yml
production:
adapter: postgresql
database: redmine
host: localhost
username: redmine
password: "<postgres_user_password>"
encoding: utf8

Install Ruby dependencies

Puma

Add Puma gem:

nano Gemfile.local
# Gemfile.local
gem 'puma'
bundle3.1 config set --local without 'development test' 
bundle3.1 install

Session token generation

bundle3.1 exec rake generate_secret_token

Database schema objects creation

RAILS_ENV=production bundle3.1 exec rake db:migrate

Database default data set

RAILS_ENV=production bundle3.1 exec rake redmine:load_default_data

Filesystem permissions

Add redmine user:

adduser --system --group --no-create-home --shell /sbin/nologin redmine
chown -R redmine:redmine  /opt/redmine

Configurations

Redmine settings are defined in a file named config/configuration.yml. If you need to override default application settings, simply copy config/configuration.yml.example to config/configuration.yml.

Start the server

bundle3.1 exec rails server -e production

systemd

nano /lib/systemd/system/redmine.service
[Unit]
Description=Redmine
After=postgresql.service

[Service]
User=redmine
Group=redmine
WorkingDirectory=/opt/redmine/
Type=simple
Restart=always
RestartSec=1
ExecStart=/usr/bin/bundle3.1 exec rails server -e production

[Install]
WantedBy=multi-user.target
systemctl daemon-reload
systemctl enable --now redmine.service