October 21, 2021
How to install Redmine on Ubuntu 20.04 LTS

How To Install Redmine On Ubuntu 20.04 LTS

On this article we will learn how to install Redmine projetc management tools application on Ubuntu 20.04 LTS Linux operating system.

Introduction

For me, Redmine is a very useful tool in daily works, with Redmine we can trace some cases (customers complain, application failure, project management) from the start it was reported until the case is resolved and closed. Redmine is a free and open source, web-based project management and issue tracking tools. It helps the users to manage multiple projects and associated subprojects. On this article we will discuss how to install Redmine on Ubuntu 20.04 LTS operating system.

Install Redmine On Ubuntu 20.04 LTS

Redmine has dependencies with other applications, so we must prepare these applications first. These applications are: database (MariaDB, MySql), Webserver (Apache or NginX), Ruby and mod-passenger. On this article we will use MariaDB as the database and Apache as the web server.  The installation will be consist of several steps as mentioned below :

  • Prerequisites
  • Redmine Installation
  • Configuring Redmine
  • Accessing Redmine

1. Prerequisites

At prerequisite stage, we will prepare all the packages used by Redmine. We will use the latest repository in Ubuntu and several application packages.

1.1. Update and upgrade Ubuntu System

Before installing supporting applications, we are advised to install any Ubuntu updates prior to beginning this process.  We will  update our system first, by submitting command line : sudo apt update

ramans@otodiginet:~$ sudo apt update
[sudo] password for ramans:
Hit:1 http://kambing.ui.ac.id/ubuntu focal InRelease
Hit:2 http://kambing.ui.ac.id/ubuntu focal-updates InRelease
Hit:3 http://kambing.ui.ac.id/ubuntu focal-backports InRelease
Hit:4 http://kambing.ui.ac.id/ubuntu focal-security InRelease
Hit:5 http://ppa.launchpad.net/teejee2008/ppa/ubuntu focal InRelease
Reading package lists... Done
Building dependency tree
Reading state information... Done
356 packages can be upgraded. Run 'apt list --upgradable' to see them.

sudo apt update

ramans@otodiginet:~$ sudo apt upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages were automatically installed and are no longer required:
libfprint-2-tod1 libllvm9

upgrade system

1.2. Install MariaDB

Redmine requires a database to store its data. In this step, we will install MariaDB. After installation was completed then we have to create a database called as readmin. The instruction are as follow : sudo apt install software-properties-common maridb-server mariadb-client.

ramans@otodiginet:~$ sudo apt install software-properties-common maridb-server mariadb-client
Reading package lists ... Done
Building dependency tree
Reading state information... Done
software-properties-common is already the newest version (0.98.9.3)
software-properties-common set to manually installed.

install MariaDB on Ubuntu 20.04 LTS

By default, MariaDB service has been running after installation, then we will restart it and checking it status by submitting command line :

ramans@otodiginet:~$ sudo systemctl stop mariadb.service
ramans@otodiginet:~$ sudo systemctl start mariadb.service
ramans@otodiginet:~$ sudo systemctl restart mariadb.service
ramans@otodiginet:~$ sudo systemctl status mariadb.service
● mariadb.service - MariaDB 10.3.25 database server
Loaded: loaded (/lib/systemd/system/mariadb.service; enabled; vendor preset: enabled)
Active: active (running) since Sat 2021-03-13 20:34:43 PST; 29s ago
Docs: man:mysqld(8)
https://mariadb.com/kb/en/library/systemd/
Process: 47708 ExecStartPre=/usr/bin/install -m 755 -o mysql -g root -d /var/run/mysqld (code=exited, status=0/SUCCESS)
Process: 47709 ExecStartPre=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 47711 ExecStartPre=/bin/sh -c [ ! -e /usr/bin/galera_recovery ] && VAR= || VAR=`cd /usr/bin/..; /usr/bin/galera_recovery`;>
Process: 47789 ExecStartPost=/bin/sh -c systemctl unset-environment _WSREP_START_POSITION (code=exited, status=0/SUCCESS)
Process: 47791 ExecStartPost=/etc/mysql/debian-start (code=exited, status=0/SUCCESS)
Main PID: 47758 (mysqld)
Status: "Taking your SQL requests now..."
Tasks: 31 (limit: 9451)
Memory: 65.7M
CGroup: /system.slice/mariadb.service
└─47758 /usr/sbin/mysqld

Mar 13 20:34:43 otodiginet systemd[1]: Starting MariaDB 10.3.25 database server...
Mar 13 20:34:43 otodiginet mysqld[47758]: 2021-03-13 20:34:43 0 [Note] /usr/sbin/mysqld (mysqld 10.3.25-MariaDB-0ubuntu0.20.04.1) startin>
Mar 13 20:34:43 otodiginet mysqld[47758]: 2021-03-13 20:34:43 0 [Warning] Could not increase number of max_open_files to more than 16384 >
Mar 13 20:34:43 otodiginet systemd[1]: Started MariaDB 10.3.25 database server.
ramans@otodiginet:~$ mariadb -V
mariadb Ver 15.1 Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2
amans@otodiginet:~$ mysql -V
mysql Ver 15.1 Distrib 10.3.25-MariaDB, for debian-linux-gnu (x86_64) using readline 5.2

MariaDB Restart Service

After MariaDB installation was completed done, we secure our MariaDB database by submitting command line : sudo mysql_secure_installation.

Answer all questions with Yes, as follow :

ramans@otodiginet:~$ sudo mysql_secure_installation

NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!

In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.

Enter current password for root (enter for none):
OK, successfully used password, moving on...

Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorisation.
Change the root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y

1.3. Creating Database for Redmine

We will create create and user for Redmine project management platform. This task is done by logged in to MariaDB and create a user named as readmine.

ramans@otodiginet:~$ sudo mysql -u root -p
Enter password:
Welcome to the MariaDB monitor. Commands end with ; or \g.
Your MariaDB connection id is 50
Server version: 10.3.25-MariaDB-0ubuntu0.20.04.1 Ubuntu 20.04

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8mb4;
Query OK, 1 row affected (0.001 sec)

MariaDB [(none)]> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'OtoDigi2!';
Query OK, 0 rows affected (0.001 sec)

MariaDB [(none)]> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.000 sec)

MariaDB [(none)]> EXIT;
Bye

Create Redmine database

1.4. Install Passenger, Ruby and Apache

At this step, we will install Passenger application server that will be used by Apache and Ruby and for serving Redmine on Ubuntu. Hit the command :  sudo apt install apache2 libapache2-mod-passenger.

ramans@otodiginet:~$ sudo apt install apache2 libapache2-mod-passenger
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfprint-2-tod1 libllvm9
Use 'sudo apt autoremove' to remove them.
The following additional packages will be installed:
apache2-bin apache2-data apache2-utils fonts-lato javascript-common libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap
libjs-jquery liblua5.2-0 libruby2.7 passenger rake ruby ruby-minitest ruby-net-telnet ruby-power-assert ruby-rack ruby-test-unit
ruby-xmlrpc ruby2.7 rubygems-integration
Suggested packages:
apache2-doc apache2-suexec-pristine | apache2-suexec-custom nodejs passenger-doc python rails ri ruby-dev bundler

Install Apache and Passenger Application server

On this step, Apache2 has been running on the system. On the next steps we will restart Apache2 to take effect during Redmine installation.

2. Redmine Installation

At this point, we are going to perform a Redmine installation on Ubuntu 20.04 LTS. During the Redmine installation process, we will be asked for several parameters. The installation starts by running the command: sudo apt install redmine redmine-mysql.

ramans@otodiginet:~$ sudo apt install redmine redmine-mysql
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
libfprint-2-tod1 libllvm9
Use 'sudo apt autoremove' to remove them.

Install Redmine on Ubuntu 20.04 LTS

During the installation process we will be promted by several questions.

Then Ensure the bundler gem is installed, by submitting command line : sudo gem update and sudo gem install bundler.

ramans@otodiginet:~$ sudo gem update
Updating installed gems
Updating actioncable
Fetching actioncable-6.1.3.gem
Fetching zeitwerk-2.4.2.gem
Fetching tzinfo-2.0.4.gem
Fetching activesupport-6.1.3.gem
ramans@otodiginet:~$ sudo gem install bundler
[sudo] password for ramans:
Successfully installed bundler-2.2.14
Parsing documentation for bundler-2.2.14
Done installing documentation for bundler after 2 seconds
1 gem installed

install gem bundler

3. Configuring Redmine

We need to modify two files for apache : /etc/apache2/mods-available/passenger.conf and /etc/apache2/sites-available/000-default.conf.

ramans@otodiginet:~$ sudo vi /etc/apache2/mods-available/passenger.conf
<IfModule mod_passenger.c>
PassengerDefaultUser www-data
PassengerRoot /usr/lib/ruby/vendor_ruby/phusion_passenger/locations.ini
PassengerDefaultRuby /usr/bin/ruby
</IfModule>

 

passenger.conf

Then we have to crate symbolic link as commited below :

ramans@otodiginet:~$ sudo ln -s /usr/share/redmine/public /var/www/html/redmine

Then we will update /etc/apache2/sites-available/000-default.conf as follow :

ramans@otodiginet:~$ sudo vi /etc/apache2/sites-available/000-default.conf
<VirtualHost *:80>
# The ServerName directive sets the request scheme, hostname and port that
# the server uses to identify itself. This is used when creating
# redirection URLs. In the context of virtual hosts, the ServerName
# specifies what hostname must appear in the request's Host: header to
# match this virtual host. For the default virtual host (this file) this
# value is not decisive as it is used as a last resort host regardless.
# However, you must set it for any further virtual host explicitly.
#ServerName www.example.com

ServerAdmin webmaster@localhost
DocumentRoot /var/www/html

<Directory /var/www/html/redmine>
RailsBaseURI /redmine
PassengerResolveSymlinksInDocumentRoot on
</Directory>

# Available loglevels: trace8, ..., trace1, debug, info, notice, warn,
# error, crit, alert, emerg.
# It is also possible to configure the loglevel for particular
# modules, e.g.
#LogLevel info ssl:warn

ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined

Create and set the ownership of a Gemfile.lock file so that apache’s www-data user can access it:

ramans@otodiginet:~$ sudo su -
[sudo] password for ramans:
root@otodiginet:~# systemctl resgtart apache2
Unknown operation resgtart.
root@otodiginet:~# systemctl restart apache2
root@otodiginet:~# ls -ltr /usr/share/redmine/Gemfile.lock
lrwxrwxrwx 1 root root 29 Feb 12 2020 /usr/share/redmine/Gemfile.lock -> /var/lib/redmine/Gemfile.lock

Enable the Redmine website as configured:

ramans@otodiginet:~$ sudo a2enmod rewrite
Enabling module rewrite.
To activate the new configuration, you need to run:
systemctl restart apache2
ramans@otodiginet:~$ sudo a2ensite redmine.conf
Enabling site redmine.
To activate the new configuration, you need to run:
systemctl reload apache2
ramans@otodiginet:~$ sudo systemctl restart apache2.service

Until this point we have installed and configured Redmine Successfully.

4. Accessing Redmine

After all parameter were set, then we will try the Redmine which is located on http://ipaddressorhostname/redmin. On our example the Redmine could be accessed on http://otodiginet/redmine. By using internet browser we will try to hit this URL, as shown below.

Redmine dashboard for the firstime

Redmine login

For the first time, we will use default username and password with admin/admin.

Redmine Change admin Password

We have set password for admin, and now we are ready to use Redmine.

Conclusion

We have installed Redmine on Linux Ubuntu 20.04 LTS operating system completed. For installing Redmine have to ensure other packages already exist and running properly. This article is work on my environment. For more detail about Redmine can be found on Redmine official website. Have a nice day and stay safe

Share this article via :

One thought on “How To Install Redmine On Ubuntu 20.04 LTS

Leave a Reply

Your email address will not be published. Required fields are marked *