How to Install Redmine on CentOS 7

r00t March 26, 2018

Install Redmine on CentOS 7

In this tutorial we’ll learn how to install Redmine on CentOS 7. We will also install and configure its prerequisites. Redmine is an open resource cross-platform and cross-database issue tracking, and web-based project management application built on top on the Ruby on Rails framework.

I recommend to use a minimal CentOS server setup as a basis for the tutorial, that can be a virtual or a root server image with an CentOS 7 minimal install from a web hosting company or you use our minimal server tutorial to install a server from scratch.

Install Redmine on CentOS 7

Step 1. First, ensure your system and apt package lists are fully up-to-date by running the following:

yum -y install epel-release
yum -y update

Step 2. Installing all dependency and necessary packages.

Redmine has a lot of dependencies so first we will have to install all dependencies of Redmine and necessary packages for Ruby and rvm to do so run following command:

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

Step 3. Installing MariaDB.

We will have to install mariaDB server for the database connectivity of Redmine and to do so run following commands:

yum install mariadb-server

After it’s installed, MariaDB server should be automatically started. Use systemctl to check its status:

systemctl status mysql

When the installation is complete, run the following command to secure your installation:

mysql_secure_installation

Next, we need to create a database for our Redmine installation:

### mysql -uroot -p
MariaDB [(none)]> CREATE DATABASE redmine CHARACTER SET utf8;
MariaDB [(none)]> GRANT ALL PRIVILEGES ON redmine.* TO 'redmine'@'localhost' IDENTIFIED BY 'redmine_passwd';
MariaDB [(none)]> FLUSH PRIVILEGES;
MariaDB [(none)]> \q

Step 4. Create new system user.

Create a new system user for Redmine:

adduser --home /opt/redmine --shell /bin/bash --gecos 'Redmine application' redmine
install -d -m 755 -o redmine -g redmine /opt/redmine

Then, switch to the new redmine user:

sudo su - redmine

Step 5. Installing Ruby using RVM.

Install Ruby run this command as shown below:

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

To start using RVM run the following commands:

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

Step 6. Installing Redmine.

The following commands will checkout the Redmine source code to the $HOME/redmine directory and create the necessary directories:

cd && svn co http://svn.redmine.org/redmine/branches/3.4-stable redmine
mkdir -p ./redmine/tmp/pids ./redmine/public/plugin_assets

Configure database settings:

cp ./redmine/config/configuration.yml.example ./redmine/config/configuration.yml
cp ./redmine/config/database.yml.example ./redmine/config/database.yml

Next, open the database.yml file and update username/password:

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

Step 7. Installing Gems.

Install Gems using following command:

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

Step 8. Prepare the database for Remine.

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

Step 9. Puma configuration.

Create a new configuration file as follows:

###nano ./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:9000"

Finally, Start the puma server with:

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

Step 10. Accessing Redmine.

Now you can access the Redmine web install wizard in your browser by entering the domain name or http://your_ip:9000

Congratulation’s! You have successfully install Redmine on your CentOS 7 server. Thanks for using this tutorial for installing Redmine on CentOS 7 system.

The Tags:

Leave a Comment

Comments are closed.