Skip to main content
  1. Posts/

Install Redmine on Debian

·350 words·2 mins

Install #

Instal Requirements #

Passenger #

Passenger will be the the application server to run Ruby on Rails app.

apt-get install -y dirmngr gnupg
apt-key adv --keyserver hkp:// --recv-keys 561F9B9CAC40B2F7
apt-get install -y apt-transport-https ca-certificates
sh -c 'echo deb buster main > /etc/apt/sources.list.d/passenger.list'
apt update

Packages #

apt install ruby-dev mariadb-server libmariadb-dev git imagemagick ghostscript build-essential patch zlib1g-dev liblzma-dev nginx libnginx-mod-http-passenger certbot python3-certbot-nginx -y

Redmine #

Download Redmine from here.


Check the checksum:

sha256sum redmine-4.1.1.tar.gz

Extract the tar file:

tar -xf redmine-4.1.1.tar.gz -C /var/www

Create a link for easier version management:

ln -s /var/www/redmine-4.1.1/ /var/www/redmine

Configure MariaDB #

Initialize MariaDB:


Create the database for Redmine:

mysql -u root -p
create database [REDMINEDB] character set utf8mb4;
grant all on [REDMINEDB].* to [REDMINEUSER]@localhost identified by 'S3cur3P4ssw0rd';
flush privileges;

Configure Redmine #

cd /var/www/redmine/
cp config/database.yml.example config/database.yml
nano config/database.yml
  adapter: mysql2
  database: [REDMINEDB]
  host: localhost
  username: [REDMINEUSER]
  password: "S3cur3P4ssw0rd"
  encoding: utf8mb4
gem install bundler
bundle install --without development test
bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data
chown -R www-data:www-data /var/www/redmine/

Because of Passenger’s sandboxing system, Redmine will be running as www-data.

Verify it later with ps:

ps aux | grep redmine
www-data 19895  0.0  8.7 484136 173532 ?       Sl   Jun20   0:06 Passenger AppPreloader: /var/www/redmine (forking...)

Get a certificate from Let’s Encrypt #

certbot certonly --nginx -d --rsa-key-size 4096

Configure Nginx #

A basic Nginx config:

# https
server {

        listen [::]:443 ssl http2;
        listen 443 ssl http2;

        ssl_certificate /etc/letsencrypt/live/;
        ssl_certificate_key /etc/letsencrypt/live/;

        root /var/www/redmine/public;

        passenger_enabled on;
        passenger_ruby /usr/bin/ruby;
        passenger_sticky_sessions on;

# redirect http to https
server {

        listen 80;
        listen [::]:80;
        return 301 https://$host$request_uri;

Append passenger_show_version_in_header off; to the http context to hide Passenger version number.

Configure #


To use your own SMTP server edit configuration.yml:

nano /var/www/redmine/config/configuration.yml
    delivery_method: :smtp
      port: 587
      enable_starttls_auto: true
      authentication: :login
      password: SmtpP4ssw0rd

Attachment storage path #

For the easier version management, store the attachments outside of the web root. I made a directory in /etc:

mkdir -p /etc/redmine/storage
chown -R www-data:www-data /etc/redmine

Modify configuration.yml:

nano /var/www/redmine/config/configuration.yml
  attachments_storage_path: /etc/redmine/storage