How to Install RedMine on CentOS 7

29. January 2018 CentOS, RHEL, SysAdmin 0
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
/opt/rh/rh-ruby22/root/usr/bin/ruby

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

[[email protected] ~]# 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 [email protected]'localhost' identified by 'password';
flush privileges;
exit 

Download and copy the redmine to the webroot

[[email protected] ~]# wget http://www.redmine.org/releases/redmine-3.0.3.tar.gz
[[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
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.

[[email protected] 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

[[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!
.....
[8] 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/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.13
PassengerDefaultRuby /usr/bin/ruby
NameVirtualHost *:80
<VirtualHost *:80>
ServerName redmine.aws.local
DocumentRoot /var/www/redmine/public
</VirtualHost>

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 http://redmine.aws.local


Leave a Reply

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