How To

Install Redmine on Ubuntu 24.04

Redmine is an open-source project management application built on Ruby on Rails. It handles issue tracking, Gantt charts, wiki pages, time tracking, role-based access control, and multiple project support from a single web interface. It supports plugins and has been around since 2006 with active development – Redmine 6.1.2 is the current stable release.

Original content from computingforgeeks.com - post 54290

This guide walks through a complete Redmine 6.1 installation on Ubuntu 24.04 LTS using MariaDB as the database backend, Puma as the application server, and Nginx as the reverse proxy. Every command has been written for a fresh Ubuntu 24.04 server.

Prerequisites

Before starting, make sure you have the following in place:

  • A server running Ubuntu 24.04 LTS with at least 2 GB RAM and 2 CPU cores
  • Root or sudo access to the server
  • A domain name pointed to your server IP (for SSL setup)
  • Ports 80 (HTTP), 443 (HTTPS), and 3000 (Puma, local only) available

Step 1: Install Redmine Dependencies on Ubuntu 24.04

Redmine 6.1 requires Ruby 3.2+, a C compiler for native gem extensions, and several development libraries. Ubuntu 24.04 ships Ruby 3.2 in the default repositories, which meets the requirement.

Update the package index and install all required packages:

sudo apt update
sudo apt install -y ruby ruby-dev build-essential libmariadb-dev libxml2-dev libxslt1-dev zlib1g-dev imagemagick libmagickwand-dev curl git

Install Bundler, which manages Ruby gem dependencies for Redmine:

sudo gem install bundler

Verify the Ruby and Bundler versions installed:

ruby --version
bundler --version

You should see Ruby 3.2.x and Bundler 2.x confirmed in the output:

ruby 3.2.3 (2024-01-18 revision 52bb2ac0a6) [x86_64-linux-gnu]
Bundler version 2.6.2

Step 2: Install MariaDB Database Server

Redmine stores all project data, issues, and user information in a relational database. MariaDB is a solid choice and works well with Redmine 6.1. If you need a more detailed MariaDB installation guide on Ubuntu, we have a dedicated article covering that.

Install the MariaDB server and client packages:

sudo apt install -y mariadb-server mariadb-client

Start and enable MariaDB so it runs on boot:

sudo systemctl enable --now mariadb

Confirm the service is active and running:

sudo systemctl status mariadb --no-pager

The output should show active (running) status. Run the security hardening script to set a root password and remove test databases:

sudo mariadb-secure-installation

Answer the prompts – set a strong root password, remove anonymous users, disable remote root login, and drop the test database.

Step 3: Create Redmine Database and User

Create a dedicated database and user for Redmine. Never run applications using the database root account in production.

Log in to the MariaDB shell:

sudo mariadb -u root -p

Run the following SQL statements to create the database, user, and grant privileges:

CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'StrongPassword123!';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Replace StrongPassword123! with a secure password of your choice. Keep note of it – you will need it when configuring Redmine’s database connection.

Step 4: Download and Extract Redmine 6.1

Download the latest stable Redmine release directly from the official site. We install it under /opt/redmine which keeps application files separate from system directories.

cd /tmp
curl -LO https://www.redmine.org/releases/redmine-6.1.2.tar.gz

Extract the archive and move it to the installation directory:

tar xzf redmine-6.1.2.tar.gz
sudo mv redmine-6.1.2 /opt/redmine

Create a dedicated system user to run Redmine. Running it as root is a security risk:

sudo useradd -r -m -d /opt/redmine -s /bin/bash redmine
sudo chown -R redmine:redmine /opt/redmine

Step 5: Configure Redmine Database Connection

Redmine reads its database settings from config/database.yml. Copy the example file and edit it with your database credentials.

Copy the example configuration:

sudo cp /opt/redmine/config/database.yml.example /opt/redmine/config/database.yml

Open the file for editing:

sudo vi /opt/redmine/config/database.yml

Update the production section with your MariaDB connection details:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "StrongPassword123!"
  encoding: utf8mb4

Set proper ownership so only the Redmine user can read the credentials:

sudo chown redmine:redmine /opt/redmine/config/database.yml
sudo chmod 600 /opt/redmine/config/database.yml

Step 6: Install Gems and Initialize the Database

Redmine uses Bundler to manage its Ruby dependencies. Switch to the Redmine user and install the required gems, excluding development and test groups to keep the install lean.

sudo -u redmine -H bash -c "cd /opt/redmine && bundle config set --local without 'development test'
cd /opt/redmine && bundle install"

This installs all production gems including the mysql2 adapter, puma web server, and Rails framework. The process takes a few minutes depending on your server speed.

Generate a random secret token used for session encryption:

sudo -u redmine -H bash -c "cd /opt/redmine && bundle exec rake generate_secret_token"

Run the database migrations to create all required tables in the Redmine database:

sudo -u redmine -H bash -c "cd /opt/redmine && RAILS_ENV=production bundle exec rake db:migrate"

Load the default configuration data (roles, trackers, issue statuses, and workflows):

sudo -u redmine -H bash -c "cd /opt/redmine && RAILS_ENV=production REDMINE_LANG=en bundle exec rake redmine:load_default_data"

Set the correct permissions on directories Redmine needs to write to:

sudo mkdir -p /opt/redmine/tmp /opt/redmine/tmp/pdf /opt/redmine/public/plugin_assets
sudo chown -R redmine:redmine /opt/redmine/tmp /opt/redmine/public/plugin_assets /opt/redmine/log /opt/redmine/files

Step 7: Configure Puma Application Server with Nginx

Puma ships with Redmine 6.1 and handles Ruby application requests. Nginx sits in front as a reverse proxy, handling SSL termination and static file serving. This is the recommended production setup.

Install Nginx:

sudo apt install -y nginx

Create an Nginx virtual host configuration for Redmine. Replace redmine.example.com with your actual domain:

sudo vi /etc/nginx/sites-available/redmine

Add the following configuration:

upstream redmine_puma {
    server 127.0.0.1:3000;
}

server {
    listen 80;
    server_name redmine.example.com;

    root /opt/redmine/public;

    # Serve static files directly through Nginx
    location / {
        try_files $uri @redmine;
    }

    location @redmine {
        proxy_pass http://redmine_puma;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
        proxy_redirect off;

        # File upload size - adjust based on your needs
        client_max_body_size 100m;
    }
}

Enable the site and remove the default Nginx configuration:

sudo ln -s /etc/nginx/sites-available/redmine /etc/nginx/sites-enabled/redmine
sudo rm -f /etc/nginx/sites-enabled/default

Test the Nginx configuration for syntax errors:

sudo nginx -t

A successful test returns the following:

nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

Restart Nginx to apply the changes:

sudo systemctl restart nginx
sudo systemctl enable nginx

Step 8: Create a Systemd Service for Redmine

A systemd unit file ensures Redmine starts automatically on boot and can be managed with standard systemctl commands.

Create the service file:

sudo vi /etc/systemd/system/redmine.service

Add the following unit configuration:

[Unit]
Description=Redmine Project Manager
After=network.target mariadb.service

[Service]
Type=simple
User=redmine
Group=redmine
WorkingDirectory=/opt/redmine
ExecStart=/usr/bin/bundle exec puma -C /opt/redmine/config/puma.rb -e production
Restart=on-failure
RestartSec=10
StandardOutput=journal
StandardError=journal
Environment=RAILS_ENV=production
Environment=RAILS_LOG_TO_STDOUT=true

[Install]
WantedBy=multi-user.target

Create a Puma configuration file that binds to port 3000:

sudo vi /opt/redmine/config/puma.rb

Add the following Puma settings:

# Puma configuration for Redmine
bind "tcp://127.0.0.1:3000"
environment "production"
threads 2, 8
workers 2
pidfile "/opt/redmine/tmp/pids/server.pid"
state_path "/opt/redmine/tmp/pids/puma.state"
directory "/opt/redmine"
stdout_redirect "/opt/redmine/log/puma_access.log", "/opt/redmine/log/puma_error.log", true

Set correct ownership on the Puma config file:

sudo chown redmine:redmine /opt/redmine/config/puma.rb
sudo mkdir -p /opt/redmine/tmp/pids
sudo chown -R redmine:redmine /opt/redmine/tmp/pids

Reload systemd, start Redmine, and enable it on boot:

sudo systemctl daemon-reload
sudo systemctl enable --now redmine

Verify the service is running:

sudo systemctl status redmine --no-pager

The output should show active (running). If the service fails, check the logs for errors:

sudo journalctl -u redmine --no-pager -n 50

Step 9: Access Redmine Web Interface and Initial Setup

Open your browser and navigate to your server’s domain or IP address. The Redmine login page should load.

Log in with the default administrator credentials:

  • Username: admin
  • Password: admin

Redmine forces a password change on first login. Set a strong password immediately.

After logging in, configure these essential settings under Administration:

  • Settings > General – set the application title and default language
  • Settings > Authentication – disable self-registration if running internally, or enable with email activation for public instances
  • Settings > Email notifications – configure SMTP for email delivery (issue assignments, status updates)
  • Settings > Repositories – enable Git/SVN integration if you plan to link code repositories

Create your first project by going to Projects > New Project. Enable the modules you need – issue tracking, wiki, time tracking, Gantt chart, and repository browser are the most commonly used.

Step 10: Configure Firewall and SSL with Let’s Encrypt

If UFW is active on your server, open the required ports for HTTP and HTTPS traffic:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw reload

Verify the firewall rules are in place:

sudo ufw status

For production deployments, SSL is not optional. Install Certbot to obtain a free Let’s Encrypt SSL certificate:

sudo apt install -y certbot python3-certbot-nginx

Request and install the certificate. Certbot automatically modifies your Nginx configuration to enable HTTPS:

sudo certbot --nginx -d redmine.example.com

Follow the prompts to enter your email and accept the terms. Certbot handles the ACME challenge, installs the certificate, and configures Nginx to redirect HTTP to HTTPS.

Verify the certificate auto-renewal is set up correctly:

sudo certbot renew --dry-run

A successful dry run confirms automatic renewal will work. Certbot installs a systemd timer that handles renewals before certificates expire.

Conclusion

You now have a working Redmine 6.1.2 installation on Ubuntu 24.04 with MariaDB, Puma, and Nginx. The setup includes a systemd service for process management and Let’s Encrypt SSL for encrypted connections. For a production environment, consider setting up regular database backups with mariadb-dump, configuring email notifications via SMTP, and enabling the Redmine plugin ecosystem for additional functionality like agile boards and CRM integration.

Related Articles

Security Install KeeWeb Password Manager on Ubuntu 24.04 / 22.04 Kubernetes Deploy Kubernetes Cluster with Rancher on RHEL 10 / Ubuntu 24.04 Ubuntu Install Latest Adobe Flash Player On Ubuntu Linux Virtualization How To Install Virtualbox on Ubuntu and Kali Linux

2 thoughts on “Install Redmine on Ubuntu 24.04”

  1. Great tutorial. I spent too much time on other tutorials that would just not work. But you got me up and running in 20 minutes!

    Reply

Leave a Comment

Press ESC to close