How To Install Redmine on CentOS 8

Install Redmine on CentOS 8

In this tutorial, we will show you how to install Redmine on CentOS 8. For those of you who didn’t know, Redmine is a project management web app that allows users to manage projects flexibly while offering robust monitoring tools and a broad library of plug-ins. This free and open-source solution offers a substitute for paid job management tools and contains support for wikis, forums, calendars, and information visualization programs.

This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple and assumes you are running in the root account, if not you may need to add ‘sudo‘ to the commands to get root privileges. I will show you the step-by-step installation of the Redmine project management web app on a CentOS 8 server.

Install Redmine on CentOS 8

Step 1. First, let’s start by ensuring your system is up-to-date.

sudo dnf update

Step 2. Create Redmine System User.

We’ll create a user who will be the owner of the application, and we’ll give it temporary sudo access:

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

Step 3. Installing Apache HTTP Server.

To install Apache HTTP server on CentOS 8:

dnf install httpd

Then, start Apache services:

systemctl enable httpd --now

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

usermod -aG redmine apache

Step 4. Installing MariaDB server.

To install MariaDB 10.4, you need to install its YUM repository.

cat << EOF > /etc/yum.repos.d/mariadb.repo
[mariadb]
name = MariaDB-10.4
baseurl=http://yum.mariadb.org/10.4/centos8-amd64
gpgkey=https://yum.mariadb.org/RPM-GPG-KEY-MariaDB
gpgcheck=1
EOF

Next, install the MariaDB YUM repository signing key:

rpm --import https://yum.mariadb.org/RPM-GPG-KEY-MariaDB

Install MariaDB using the following command:

sudo dnf update
yum --disablerepo=AppStream install MariaDB-server MariaDB-client

Now start the mysqld service using systemctl command as shown below:

sudo systemctl start mysqld
sudo systemctl enable mariadb

By default, MariaDB is not hardened. You can secure MariaDB using the mysql_secure_installation script. You should read and below each step carefully which will set a root password, remove anonymous users, disallow remote root login, and remove the test database and access to secure MySQL.

mysql_secure_installation

Configure it like this:

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

Next, we will need to log in to the MariaDB console and create a database for the Redmine. Run the following command:

mysql -u root -p

This will prompt you for a password, so enter your MySQL root password and hit Enter. Once you are logged in to your database server you need to create a database for Redmine installation:

CREATE DATABASE redmin
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'PASSWORD';
FLUSH PRIVILEGES;
\q

Step 5. Download and Install Redmine on CentOS.

  • Install Required Dependencies

First, install EPEL and enable the PowerTools repositories:

dnf install epel-release
dnf config-manager --set-enabled PowerTools

Next, proceed to install the dependencies:

dnf install ruby-devel rpm-build libxml2-devel make automake libtool ImageMagick ImageMagick-devel mariadb-devel gcc httpd-devel libcurl-devel gcc-c++

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

dnf install ruby

Now run the following command as shown below to check the Ruby version:

ruby -v
  • Install Redmine on CentOS

First, download the latest version of Redmine, at the moment of writing this article it is version 4.0:

wget http://www.redmine.org/releases/redmine-4.0.5.tar.gz -P /tmp

Extract the Redmine tarball to Redmine user’s home directory:

sudo -u redmine tar xzf /tmp/redmine-4.0.5.tar.gz -C /opt/redmine/ --strip-components=1

Next, change the current working directory and the example configuration files:

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 to the database configuration file.

cp config/database.yml{.example,}

Next, open the database configure file for editing and configure:

nano config/database.yml
...
production:
  adapter: mysql2
  database: redmin
  host: localhost
  username: redmine
  password: "Your_PassWd"
  encoding: utf8
...

Install Ruby Dependencies:

su - redmine

Next, Install Bundler for managing gem dependencies:

gem install bundler

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

bundle install --without development test --path vendor/bundle

Generate Secret Session Token:

bundle exec rake generate_secret_token

Create Database Schema Objects:

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:

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/

Step 6. Configure Firewall for Redmine.

Open port 3000/TCP on firewalld. Run the commands below as a privileged user:

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

Step 7. Testing Redmine Installation

You can test Redmine using WEBrick by executing the command below:

bundle exec rails server webrick -e production

Then, you can now access Redmine via the browser using the address, http://Your-Server-IP:3000/. Click sign in and use the credentials, User: admin and Password: admin to login.

Step 8. Configure Apache for Redmine.

Switch to Redmine user created above to install the Phusion Passenger Apache module:

su - redmine
gem install passenger --no-rdoc --no-ri

Next, install the Passenger Apache module. Replace the version of the Passenger accordingly:

passenger-install-apache2-module

Once the module compilation is done, you are provided with how to configure the module on Apache:

...
Please edit your Apache configuration file, and add these lines:

   LoadModule passenger_module /opt/redmine/.gem/ruby/gems/passenger-6.0.4/buildout/apache2/mod_passenger.so
   
     PassengerRoot /opt/redmine/.gem/ruby/gems/passenger-6.0.4
     PassengerDefaultRuby /usr/bin/ruby
   
...

Before you can press Enter to complete the Module installation and setup, open a new login session as a privileged user and edit the Apache configuration file:

echo "LoadModule passenger_module /opt/redmine/.gem/ruby/gems/passenger-6.0.4/buildout/apache2/mod_passenger.so" \ > /etc/httpd/conf.modules.d/00-passenger.conf

Then, create Apache virtual host configuration for Redmine with the following content:

Listen 3000
<IfModule mod_passenger.c>
  PassengerRoot /opt/redmine/.gem/ruby/gems/passenger-6.0.4
  PassengerDefaultRuby /usr/bin/ruby
</IfModule>
<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>

Verify Apache configuration syntax:

httpd -t
Syntax OK

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

systemctl restart httpd

Step 9. Accessing Redmine from Browser.

You should be able to access the Redmine web interface now:

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

Install Redmine on CentOS 8

Congratulations! You have successfully installed Redmine. Thanks for using this tutorial for installing the Redmine project management web app on CentOS 8 systems. For additional help or useful information, we recommend you to check the official Redmine website.

VPS Manage Service Offer
If you don’t have time to do all of this stuff, or if this is not your area of expertise, we offer a service to do “VPS Manage Service Offer”, starting from $10 (Paypal payment). Please contact us to get the best deal!