Install Redmine on Rocky Linux 8|Rocky Linux 9

|
Last Updated:
|
|

This guide will take you through how to install Redmine on Rocky Linux 8|Rocky Linux 9. Redmine is a cross-platform as well as cross-database flexible project management web application.

Redmine has quite a number of features that are described on Redmine features page.

Installing Redmine on Rocky Linux 9/8

Create Redmine System User

In this guide, we will install Redmine on /opt/redmine directory and run it as non-privileged redmine system user.

As such, create a redmine system user (or any other non-privileged system user that Redmine will run as for that case) and assign the /opt/redmine as its home directory.

useradd -r -m -d /opt/redmine redmine

Consult man useradd to learn what the options used above means.

Install Apache HTTP Server

To install Apache HTTP server on Rocky Linux 8|Rocky Linux 9, simply execute;

dnf install httpd

Start and enable Apache HTTP server to run on system boot;

systemctl enable httpd --now

Next, since we will be using Apache as our HTTP server, add Apache to Redmine group.

usermod -aG redmine apache

Install MariaDB Database Backend

Redmine supports a number of database back-ends such as PostgreSQL, MySQL/MariaDB, MSSQL. In this demo, we are using MariaDB 10.x.

dnf install mariadb-server

run the command below to start and enable MariaDB server on system boot;

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 the database backend is installed, login and create the database and database user for Redmine. Replace the database name accordingly.

mysql -u root -p
create database redminedb;

Create and grant the user all privileges on the database created. Replace the database user and password accordingly.

grant all on redminedb.* to redmineadmin@localhost identified by 'P@ssWorD';

Reload privileges tables and quit.

flush privileges;
quit

Download and Install Redmine

Install Required Dependencies

Begin by installing the dependencies required to build Redmine. First install EPEL and enable the PowerTools repositories.

dnf install epel-release -y

Rocky Linux 8

dnf config-manager --set-enabled powertools

On Rocky Linux 9, Powertools is known as crb;

dnf config-manager --set-enabled crb

Next, proceed to install the dependencies.

dnf install ruby-devel \
	rpm-build \
	wget \
	libxml2-devel \
	vim \
	make \
	openssl-devel \
	automake \
	libtool \
	ImageMagick \
	ImageMagick-devel \
	mariadb-devel \
	gcc \
	httpd-devel \
	libcurl-devel \
	gcc-c++ -y

Install Ruby on Rocky Linux 8|Rocky Linux 9

Redmine also requires Ruby interpreter which can be installed by executing the command;

dnf install ruby -y

Redmine version 5.1 supports upto Ruby 3.1 as of this post update!

Verify installed version.

ruby -v
ruby 3.0.4p208 (2022-04-12 revision 3fa771dded) [x86_64-linux]

Download and Install Redmine

In order to install the latest version of Redmine, navigate to the Download’s page and grab the latest stable release version.

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

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

You should now have redmine files under /opt/redmine.

ls -alh /opt/redmine
total 188K
drwx------. 17 redmine redmine 4.0K Nov 12 19:51 .
drwxr-xr-x.  3 root    root      21 Nov 12 19:34 ..
drwxr-xr-x.  8 redmine redmine   97 Oct 31 00:50 app
-rw-r--r--.  1 redmine redmine  863 Oct 31 00:50 appveyor.yml
-rw-r--r--.  1 redmine redmine   18 Jan 23  2023 .bash_logout
-rw-r--r--.  1 redmine redmine  141 Jan 23  2023 .bash_profile
-rw-r--r--.  1 redmine redmine  492 Jan 23  2023 .bashrc
drwxr-xr-x.  2 redmine redmine   78 Oct 31 00:50 bin
drwxr-xr-x.  5 redmine redmine 4.0K Oct 31 00:50 config
-rw-r--r--.  1 redmine redmine  129 Oct 31 00:50 config.ru
-rw-r--r--.  1 redmine redmine  538 Oct 31 00:50 CONTRIBUTING.md
drwxr-xr-x.  3 redmine redmine   21 Oct 31 00:50 db
drwxr-xr-x.  2 redmine redmine  113 Oct 31 00:50 doc
drwxr-xr-x.  5 redmine redmine   58 Oct 31 00:50 extra
drwxr-xr-x.  2 redmine redmine   23 Oct 31 00:50 files
-rw-r--r--.  1 redmine redmine 3.5K Oct 31 00:50 Gemfile
drwxr-xr-x.  2 redmine redmine   38 Oct 31 00:50 .github
-rw-r--r--.  1 redmine redmine  823 Oct 31 00:50 .gitignore
-rw-r--r--.  1 redmine redmine  694 Oct 31 00:50 .hgignore
drwxr-xr-x.  6 redmine redmine   85 Oct 31 00:50 lib
drwxr-xr-x.  2 redmine redmine   23 Oct 31 00:50 log
-rw-r--r--.  1 redmine redmine   81 Oct 31 00:50 package.json
drwxr-xr-x.  2 redmine redmine   20 Oct 31 00:50 plugins
drwxr-xr-x.  8 redmine redmine 4.0K Oct 31 00:50 public
-rwxr-xr-x.  1 redmine redmine  275 Oct 31 00:50 Rakefile
-rw-r--r--.  1 redmine redmine  205 Oct 31 00:50 README.rdoc
-rw-r--r--.  1 redmine redmine  56K Oct 31 00:50 .rubocop_todo.yml
-rw-r--r--.  1 redmine redmine 5.3K Oct 31 00:50 .rubocop.yml
-rw-r--r--.  1 redmine redmine   42 Oct 31 00:50 .stylelintignore
-rw-r--r--.  1 redmine redmine 1009 Oct 31 00:50 .stylelintrc
drwxr-xr-x. 15 redmine redmine 4.0K Oct 31 00:50 test
drwxr-xr-x.  8 redmine redmine   95 Oct 31 00:50 tmp
drwxr-xr-x.  2 redmine redmine    6 Oct 31 00:50 vendor
-rw-r--r--.  1 redmine redmine  51K Oct 31 00:50 yarn.lock

Configure Redmine Database Connection Settings

First switch to Redmine’s user account.

su - redmine

Rename the sample Redmine configuration.

cp config/configuration.yml{.example,}

Rename the sample dispatch CGI configuration file under the public folder as shown below;

cp public/dispatch.fcgi{.example,}

Rename the sample the database configuration file.

cp config/database.yml{.example,}

Next, open the database configure file for editing and and configure it to set the Redmine database connection details.

vim config/database.yml

Replace the database name, database user and the password accordingly.

...
production:
  adapter: mysql2
  database: redminedb
  host: localhost
  username: redmineadmin
  password: "P@ssWorD"
  # Use "utf8" instead of "utfmb4" for MySQL prior to 5.7.7
  encoding: utf8mb4
...

Save and exit the file.

Install Ruby Dependencies

Next, install required Ruby dependencies. Note that this step should be executed as Redmine user created above. If you are still logged in as Redmine user, proceed. Otherwise, switch to redmine user.

su - redmine

Install Bundler for managing gem dependencies.

gem install bundler

Once the bundler installation is done, you can now install required gems dependencies.

bundle config set --local path 'vendor/bundle'
bundle config set --local without 'development test'
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

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 Rocky Linux 8|Rocky Linux 9 is now done. You can test Redmine using WEBrick by executing the command below;

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

su - redmine

Add webrick to Gemfile;

echo 'gem "webrick"' >> Gemfile

Install webrick gem and test the installation;

bundle install
bundle exec rails server -u webrick -e production

Sample output;

=> Booting WEBrick
=> Rails 6.1.7.6 application starting in production http://0.0.0.0:3000
=> Run `bin/rails server --help` for more startup options
[2023-11-12 20:09:01] INFO  WEBrick 1.8.1
[2023-11-12 20:09:01] INFO  ruby 3.0.4 (2022-04-12) [x86_64-linux]
[2023-11-12 20:09:01] INFO  WEBrick::HTTPServer#start: pid=27883 port=3000

You can now access Redmine via the browser using the address, http://Server-IP:3000/.

Before that, open port 3000/tcp on firewalld. Run the commands below as privileged user.

firewall-cmd --add-port=3000/tcp --permanent
firewall-cmd --reload

Once the port is opened, navigate to the browser and access Redmine. You should see a welcome page.

redmine webrick

Click sign in at the top right corner and use the credentials:

  • Useradmin
  • Password: admin

To stop Redmine foreground run, just press CTRL+C.

Configure Apache for Redmine

Once you have confirmed that Redmine is working fine after the testing, you need to configure Apache HTTP server for Redmine.

Install Apache Passenger Module

Phusion Passenger is a web application server that can be used to server Redmine on production environments.

You can install the Apache Passenger module on Rocky Linux 8|Rocky Linux 9 as follows;

Install the passenger repo;

curl --fail -sSLo \
/etc/yum.repos.d/passenger.repo \
https://oss-binaries.phusionpassenger.com/yum/definitions/el-passenger.repo

Install the module;

yum install -y mod_passenger

When installed, it should be enabled by default.

httpd -M | grep passenger
passenger_module (shared)

Create Redmine Apache Configuration file

Create Apache virtual host configuration for Redmine with the following content. Replace the server name accordingly. You can as well change the default port if you want.

cat > /etc/httpd/conf.d/redmine.conf << 'EOL'
Listen 3000
<VirtualHost *:3000>
    ServerName redmine.kifarunix-demo.com
    DocumentRoot "/opt/redmine/public" 

    CustomLog logs/redmine_access.log combined
    ErrorLog logs/redmine_error_log
    LogLevel warn

    <Directory "/opt/redmine/public">
        Options Indexes ExecCGI FollowSymLinks
        Require all granted
        AllowOverride all
    </Directory>
</VirtualHost>
EOL

Verify Apache configuration syntax.

httpd -t
Syntax OK

Once the installation and setup of Apache Passenger module is complete, restart Apache

systemctl restart httpd

Check if anything is listening on Port 3000.

lsof -i :3000
COMMAND   PID   USER   FD   TYPE DEVICE SIZE/OFF NODE NAME
httpd   31382   root    6u  IPv6  78641      0t0  TCP *:hbci (LISTEN)
httpd   31420 apache    6u  IPv6  78641      0t0  TCP *:hbci (LISTEN)
httpd   31425 apache    6u  IPv6  78641      0t0  TCP *:hbci (LISTEN)
httpd   31426 apache    6u  IPv6  78641      0t0  TCP *:hbci (LISTEN)

That is awesome.

If lsof command is not installed, install it as follows;

yum install lsof -y

Access Redmine from Browser

Since we have already opened port 3000/tcp on firewallD, you should be able to access Redmine web interface now.

Replace the server-IP-or-Hostname accordingly.

http://server-IP-or-Hostname:3000

Ensure the port is opened on the firewall.

Default login credentials given above.

Install Redmine on Rocky Linux

If you get the error below;

We're sorry, but something went wrong.
The issue has been logged for investigation. Please try again later.
phusion selinux 3

You need to sort your SELinux permissions.

Phusion Passenger when not installed from the repositories does not come with SELinux policy modules and thus may not work well with SELinux enabled.

To make this simple, just disable SELinux and reboot your system and then access Redmine again on browser.

setenforce 0
sed -i 's/=enforcing/=disabled/' /etc/selinux/config

Otherwise if you want to keep SELinux running, generate a custom SELinux module for Phusion Passenger for any denied entry in /var/log/audit/audit.log and install it. For example;

dnf install policycoreutils-python-utils
audit2allow -a -M passenger

This command generated a policy package that can be installed by running;

semodule -i passenger.pp

Note that in this guide, SELinux is disabled and I haven’t tried this method. It may or may not work. Good luck.

With SELinux issues fixed, login to Redmine using admin for both user and password.

You are prompted to reset the password. Do reset and proceed to login to Redmine web interface.

After login, reset the password and proceed to setup your Redmine profile on Rocky Linux 8|Rocky Linux 9.

redmine dashboard 2

Once your profile is setup, you can jump to new project.

project

That marks the end of our guide on how to install Redmine. You can now explore this awesome tool.

Read more on how to use Redmine User Guide.

Reference

Redmine Install

Other Rocky Linux tutorials

Install Webmin on Rocky Linux 8

Install and Configure SNMP on Rocky Linux 8

Install Apache Maven on Rocky Linux 8

Install and Configure NFS Server on Rocky Linux 8

SUPPORT US VIA A VIRTUAL CUP OF COFFEE

We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
gen_too
Co-founder of Kifarunix.com, Linux Tips and Tutorials. Linux/Unix admin and author at Kifarunix.com.

2 thoughts on “Install Redmine on Rocky Linux 8|Rocky Linux 9”

Leave a Comment