UbuntuUbuntu Based

How To Install Redmine on Ubuntu 24.04 LTS

Install Redmine on Ubuntu 24.04

Redmine is a powerful, open-source project management and issue tracking tool that has become increasingly popular among developers, project managers, and organizations of all sizes. Its flexibility, extensive feature set, and customization options make it an excellent choice for teams looking to streamline their project workflows. In this comprehensive guide, we’ll walk you through the process of installing Redmine on Ubuntu 24.04, the latest long-term support release of the popular Linux distribution.

Ubuntu 24.04, known for its stability and robust package management system, provides an ideal platform for hosting Redmine. By following this step-by-step tutorial, you’ll be able to set up a fully functional Redmine instance, ready to enhance your team’s collaboration and project management capabilities.

Prerequisites

Before we dive into the installation process, let’s ensure you have everything you need to successfully set up Redmine on your Ubuntu 24.04 system:

  • A clean installation of Ubuntu 24.04 LTS (server or desktop edition)
  • Root or sudo access to the system
  • A stable internet connection for downloading packages
  • At least 2GB of RAM (4GB or more recommended for optimal performance)
  • Minimum 10GB of free disk space

Additionally, you should have basic familiarity with the Linux command line interface, as we’ll be using terminal commands throughout this guide.

Preparing the Ubuntu 24.04 Environment

To ensure a smooth installation process, we’ll start by updating our Ubuntu system and installing essential dependencies.

Updating the System

Open a terminal and run the following commands:

sudo apt update
sudo apt upgrade -y

This will update the package lists and upgrade all installed packages to their latest versions.

Installing Essential Dependencies

Next, we’ll install some necessary packages that Redmine depends on:

sudo apt install -y build-essential libssl-dev libreadline-dev zlib1g-dev libcurl4-openssl-dev libmysqlclient-dev libpq-dev

Configuring the Firewall

If you’re using Ubuntu’s default firewall (UFW), you’ll need to allow HTTP and HTTPS traffic:

sudo ufw allow 80/tcp
sudo ufw allow 443/tcp
sudo ufw enable

Installing Ruby

Redmine is built on Ruby, so we need to install the correct version. While Ubuntu 24.04 comes with Ruby pre-installed, it’s often an older version. We’ll use RVM (Ruby Version Manager) to install and manage Ruby versions.

Installing RVM

First, install the required dependencies for RVM:

sudo apt install -y gnupg2 curl

Now, install RVM:

curl -sSL https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm

Installing Ruby

Install the latest stable version of Ruby:

rvm install ruby --latest
rvm use ruby --latest --default

Verifying the Installation

Check that Ruby is installed correctly:

ruby --version

You should see output indicating the installed Ruby version.

Setting Up the Database

Redmine supports multiple database systems, but PostgreSQL and MySQL are the most commonly used. We’ll cover both options, so you can choose the one that best fits your needs.

Option 1: Installing and Configuring PostgreSQL

To install PostgreSQL:

sudo apt install -y postgresql postgresql-contrib

Create a database and user for Redmine:

sudo -u postgres psql
CREATE DATABASE redmine;
CREATE USER redmine WITH PASSWORD 'your_password';
GRANT ALL PRIVILEGES ON DATABASE redmine TO redmine;
\q

Option 2: Installing and Configuring MySQL

To install MySQL:

sudo apt install -y mysql-server mysql-client

Secure your MySQL installation:

sudo mysql_secure_installation

Create a database and user for Redmine:

sudo mysql -u root -p
CREATE DATABASE redmine CHARACTER SET utf8mb4;
CREATE USER 'redmine'@'localhost' IDENTIFIED BY 'your_password';
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost';
FLUSH PRIVILEGES;
EXIT;

Installing Redmine

Now that we have our environment set up, let’s install Redmine itself.

Downloading Redmine

Download the latest stable version of Redmine:

cd /opt
sudo wget https://www.redmine.org/releases/redmine-5.1.3.tar.gz
sudo tar xzf redmine-5.1.3.tar.gz
sudo mv redmine-5.1.3 redmine
sudo chown -R $USER:$USER redmine

Configuring Redmine

Copy the example database configuration file:

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

Edit the configuration file to match your database settings:

nano config/database.yml

For PostgreSQL, use:

production:
  adapter: postgresql
  database: redmine
  host: localhost
  username: redmine
  password: "your_password"
  encoding: utf8

For MySQL, use:

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

Installing Required Gems

Install the required Ruby gems:

gem install bundler
bundle install --without development test

Configuring Redmine

With Redmine installed, we need to perform some additional configuration steps.

Generating a Secret Token

Generate a secret token for secure session handling:

bundle exec rake generate_secret_token

Setting Up the Database Schema

Create the database schema and load default data:

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

Configuring Email Settings

Copy the example configuration file:

cp config/configuration.yml.example config/configuration.yml
nano config/configuration.yml

Edit the email settings according to your SMTP server configuration.

Setting Up a Web Server

To serve Redmine, we’ll use Nginx as our web server and Passenger as the application server.

Installing Nginx and Passenger

sudo apt install -y nginx
gem install passenger
passenger-install-nginx-module

Follow the on-screen instructions to complete the Passenger installation.

Configuring Nginx

Edit the Nginx configuration file:

sudo nano /etc/nginx/nginx.conf

Add the following server block within the http block:

server {
    listen 80;
    server_name your_domain.com;
    root /opt/redmine/public;
    passenger_enabled on;
    client_max_body_size 10m;
}

Restart Nginx to apply the changes:

sudo systemctl restart nginx

Securing Redmine

Security is crucial for any web application. Let’s implement some basic security measures for our Redmine installation.

Implementing SSL/TLS

To enable HTTPS, you’ll need an SSL certificate. You can obtain a free certificate from Let’s Encrypt:

sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d your_domain.com

Follow the prompts to complete the certificate installation and Nginx configuration.

Configuring User Authentication

Redmine provides built-in user authentication. To enhance security, consider implementing two-factor authentication or integrating with LDAP if needed for your organization.

Setting Up Regular Backups

Create a backup script to regularly save your Redmine data:

#!/bin/bash
BACKUP_DIR="/path/to/backup/directory"
REDMINE_DIR="/opt/redmine"
DB_NAME="redmine"
DB_USER="redmine"
DB_PASS="your_password"

# Backup files
tar -czf $BACKUP_DIR/redmine_files_$(date +%Y%m%d).tar.gz $REDMINE_DIR

# Backup database
pg_dump -U $DB_USER $DB_NAME > $BACKUP_DIR/redmine_db_$(date +%Y%m%d).sql

# Or for MySQL:
# mysqldump -u $DB_USER -p$DB_PASS $DB_NAME > $BACKUP_DIR/redmine_db_$(date +%Y%m%d).sql

Schedule this script to run regularly using cron.

Troubleshooting Common Issues

Even with careful installation, you might encounter some issues. Here are solutions to common problems:

Database Connection Problems

If Redmine can’t connect to the database, double-check your database.yml file for correct credentials. Ensure the database server is running and accessible.

Ruby Version Conflicts

If you encounter Ruby version conflicts, make sure you’re using the correct version as specified in Redmine’s requirements. Use RVM to switch between Ruby versions if needed.

Web Server Configuration Errors

Check your Nginx error logs (/var/log/nginx/error.log) for any configuration issues. Ensure that the Passenger module is correctly installed and the server block is properly configured.

Congratulations! You have successfully installed Redmine. Thanks for using this tutorial for installing the Redmine project management web application on Ubuntu 24.04 LTS system. For additional help or useful information, we recommend you check the official Redmine website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!

r00t

r00t is an experienced Linux enthusiast and technical writer with a passion for open-source software. With years of hands-on experience in various Linux distributions, r00t has developed a deep understanding of the Linux ecosystem and its powerful tools. He holds certifications in SCE and has contributed to several open-source projects. r00t is dedicated to sharing her knowledge and expertise through well-researched and informative articles, helping others navigate the world of Linux with confidence.
Back to top button