How to install Redmine Properly on centos 7.5

      No Comments on How to install Redmine Properly on centos 7.5

Since 8 years i work in several companies, and almost every company using redmine for reasons.

Recently i was looking for installation guide on internet but almost every documentation is outdated even on redmine.org

Lets start

At first you need to install centos 7.5 clearly, minimal configuration is recommended

Update the system and install necessary packages

yum update
yum install curl zlib-devel curl-devel openssl-devel httpd-devel apr-devel apr-util-devel mysql-devel ftp wget ImageMagick-devel gcc-c++ patch readline readline-devel zlib libyaml-devel libffi-devel make bzip2 autoconf automake libtool bison subversion sqlite-devel

Installing Mariadb

To install the MariaDB package, run:

yum install mariadb-server

After this command first-run-installation shoud done by run:

mysql_secure_installation

Last step for database:

mysql -uroot -p
CREATE DATABASE redmine CHARACTER SET utf8;
GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'redmine_passwd';
FLUSH PRIVILEGES;
exit;

Redmine user

To run redmine , you need to add new user for redmine

 sudo adduser --home /opt/redmine --shell /bin/bash redmine
sudo install -d -m 755 -o redmine -g redmine /opt/redmine

Impersonalize as redmine:

sudo su - redmine

Installing Ruby using RVM

curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -sSL https://get.rvm.io | bash -s stable --ruby

Lets start installed rvm

source ~/.rvm/scripts/rvm
rvm --default use ruby

To check for everything is fine:

ruby --version
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]

Installing Redmine

Following codes are install redmine on home state eg(opt/home) and prepeare config files for you.

cd && svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine
mkdir -p ./redmine/tmp/pids ./redmine/public/plugin_assets
cp ./redmine/config/configuration.yml.example ./redmine/config/configuration.yml
cp ./redmine/config/database.yml.example ./redmine/config/database.yml

Database.yml file should be filled as given password or root password from mariadb.

vi nsno
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "redmine_passwd"
  encoding: utf8

Installing gems

cd /opt/redmine/redmine
echo "gem 'puma'" >> Gemfile.local
echo "gem: --no-ri --no-rdoc" >> ~/.gemrc 
gem install bundler
bundle install --without development test postgresql sqlite

Migrating and last touch

rake generate_secret_token
RAILS_ENV=production rake db:migrate
RAILS_ENV=production REDMINE_LANG=en rake redmine:load_default_data

Puma installation and configuration

Create a new configuration file as follows:

vim ./redmine/config/puma.rb
#!/usr/bin/env puma

application_path = '/opt/redmine/redmine'
directory application_path
environment 'production'
daemonize true
pidfile "#{application_path}/tmp/pids/puma.pid"
state_path "#{application_path}/tmp/pids/puma.state"
stdout_redirect "#{application_path}/log/puma.stdout.log", "#{application_path}/log/puma.stderr.log"
bind "tcp://0.0.0.0:5000"

Start Puma

Start the puma server with :

cd /opt/redmine/redmine/ && bundle exec puma --config config/puma.rb

The output should be similar to the following:

Puma starting in single mode...
* Version 3.11.2 (ruby 2.4.1-p111), codename: Love Song
* Min threads: 0, max threads: 16
* Environment: production
* Daemonizing...

Do not forget Stop firewall

I prefer stop firewall at this phase, if you wish only allow port, to stop firewall

sudo firewall-cmd --state
sudo systemctl stop firewalld

Lets Test 1.2.3.

Finally your can start your browser and access your new Redmine installation at: http://your_server_ip:5000

Happy coding.

Leave a Reply

Your email address will not be published.