How to install Redmine on Ubuntu 20.4 LS

How To Install Redmine On Ubuntu 20.04 LTS

On this article we will learn how to install Redmine version 4.1.1, a web-based project management application on Ubuntu 20.04 LTS Linux operating system.

Introduction

Redmine is a free and open source, web-based project management and issue tracking tools. It allows users to manage multiple projects and associated subprojects. It features per project wikis and forums, time tracking, and flexible, role-based access control. It includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. Redmine integrates with various version control systems and includes a repository browser and diff viewer.

Redmine is written using the Ruby on Rails framework, cross-platform and cross-database. The Redmine version which is going to be installed on this article is version is 4.1.1 which was released on April 6, 2020.

Redmine Installation On Ubuntu 20.04

The Redmine installation on Ubuntu 20.04 will consist of several steps as mentioned below :

Prerequisite

Before we are going to the install Redmine on Ubuntu 20.04, we have to prepare the environment first as mentioned below :

  • Ubuntu 20.04 System with updated repository
  • a user with sudo privilege
  • Sufficient disk space and good internet access

There are several support packages that we must install first. The Apache installation is pretty simple if you just follow the prompts and accept the defaults.

1. Install Required Packages

On this stage, we will install and configure required packages, where Redmine application will be using it. We will use MariaDB as database of redmine and Apache which will be used as web server.

1.1 Update Ubuntu System

By updating system repository, we will refresh our Ubuntu system to the latest package version, this task is performed by submitting command line :

$ sudo apt update
$ sudo apt upgrade

1.2 Install MariaDB Database Server On Ubuntu 20.04

Redmine uses MariaDB/MySQL as a its database, So we need to install the MariaDB server version 15.1 on our system. To install MariaDB we will perform several task as shown below :

$ sudo apt install software-properties-common maridb-server mariadb-client
$ sudo systemctl stop mariadb.service
$ sudo systemctl start mariadb.service
$ sudo systemctl restart mariadb.service
$ sudo systemctl status mariadb.service
$ mariadb -V
$ sudo mysql_secure_installation

Output :

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.
. . .

ramans@otodiginet:~$ sudo systemctl stop mariadb.service
ramans@otodiginet:~$ sudo systemctl start 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

Securing MariaDB database :

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.

You already have a root password set, so you can safely answer 'n'.

Change the root password? [Y/n] Y
New password: 
Re-enter new password: 
Password updated successfully!
Reloading privilege tables..
 ... Success!


By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them.  This is intended only for testing, and to make the installation
go a bit smoother.  You should remove them before moving into a
production environment.

Change the root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
 ... Success!

Normally, root should only be allowed to connect from 'localhost'.  This
ensures that someone cannot guess at the root password from the network.

Change the root password? [Y/n] Y
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
 ... Success!

By default, MariaDB comes with a database named 'test' that anyone can
access.  This is also intended only for testing, and should be removed
before moving into a production environment.

Remove test database and access to it? [Y/n] Y
 - Dropping test database...
 ... Success!
 - Removing privileges on test database...
 ... Success!

Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.

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
 ... Success!

Cleaning up...

All done!  If you've completed all of the above steps, your MariaDB
installation should now be secure.

Thanks for using MariaDB!

1.3 Install Apache Web Server

Redmine runs on the a webserver service and is written in the Ruby on Rails framework, for this purpose we will need to install them on our server. We will install Apache and Passenger module by submitting command line :

$ sudo apt install apache2 libapache2-mod-passenger

Output :

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
The following NEW packages will be installed:
  apache2 apache2-bin apache2-data apache2-utils fonts-lato javascript-common libapache2-mod-passenger 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
0 upgraded, 25 newly installed, 0 to remove and 0 not upgraded.
Need to get 10.4 MB of archives.
After this operation, 46.1 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
. . .
Setting up libapache2-mod-passenger (5.0.30-1.1ubuntu3) ...
apache2_invoke: Enable module passenger
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for fontconfig (2.13.1-2ubuntu3) ...
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for ufw (0.36-6) ...
Processing triggers for systemd (245.4-4ubuntu3.4) 

The Apache Web server has been installed on our system.

Until this stage, we have had MariaDB database server engine, Apache Web server and passenger module installed on our Ubuntu system.

2. Creating Redmine Database

Redmine application requires a database system to store and retrieve their data for running its services. On thsi stage, we will create a new database called as redmine and a new database user called as redmine. For this purpose we have to log in to MariaDB and do the sql script.

  1. Log in to MariaDB shell.
  2. Create a database called redminedb.
  3. Create a database user called redmineuser with a password StrongPassword
  4. Grant the user full access to the database.
  5. Save the changes.
  6. Exit MariaDB Shell

We will perform all steps, as shown below :

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
Creating Readmine Database on MariaDB server
Creating Readmine Database

3. Install and Configure Redmine

On this stage we will install Redmine application, Redmine has been included on Ubuntu repository.

3.1 Install Redmine

To install Redmine, we will use the following command line :

$ sudo apt install redmine redmine-mysql

Output :

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.
The following additional packages will be installed:
  dbconfig-common dbconfig-mysql gsfonts imagemagick-6-common libfftw3-double3 libjs-chart.js libjs-jquery-ui libjs-raphael
  liblqr-1-0 libmagickcore-6.q16-6 ruby-actioncable ruby-actionmailer ruby-actionpack ruby-actionpack-action-caching
  ruby-actionpack-xml-parser ruby-actionview ruby-activejob ruby-activemodel ruby-activerecord ruby-activestorage
  ruby-activesupport ruby-addressable ruby-arel ruby-atomic ruby-builder ruby-bundler ruby-coderay ruby-concurrent ruby-crass
  ruby-css-parser ruby-erubi ruby-eventmachine ruby-globalid ruby-hike ruby-htmlentities ruby-i18n ruby-jquery-rails ruby-loofah
  ruby-mail ruby-marcel ruby-method-source ruby-mime-types ruby-mime-types-data ruby-mimemagic ruby-mini-mime ruby-molinillo
  ruby-multi-json ruby-mysql2 ruby-net-http-persistent ruby-net-ldap ruby-nio4r ruby-nokogiri ruby-oj ruby-pkg-config
  ruby-public-suffix ruby-rack-test ruby-rails ruby-rails-deprecated-sanitizer ruby-rails-dom-testing ruby-rails-html-sanitizer
  ruby-rails-observers ruby-railties ruby-rbpdf ruby-rbpdf-font ruby-redcarpet ruby-request-store ruby-rmagick ruby-roadie
  ruby-roadie-rails ruby-rouge ruby-sprockets ruby-sprockets-rails ruby-thor ruby-thread-safe ruby-tilt ruby-tzinfo
  ruby-websocket-driver ruby-websocket-extensions
Suggested packages:
  libfftw3-bin libfftw3-dev libjs-jquery-ui-docs libmagickcore-6.q16-6-extra bzr cvs darcs git mercurial ruby-fcgi subversion
The following NEW packages will be installed:
  dbconfig-common dbconfig-mysql gsfonts imagemagick-6-common libfftw3-double3 libjs-chart.js libjs-jquery-ui libjs-raphael
  liblqr-1-0 libmagickcore-6.q16-6 redmine redmine-mysql ruby-actioncable ruby-actionmailer ruby-actionpack
  ruby-actionpack-action-caching ruby-actionpack-xml-parser ruby-actionview ruby-activejob ruby-activemodel ruby-activerecord
  ruby-activestorage ruby-activesupport ruby-addressable ruby-arel ruby-atomic ruby-builder ruby-bundler ruby-coderay
  ruby-concurrent ruby-crass ruby-css-parser ruby-erubi ruby-eventmachine ruby-globalid ruby-hike ruby-htmlentities ruby-i18n
  ruby-jquery-rails ruby-loofah ruby-mail ruby-marcel ruby-method-source ruby-mime-types ruby-mime-types-data ruby-mimemagic
  ruby-mini-mime ruby-molinillo ruby-multi-json ruby-mysql2 ruby-net-http-persistent ruby-net-ldap ruby-nio4r ruby-nokogiri
  ruby-oj ruby-pkg-config ruby-public-suffix ruby-rack-test ruby-rails ruby-rails-deprecated-sanitizer ruby-rails-dom-testing
  ruby-rails-html-sanitizer ruby-rails-observers ruby-railties ruby-rbpdf ruby-rbpdf-font ruby-redcarpet ruby-request-store
  ruby-rmagick ruby-roadie ruby-roadie-rails ruby-rouge ruby-sprockets ruby-sprockets-rails ruby-thor ruby-thread-safe ruby-tilt
  ruby-tzinfo ruby-websocket-driver ruby-websocket-extensions
0 upgraded, 80 newly installed, 0 to remove and 0 not upgraded.
Need to get 20.5 MB of archives.
After this operation, 65.9 MB of additional disk space will be used.
Do you want to continue? [Y/n] 
.....
Default configuration data loaded.
Processing triggers for libc-bin (2.31-0ubuntu9.2) ...
Processing triggers for man-db (2.9.1-1) ...
Processing triggers for fontconfig (2.13.1-2ubuntu3) ...

3.2 Install Bundler

The next step is installing Bundler. Bundler is a package that sets up an environment for Ruby projects by tracking and installing gems and versions needed. We will use the following command line to install Bundler :

$ sudo gem update
$ sudo gem install bundler

Output :

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
Fetching rack-2.2.3.gem
Fetching actionview-6.1.3.gem
Fetching actionpack-6.1.3.gem
Successfully installed tzinfo-2.0.4
Successfully installed zeitwerk-2.4.2
Successfully installed activesupport-6.1.3
Successfully installed rack-2.2.3
Successfully installed actionview-6.1.3
Successfully installed actionpack-6.1.3
Successfully installed actioncable-6.1.3
Parsing documentation for tzinfo-2.0.4
. . .
Updating xmlrpc
Fetching xmlrpc-0.3.2.gem
Successfully installed xmlrpc-0.3.2
Parsing documentation for xmlrpc-0.3.2
Installing ri documentation for xmlrpc-0.3.2
Installing darkfish documentation for xmlrpc-0.3.2
Done installing documentation for xmlrpc after 0 seconds
Parsing documentation for xmlrpc-0.3.2
Done installing documentation for xmlrpc after 0 seconds
Updating yaml
Fetching yaml-0.1.1.gem
Successfully installed yaml-0.1.1
Parsing documentation for yaml-0.1.1
Installing ri documentation for yaml-0.1.1
Installing darkfish documentation for yaml-0.1.1
Done installing documentation for yaml after 0 seconds
Parsing documentation for yaml-0.1.1
Done installing documentation for yaml after 0 seconds
Gems updated: actioncable actionpack actionview activesupport rack tzinfo zeitwerk actionmailer activejob activemodel activerecord activestorage atomic benchmark bigdecimal bundler cgi coderay concurrent-ruby crass css_parser csv date delegate did_you_mean erubi etc eventmachine fiddle fileutils forwardable getoptlong globalid hike htmlentities i18n io-console irb reline jquery-rails json logger loofah marcel matrix method_source mime-types-data mimemagic mini_mime minitest molinillo multi_json mutex_m mysql2 connection_pool net-http-persistent net-ldap net-protocol digest net-smtp net-telnet nio4r nokogiri observer oj open3 openssl ostruct pkg-config power_assert prime pstore psych public_suffix racc rack-test actionmailbox actiontext rails railties thor rails-deprecated_sanitizer rake rdoc readline-ext redcarpet rexml rmagick roadie-rails rouge rss singleton sprockets sprockets-rails stringio strscan test-unit timeout tracer uri webrick websocket-driver websocket-extensions xmlrpc yaml
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

3.3 Edit Passenger Configuration File

After gem installation was completed done, then we will update the passenger configuration file which is located at /etc/apache2/mods-available/passenger.conf file. We will use vi text editor for editing this file, as shown below.

$ 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>

Then we will create Redmine symbolic link to the Apache web root directory, by submitting command line :

$ sudo ln -s /usr/share/redmine/public /var/www/html/redmine
Configuring Redmine - setting database

4. Configuring Apache 2 Web Server

On this stage, we will configure Apache 2 web server to accomodate Redmine application running on it. We will create an Apache virtual host configuration file for Redmine. The configuration file will be located at /etc/apache2/sites-available/redmine.conf file. By using vi text editor we will create/modify the file.

sudo vi /etc/apache2/sites-available/redmine.conf

The content of this file is as shown below :

<VirtualHost *:80>
  ServerAdmin admin@otodiginet.com
  DocumentRoot /var/www/html/redmine
  ServerName eticket.otodiginet.com
  ServerAlias www.eticket.otodiginet.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>

Then we will enable the Apache virtual host file and restart the Apache service to implement the changes, by performing following task.

$ sudo a2enmod rewrite
$ sudo a2ensite redmine.conf

Output :

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

After all are set, then we will create an gemfile.lock file and change the ownership of the gemfile.lock file to be accessible to Apache.

$ sudo touch /usr/share/redmine/Gemfile.lock
$ sudo chown www-data:www-data /usr/share/redmine/Gemfile.lock

Then we will restart Apache 2 web server by submitting command line :

$ sudo systemctl restart apache2.service
$ sudo systemctl status apache2.service

Output :

ramans@otodiginet:~$ sudo systemctl restart apache2.service
ramans@otodiginet:~$ sudo vi /etc/apache2/sites-available/redmine.conf
ramans@otodiginet:~$ sudo systemctl status apache2.service
● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Sat 2021-03-13 21:48:03 PST; 8min ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 54037 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
      Tasks: 81 (limit: 9451)
     Memory: 15.0M
     CGroup: /system.slice/apache2.service
             ├─54072 /usr/sbin/apache2 -k start
             ├─54073 Passenger watchdog
             ├─54076 Passenger core
             ├─54085 Passenger ust-router
             ├─54103 /usr/sbin/apache2 -k start
             └─54104 /usr/sbin/apache2 -k start

Mar 13 21:48:03 otodiginet systemd[1]: Starting The Apache HTTP Server...
Mar 13 21:48:03 otodiginet apachectl[54040]: AH00558: apache2: Could not reliably determine the server's fully qualified domain name, u>
Mar 13 21:48:03 otodiginet systemd[1]: Started The Apache HTTP Server.

5. Accessing Redmine Webinterface

On this stage we have installed and configure Redmine application tools, the next step is to access Redmine Web interface.

Redmine web interface for the first use
Redmine web interface for the first us
Redmine Login
Redmine Login

Redmine Account Management
Redmine Account Management

Conclusion

On this tutorial, we have had installed Redmine successfully. I hope this article could be helpful.

(Visited 107 times, 1 visits today)

Comments

No comments yet. Why don’t you start the discussion?

Leave a Reply

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