How to Install RedMine on CentOS 7

29. January 2018 CentOS, RHEL, SysAdmin 2
How to Install RedMine on CentOS 7

Install Software Collections

yum -y install yum-plugin-priorities

Add [priority=1] to official repository

sed -i -e "s/\]$/\]\npriority=1/g" /etc/yum.repos.d/CentOS-Base.repo

yum -y install epel-release

Add [priority=5] to the EPEL repo

sed -i -e "s/\]$/\]\npriority=5/g" /etc/yum.repos.d/epel.repo

Add CentOS SCLo Software collections Repository.

[[email protected] ~]# yum -y install centos-release-scl-rh centos-release-scl

Add [priority=10] to the SCL repository

[[email protected] ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo
[[email protected] ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl-rh.repo


Install ruby 2.2

The version of Ruby in CentOS 7 repository is 2.0 but we need to install 2.2 for the redmine

It’s fine to install it even if 2.0 is already installed since 2.2 is located on a different PATH.

Install ruby 2.2 from SCLo

[[email protected] ~]# yum --enablerepo=centos-sclo-rh -y install rh-ruby22

Packages from Software Collections are installed uder the /opt directory. To use it, Load environment variables as below

load environment variables

[[email protected] ~]# scl enable rh-ruby22 bash
[[email protected] ~]# ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
[[email protected] ~]# which ruby

Enable Ruby 2.2 automatically at login time, configure profile as below

[[email protected] ~]# vi /etc/profile.d/ 

create the file with the below content

source /opt/rh/rh-ruby22/enable
export X_SCLS="`scl enable rh-ruby22 'echo $X_SCLS'`"
export PATH=$PATH:/opt/rh/rh-ruby22/root/usr/local/bin

Add Execute Permission

chmod +x /etc/profile.d/

Install RedmIne

Install required packages

yum -y install ImageMagick ImageMagick-devel libcurl-devel httpd-devel mariadb-devel ipa-pgothic-fonts gcc

Create MySQL database for the redmine.

create database redmine;
grant all privileges on redmine.* to [email protected]'localhost' identified by 'password';
flush privileges;

Download and copy the redmine to the webroot

[[email protected]ws ~]# wget
[[email protected] ~]# tar zxvf redmine-3.0.3.tar.gz
[[email protected] ~]# mv redmine-3.0.3 /var/www/redmine
[[email protected] ~]# cd /var/www/redmine 

Create database.yml with the database credentials you have created.

[[email protected] redmine]# vi ./config/database.yml
# create new
adapter: mysql2
# database name
database: redmine
host: localhost
# database user
username: redmine
# password for user above
password: password
encoding: utf8

Configure redmine to use an SMTP account sendout emails.

[[email protected] redmine]# vi ./config/configuration.yml
# create new (SMTP settings)
delivery_method: :smtp
address: "localhost"
port: 25
domain: ''
rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf 

Install bundler

[[email protected] redmine]# gem install bundler --no-rdoc --no-ri 

Install Gem for Redmine

[[email protected] redmine]# bundle install --without development test postgresql sqlite

Generate keys

[[email protected] redmine]# bundle exec rake generate_secret_token

Generate tables

[[email protected] redmine]# bundle exec rake db:migrate RAILS_ENV=production

Install Passenger

[[email protected] redmine]# gem install passenger --no-rdoc --no-ri

Install modules for Apache2

[[email protected] redmine]# passenger-install-apache2-module
Welcome to the Phusion Passenger Apache 2 module installer, v5.0.6.

This installer will guide you through the entire installation process. It
shouldn't take more than 3 minutes in total.

Here's what you can expect from the installation process:

1. The Apache 2 module will be installed for you.
2. You'll learn how to configure Apache.
3. You'll learn how to deploy a Ruby on Rails application.

Don't worry if anything goes wrong. This installer will advise you on how to
solve any problems.

Press Enter to continue, or Ctrl-C to abort.
1 # specify 1 and Enter
After you restart Apache, you are ready to deploy any number of web
applications on Apache, with a minimum amount of configuration!

Configure httpd for Redmine. This example shows to configure it on virtual hostings.

Create configuration file for passenger and Add the VirtualHost configuration as well.

[[email protected] redmine]# vi /etc/httpd/conf.d/passenger.conf
LoadModule passenger_module /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.13/buildout/apache2/
PassengerRoot /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.13
PassengerDefaultRuby /usr/bin/ruby
NameVirtualHost *:80
<VirtualHost *:80>
DocumentRoot /var/www/redmine/public

Assign Ownership of redmine directory to apache. You may use ACL if required.

[[email protected] redmine]# chown -R apache. /var/www/redmine 

Restart http service

[[email protected] redmine]# systemctl restart httpd 

Now, you will be able to access the redmnine via

2 thoughts on “How to Install RedMine on CentOS 7”

  • 1
    Aditya Prasad on September 4, 2018 Reply

    Fetching json 1.8.6
    Installing json 1.8.6 with native extensions
    Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

    /opt/rh/rh-ruby22/root/usr/bin/ruby -r ./siteconf20180904-21837-1mfj3p4.rb
    mkmf.rb can’t find header files for ruby at

    extconf failed, exit code 1

    Gem files will remain installed in
    /opt/rh/rh-ruby22/root/usr/local/share/gems/gems/json-1.8.6 for inspection.
    Results logged to

    An error occurred while installing json (1.8.6), and Bundler cannot
    Make sure that `gem install json -v ‘1.8.6’ –source ‘’`
    succeeds before bundling.

    In Gemfile:
    rails was resolved to 4.2.1, which depends on
    actionmailer was resolved to 4.2.1, which depends on
    actionpack was resolved to 4.2.1, which depends on
    actionview was resolved to 4.2.1, which depends on
    rails-dom-testing was resolved to 1.0.9, which depends on
    rails-deprecated_sanitizer was resolved to 1.0.3, which depends on
    activesupport was resolved to 4.2.1, which depends on

    • 2
      Jobin Joseph on September 8, 2018 Reply

      @Aditya , Seems you have missed one of the steps in “Install ruby 2.2” . Please make sure all the steps are completed successfully.

Leave a Reply

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