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.

[root@aws ~]# yum -y install centos-release-scl-rh centos-release-scl

Add [priority=10] to the SCL repository

[root@aws ~]# sed -i -e "s/\]$/\]\npriority=10/g" /etc/yum.repos.d/CentOS-SCLo-scl.repo
[root@aws ~]# 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

[root@aws ~]# 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

[root@aws ~]# scl enable rh-ruby22 bash
[root@aws ~]# ruby -v
ruby 2.2.2p95 (2015-04-13 revision 50295) [x86_64-linux]
[root@aws ~]# which ruby
/opt/rh/rh-ruby22/root/usr/bin/ruby

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

[root@aws ~]# vi /etc/profile.d/rh-ruby22.sh 

create the file with the below content

#!/bin/bash
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/rh-ruby22.sh

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 redmine@'localhost' identified by 'password';
flush privileges;
exit 

Download and copy the redmine to the webroot

[root@aws ~]# wget http://www.redmine.org/releases/redmine-3.0.3.tar.gz
[root@aws ~]# tar zxvf redmine-3.0.3.tar.gz
[root@aws ~]# mv redmine-3.0.3 /var/www/redmine
[root@aws ~]# cd /var/www/redmine 

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

[root@aws redmine]# vi ./config/database.yml
# create new
production:
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.

[root@aws redmine]# vi ./config/configuration.yml
# create new (SMTP settings)
production:
email_delivery:
delivery_method: :smtp
smtp_settings:
address: "localhost"
port: 25
domain: 'redmine.aws.local'
rmagick_font_path: /usr/share/fonts/ipa-pgothic/ipagp.ttf 

Install bundler

[root@aws redmine]# gem install bundler --no-rdoc --no-ri 

Install Gem for Redmine

[root@aws redmine]# bundle install --without development test postgresql sqlite

Generate keys

[root@aws redmine]# bundle exec rake generate_secret_token

Generate tables

[root@aws redmine]# bundle exec rake db:migrate RAILS_ENV=production

Install Passenger

[root@aws redmine]# gem install passenger --no-rdoc --no-ri

Install modules for Apache2

[root@aws 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.

[root@aws 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/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.13
PassengerDefaultRuby /usr/bin/ruby
NameVirtualHost *:80

ServerName redmine.aws.local
DocumentRoot /var/www/redmine/public

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

[root@aws redmine]# chown -R apache. /var/www/redmine 

Restart http service

[root@aws redmine]# systemctl restart httpd 

Now, you will be able to access the redmnine via http://redmine.aws.local

0 0 votes
Article Rating
Subscribe
Notify of
guest
2 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Aditya Prasad
6 years ago

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
extconf.rb
mkmf.rb can’t find header files for ruby at
/opt/rh/rh-ruby22/root/usr/share/include/ruby.h

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
/opt/rh/rh-ruby22/root/usr/local/lib64/gems/ruby/json-1.8.6/gem_make.out

An error occurred while installing json (1.8.6), and Bundler cannot
continue.
Make sure that `gem install json -v ‘1.8.6’ –source ‘https://rubygems.org/’`
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
json
Stucked

2
0
Would love your thoughts, please comment.x
()
x
Scroll to Top