Install Redmine on Ubuntu 20.04

Updated on November 30, 2021
Install Redmine on Ubuntu 20.04 header image

Introduction

Redmine is a flexible, open-source project management web application based on the Ruby on Rails framework. Some prominent features of Redmine are:

  • Multiple projects support, including sub-projects.
  • Multiple databases support.
  • Flexible role-based access control.
  • Multiple languages support.
  • Issue tracking systems.
  • Time tracking to check activity duration on projects.
  • Gantt chart and calendar to check project timelines.

This article describes how to install Redmine on Ubuntu 20.04 server.

Prerequisites

1. Install Required Packages

  1. SSH to your server as a non-root user with sudo access.

  2. Update the system package manager. This updates all packages to the latest available versions.

     $ sudo apt update
  3. Install required packages.

     $ sudo apt install apache2 mysql-server mysql-client libapache2-mod-passenger build-essential libmysqlclient-dev libmysqlclient-dev imagemagick libmagickwand-dev libmagickcore-dev -y

2. Create Redmine Database

  1. Log in to MySQL shell. At the password prompt, just press Enter to continue.

     $ sudo mysql -u root -p
  2. Create a database called redminedb.

     CREATE DATABASE redminedb CHARACTER SET utf8mb4;
  3. Create a database user called redmineuser with a password StrongPassword.

     CREATE USER 'redmineuser'@'localhost' IDENTIFIED BY 'StrongPassword';
  4. Grant the user full access to the database.

     GRANT ALL ON redmine.* TO 'redmineuser'@'localhost' WITH GRANT OPTION;
  5. Save the changes.

     FLUSH PRIVILEGES;
  6. Exit the shell.

     exit;

3. Install Redmine

  1. Install Redmine. After running the installer, configure the Redmine database.

     $ sudo apt install redmine redmine-mysql -y
  2. Install Bundler. Bundler is a package that sets up an environment for Ruby projects by tracking and installing gems and versions needed.

     $ sudo gem update        
    
     $ sudo gem install bundler
  3. Edit the Passenger configuration file.

     $ sudo nano /etc/apache2/mods-available/passenger.conf

    Change the file as shown below. Then, save and close the file.

     <IfModule mod_passenger.c>
         PassengerDefaultUser www-data
         PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
         PassengerDefaultRuby /usr/bin/ruby
     </IfModule>
  4. Create the Redmine symbolic link to the Apache web root directory.

     $ sudo ln -s /usr/share/redmine/public /var/www/html/redmine
  5. Create a file named Gemfile.lock.

     $ sudo touch /usr/share/redmine/Gemfile.lock
  6. Change the ownership of the Gemfile.lock file to be accessible to Apache.

     $ sudo chown www-data:www-data /usr/share/redmine/Gemfile.lock
  7. Change ownership of the Apache web directory.

     $ sudo chown -R www-data:www-data /var/www/html/redmine
  8. Change access permissions for the Apache web directory.

     $ sudo chmod -R 755 /var/www/html/redmine

4. Configure Apache2

  1. Create Apache virtual host configuration file named redmine.conf.

     $ sudo nano /etc/apache2/sites-available/redmine.conf

    Add the following code into the file. Save and close the file:

     <VirtualHost *:80>
         ServerAdmin admin@example.com
         DocumentRoot /var/www/html/redmine
         ServerName redmine.example.com
    
         <Directory /var/www/html/redmine>
             RailsBaseURI /redmine
             PassengerResolveSymlinksInDocumentRoot on
         </Directory>
    
         ErrorLog ${APACHE_LOG_DIR}/error.log
         CustomLog ${APACHE_LOG_DIR}/access.log combined
     </VirtualHost>
  2. Enable Apache rewrite mode.

     $ sudo a2enmod rewrite
  3. Enable Redmine Apache configuration file.

     $ sudo a2ensite redmine.conf
  4. Disable Apache default configuration file.

     $ sudo a2dissite 000-default.conf
  5. Restart Apache service.

     $ sudo systemctl restart apache2

5. Access Redmine Web Interface

To access the Redmine Web Interface, go to your browser and visit http://Server_IP/login. For example:

http://192.0.2.10/login

Conclusion

You have installed Redmine on your server. Login to the dashboard with default credentials, admin as the username, and admin as the password. You can now access the dashboard, change the default credentials, and register your account details to begin managing your projects.