How To

Install Redmine on Ubuntu 18.04 with MySQL, Passenger, and Nginx

Redmine is one of the most popular open-source project management and issue tracking platforms. It is built on the Ruby on Rails framework and supports multiple databases. A single Redmine installation gives your team multiple project support, wikis, a full issue tracking system, forums, calendars, email notifications, and Gantt charts in one self-hosted tool.

This guide covers how to install Redmine on Ubuntu 18.04 using MySQL as the database, Passenger as the Ruby application server, and Nginx as the SSL reverse proxy.

Prerequisites:

  • A domain name pointing to your server IP (this guide uses example.com)
  • Nginx installed with a Let’s Encrypt SSL certificate
  • Sudo access

Install Redmine on Ubuntu: MySQL, Ruby, and Passenger Setup

Create the MySQL database and user. Log in to the MySQL shell and run:

sqlCREATE DATABASE redmine CHARACTER SET utf8mb4;GRANT ALL ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'strong-password';EXIT;

Replace strong-password with a real password. You will need it when configuring the Redmine database file.

Install Ruby. The Ubuntu 18.04 repositories include Ruby 2.5.1:

bashsudo apt install ruby-full

Install Passenger. Passenger is the application server that connects Redmine to Nginx. Add the Phusion repository and install the Nginx module:

bashsudo apt install dirmngr gnupg apt-transport-https ca-certificatessudo apt-key adv --recv-keys --keyserver hkp://keyserver.ubuntu.com:80 561F9B9CAC40B2F7sudo add-apt-repository 'deb https://oss-binaries.phusionpassenger.com/apt/passenger bionic main'sudo apt updatesudo apt install libnginx-mod-http-passenger

Install build dependencies. Redmine needs native image processing libraries and the MySQL client development headers:

bashsudo apt install build-essential libmysqlclient-dev imagemagick libmagickwand-dev

Download Redmine, Install Dependencies, and Set Permissions

Download and extract Redmine. The latest stable version at the time of writing is 4.0.0. Check the Redmine download page for a newer release before running:

bashsudo curl -L https://www.redmine.org/releases/redmine-4.0.0.tar.gz -o /tmp/redmine.tar.gzcd /tmp && sudo tar zxf /tmp/redmine.tar.gzsudo mv /tmp/redmine-4.0.0 /opt/redmine

Configure the database connection. Copy the example config and open it for editing:

bashsudo cp /opt/redmine/config/database.yml.example /opt/redmine/config/database.ymlsudo nano /opt/redmine/config/database.yml

In the production: section, set adapter: mysql2 and fill in the database name, host, username, and the password you created earlier.

Install Ruby gem dependencies. The --without flag skips database adapters you are not using, keeping the install clean and fast:

bashcd /opt/redminesudo gem install bundler --no-rdoc --no-risudo bundle install --without development test postgresql sqlite

Generate the secret token and run database migrations. The secret token protects Redmine session data against tampering:

bashsudo bundle exec rake generate_secret_tokensudo RAILS_ENV=production bundle exec rake db:migrate

Set file ownership. Nginx runs as www-data and needs full access to the Redmine directory:

bashsudo chown -R www-data: /opt/redmine/

Configure Nginx for Redmine and Access the Web Interface

Create an Nginx server block at /etc/nginx/sites-available/example.com. The configuration needs three server blocks: one to redirect HTTP traffic to HTTPS, one to redirect www to the root domain, and one main HTTPS block. In the main block, set the document root to /opt/redmine/public, add passenger_enabled on to hand off requests to Passenger, set passenger_min_instances 1 so Redmine is always ready without a cold-start delay, and set client_max_body_size 10m to support file attachments.

Enable the site, verify the config, and restart Nginx:

bashsudo ln -s /etc/nginx/sites-available/example.com /etc/nginx/sites-enabled/sudo nginx -tsudo systemctl restart nginx

Open https://example.com in your browser. The Redmine login page loads. Default credentials are username admin and password admin. You are prompted to change the password immediately on first login.

Redmine is now running on your Ubuntu 18.04 server. Visit the Redmine documentation to configure email notifications, set up roles and permissions, and create your first project. Leave a comment below if you run into any issues.

Cyber Defence

Recent Posts

Install Samba on Ubuntu 18.04: Configure Shares and User Access

Samba is a free, open-source implementation of the SMB/CIFS network protocol that lets Linux servers share…

16 minutes ago

Set Up an OpenVPN Server on Ubuntu 18.04 with EasyRSA and UFW

Running your own VPN gives you full control over your traffic, privacy, and connection security. It encrypts…

26 minutes ago

Install IntelliJ IDEA on Ubuntu 18.04 via Snap: Setup Guide

IntelliJ IDEA is a full-featured IDE for JVM and Android development made by JetBrains. It includes…

41 minutes ago

Install Steam on Ubuntu 18.04: Multiverse Setup and First Run

Steam is a cross-platform digital distribution platform by Valve Corporation that gives you access to thousands…

46 minutes ago

Install VirtualBox on Ubuntu 18.04 from the Oracle Repository

VirtualBox is a free, open-source, cross-platform virtualization application maintained by Oracle. It lets you run multiple…

1 day ago

Install PostgreSQL on Ubuntu 18.04 with Remote Access Setup

PostgreSQL (also called Postgres) is a free, open-source, object-relational database management system with a strong reputation…

1 day ago