Codementor Events

Redmine / CentOS 7

Published Jul 08, 2017Last updated Jul 12, 2018

Follow steps on here.

Problem

I have tried to build Redmine with separated MariaDb environment,but it didn't work.
Generate tables from out side MariaDb is OK,but can't be access by Redmine's web site.
So, I would recommend building redmine and MariaDb in the same server.

RVM (Ruby Version Manager)

In Ruby , we often suffer for multiple versions exist in one environment.
Thank Rahul K. for written a great tutorial for installing RVM.

MariaDB

# localhost may not be recognized in many situations.
MariaDB [(none)]> grant all privileges on redmine.* to redmine@'127.0.0.1' identified by 'password'; 

Passenger

# install modules for Apache2
[root@dlp redmine]# passenger-install-apache2-module 
Installation through RPMs recommended

It looks like you are on a Red Hat or CentOS operating system, with SELinux
enabled. SELinux is a security mechanism for which special Passenger-specific
configuration is required. We supply this configuration as part of
our Passenger RPMs.

However, Passenger is currently installed through gem or tarball and does not
include any SELinux configuration. Therefore, we recommend that you:

 1. Uninstall your current Passenger install.
 2. Reinstall Passenger through the RPMs that we provide:
    https://www.phusionpassenger.com/library/install/apache/yum_repo/

What would you like to do?
2

Which languages are you interested in?

Use <space> to select.
If the menu doesn't display correctly, press '!'

 ‣ ⬢  Ruby
   ⬡  Python
   ⬡  Node.js
   ⬡  Meteor

Installer will give you a notice for how to correctly setting httpd config with mod_passenger.so

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

   LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.1.5/buildout/apache2/mod_passenger.so
   <IfModule mod_passenger.c>
     PassengerRoot /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.1.5
     PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.0/wrappers/ruby
   </IfModule>

After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!

Combine two of them, the content is going to be like this.

LoadModule passenger_module /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.1.5/buildout/apache2/mod_passenger.so
<IfModule mod_passenger.c>
  PassengerRoot /usr/local/rvm/gems/ruby-2.2.0/gems/passenger-5.1.5
  PassengerDefaultRuby /usr/local/rvm/gems/ruby-2.2.0/wrappers/ruby
</IfModule>
NameVirtualHost *:80
<VirtualHost *:80>
    ServerName home.redmine.server
    DocumentRoot /var/www/redmine/public
</VirtualHost>
   

Firewalld

firewall-cmd --zone=public --add-service=http --permanent
firewall-cmd --reload
systemctl restart firewalld.service

SELinux

chcon -R -t httpd_sys_content_t /var/www/redmine/
chcon -R -t httpd_sys_rw_content_t /var/www/redmine
setsebool -P httpd_can_network_connect 1

Enabled

systemctl enable httpd

Logs
keep in mind of these two logs, they will probably help you find the root cause of problems.

#Httpd service log
/var/log/httpd/error_log

#Redmine execution log
/var/www/redmine/log/production.log

Discover and read more posts from 呂昱昕
get started