Install Redmine on Ubuntu 20.04

0
48

In this guide, you will learn how to install Redmine on Ubuntu 20.04. Redmine is cross-platform and cross-database, flexible project management tool written on Ruby on Rails Framework.

Some of the main features of Redmine are:

  • Multiple projects support
  • Flexible role based access control
  • Flexible issue tracking system
  • Gantt chart and calendar
  • News, documents & files management
  • Feeds & email notifications
  • Per project wiki
  • Per project forums
  • Time tracking
  • Custom fields for issues, time-entries, projects and users
  • SCM integration (SVN, CVS, Git, Mercurial and Bazaar)
  • Issue creation via email
  • Multiple LDAP authentication support
  • User self-registration support
  • Multilanguage support
  • Multiple databases support

Read more about Redmine features on the features page.

Install Redmine on Ubuntu 20.04

Run system update

To begin with, ensure that your system packages are up-to-date.

apt update

Redmine can be installed from the default Ubuntu 20.04 Universe repos. However, the repos doesnt provide the Redmine package. For example, the currently available version of Redmine on he default Ubuntu 20.04 Universe repos is v4.0.6;

apt-cache policy redmine
redmine:
  Installed: (none)
  Candidate: 4.0.6-2
  Version table:
     4.0.6-2 500
        500 http://ke.archive.ubuntu.com/ubuntu focal/universe amd64 Packages

However, Redmine 4.2.2 is the current Release version.

Therefore, to install Redmine on Ubuntu 20.04, you need to build and install it from the source.

Install Required Build Tools and Dependencies

To install Redmine from the source code, you need install the required build tools and dependencies.

apt install build-essential ruby-dev libxslt1-dev libmariadb-dev libxml2-dev zlib1g-dev imagemagick libmagickwand-dev curl gnupg2 bison libbison-dev libgdbm-dev libncurses-dev libncurses5-dev libreadline-dev libssl-dev libyaml-dev libsqlite3-dev sqlite3

Install Apache HTTP Server on Ubuntu 20.04

Install Apache web server and Apache modules for the Passenger, lightweight web server for Ruby.

apt install apache2 libapache2-mod-passenger

Start and enable Apache to run on system boot.

systemctl enable --now apache2

Install Ruby interpreter

Redmine version 4.2 supports Ruby 2.4, 2.5, 2.6, 2.7.

Ruby is installed as part of the above package dependencies. However, the installed version is above the recommended versions for Redmine 4.1.

ruby -v
ruby 2.7.0p0 (2019-12-25 revision 647ee6f091) [x86_64-linux-gnu]

Therefore, Install Ruby 2.6 using RVM;

gpg2 --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
\curl -sSL https://get.rvm.io | bash -s stable

Add all users that will be using rvm to 'rvm‘ group. In this case, we will be using root user to run rvm;

usermod -aG rvm root

To start using RVM you need to load the RVM script environment variables;

source /etc/profile.d/rvm.sh

Next, install required Ruby 2.6 using RVM on Ubuntu 20.04;

rvm install 2.6.0

Make Ruby 2.6 the default ruby;

rvm --default use 2.6.0

Then re-verify Ruby version;

ruby -v
ruby 2.6.0p0 (2018-12-25 revision 66547) [x86_64-linux]

Create Redmine System User

Create a Redmine system user that can be used to install Redmine Ruby dependencies via bundler command. Set its home directory to /opt/redmine as this is where we will install Redmine app.

useradd -r -m -d /opt/redmine -s /usr/bin/bash redmine

Add Apache web server user to Redmine group.

usermod -aG redmine www-data

Also, add redmine user to RVM group;

usermod -aG rvm redmine

Install MariaDB on Ubuntu 20.04

Run the command below to install MariaDB database server on Ubuntu 20.04

apt install mariadb-server

MariaDB is started and enabled to run on boot upon installation. If not already started, run the command below to start it;

systemctl enable --now mariadb

Run initial MariaDB database secure script to remove default databases, test tables, disable remote root login,

mysql_secure_installation

Create Redmine Database and Database User

Once MariaDB is installed, login as root user and create Redmine database and database user.

Replace the names of the database and the database user accordingly.

mysql -u root -p
create database redminedb;
grant all on redminedb.* to [email protected] identified by '[email protected]';

Reload privilege tables and exit the database.

flush privileges;
quit

Download and Install Redmine

Navigate Redmine releases page and grab Redmine tarball.

You can simply download and extract the Redmine tarball to the Redmine install directory, /opt/redmine.

curl -s https://www.redmine.org/releases/redmine-4.2.2.tar.gz | sudo -u redmine tar xz -C /opt/redmine/ --strip-components=1

Configuring Redmine on Ubuntu 20.04

Once you have installed Redmine under the /opt/redmine directory, you can now proceed to configure it.

Create Redmine configuration file by renaming the sample configuration files as shown below;

su - redmine
cp /opt/redmine/config/configuration.yml{.example,}
cp /opt/redmine/public/dispatch.fcgi{.example,}
cp /opt/redmine/config/database.yml{.example,}

Configure Redmine Database Settings

Open the created Redmine database configuration setting and set the Redmine database connection details for MySQL.

vim /opt/redmine/config/database.yml
...
production:
  adapter: mysql2
  database: redminedb
  host: localhost
  username: redmineuser
  password: "[email protected]"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
...

Save and exit the file.

Install Redmine Ruby Dependencies

Logout as redmine user by running the exit.

[email protected]:~$ exit

 As privileged user, navigate to Redmine install directory and install the Ruby dependencies.

cd /opt/redmine

Install Bundler for managing gem dependencies.

sudo gem install bundler

Next, install the required gems dependencies as redmine user.

su - redmine
bundle config set --local path 'vendor/bundle'
bundle install

Generate Secret Session Token

To prevent tempering of the cookies that stores session data, you need to generate a random secret key that Rails uses to encode them.

bundle exec rake generate_secret_token

Create Database Schema Objects

Create Rails database structure by running the command below;

RAILS_ENV=production bundle exec rake db:migrate

Once the database migration is done, insert default configuration data into the database by executing;

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

You can safely ignore the Ruby warnings.

Configure FileSystem Permissions

Ensure that the following directories are available on Redmine directory, /opt/redmine.

  • tmp and tmp/pdf
  • public and public/plugin_assets
  • log
  • files

If they do not exist, simply create them and ensure that they are owned by the user used to run Redmine.

for i in tmp tmp/pdf public/plugin_assets; do [ -d $i ] || mkdir -p $i; done
chown -R redmine:redmine files log tmp public/plugin_assets
chmod -R 755 /opt/redmine

Testing Redmine Installation

The setup of Redmine on Ubuntu 20.04 is now done. Redmine listens on TCP port 3000 by default. Hence, before running the tests, open port 3000/tcp on firewall if it is running.

[email protected]:~$ exit
sudo ufw allow 3000/tcp

You can now test Redmine using WEBrick by executing the command below;

su - redmine
bundle exec rails server webrick -e production

Navigate to the browser and enter the address, http://server-IP-or-Hostname:3000. Replace the server-IP-or-Hostname accordingly.

If all is well, you should land on Redmine web user interface.

Install Redmine on Ubuntu 20.04

Configure Apache for Redmine on Ubuntu 20.04

Now that you have confirmed that Redmine is working as expected, proceed to configure Apache to server Redmine.

Create Redmine Apache VirtualHost configuration file.

exit
cat > /etc/apache2/sites-available/redmine.conf << 'EOL'
Listen 3000
<VirtualHost *:3000>
	ServerName redmine.kifarunix-demo.com
	RailsEnv production
	DocumentRoot /opt/redmine/public

	<Directory "/opt/redmine/public">
	        Allow from all
	        Require all granted
	</Directory>

	ErrorLog ${APACHE_LOG_DIR}/redmine_error.log
        CustomLog ${APACHE_LOG_DIR}/redmine_access.log combined
</VirtualHost>
EOL

Check Apache configuration for errors.

apachectl configtest
Syntax OK

Ensure that Passenger module is loaded;

apache2ctl -M | grep -i passenger
passenger_module (shared)

If not enabled, run the command below to enable it.

a2enmod passenger

Enable Redmine site.

sudo a2ensite redmine

Disable default site;

a2dissite 000-default.conf

Reload Apache

sudo systemctl restart apache2

Check to ensure that Redmine is now listening on port 3000.

sudo lsof -i :3000
COMMAND   PID     USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
apache2 20011     root    6u  IPv6  71629      0t0  TCP *:3000 (LISTEN)
apache2 20031 www-data    6u  IPv6  71629      0t0  TCP *:3000 (LISTEN)
apache2 20032 www-data    6u  IPv6  71629      0t0  TCP *:3000 (LISTEN)

Access Redmine on Browser

Next, you can now access and sign in to Redmine on browser using the address http://server-IP-address:3000.

Default credentials: admin:admin.

Install Redmine on Ubuntu 20.04

When prompted, reset your admin password.

Setup your Redmine profile;

Install Redmine on Ubuntu 20.04

Create Projects

Install Redmine on Ubuntu 20.04

That concludes our guide on how to install Redmine on Rocky Linux 8. You can now explore this awesome tool.

Read more on how to use Redmine User Guide.

Reference

Redmine Install

Other Tutorials

Install Vtiger CRM on Rocky Linux 8

Install Redmine on Rocky Linux 8

LEAVE A REPLY

Please enter your comment!
Please enter your name here