Hamsa K
Editor
9 min read | 1 month ago

How to Install and Configure Redmine on Centos 7

How to Install Redmine on Centos 7

Redmine is an open source web application for project management and issue tracker. Redmine is based on the Ruby on Rails Framework, it has cross-platform and cross-database support.

In this page, we will install Redmine  with Nginx as the web server, MySQL as the database server on a CentOS 7 (64 bit) operating system.

Install packages

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

Install Ruby using RVM

We will install the latest version of Ruby using Ruby Version Manager, or RVM. It is used to install and manage multiple versions of Ruby.

curl -sSL https://rvm.io/mpapis.asc | gpg --import -
curl -L get.rvm.io | bash -s stable
source /etc/profile.d/rvm.sh
rvm reload
rvm requirements run
rvm install 2.6
rvm list known
ruby -v 
rvm -v

sample output

[root@centos ~]# ruby -v
ruby 2.6.3p62 (2019-04-16 revision 67580) [x86_64-linux]
[root@centos ~]# rvm -v
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]

Install Mysql

rpm -Uvh  https://repo.mysql.com/mysql80-community-release-el7-3.noarch.rpm
yum install mysql-server
systemctl start mysqld
systemctl enable mysqld
grep "A temporary password" /var/log/mysqld.log
mysql_secure_installation

output:

[root@centos ~]# mysql --version
mysql  Ver 8.0.18 for Linux on x86_64 (MySQL Community Server - GPL)

By default, MySQL 8 sets the default password policy to "caching_sha2_password".change the default policy in MySQL config file (likely /etc/my.cnf) by uncommenting the line

default-authentication-plugin=mysql_native_password

and restart mysql service by follwing command

systemctl restart mysqld

Next, create a new database called "redmine" and create a new user 'redmineuser' with password as strong password (use secure password). Then grant all privilages for the user to the 'redmine' database.

mysql> create database redmine;
Query OK, 0 rows affected (0.01 sec)
mysql> create user redmineuser@localhost identified by 'strong password';
Query OK, 0 rows affected (0.01 sec)
mysql> grant all privileges on redmine.* to redmineuser@localhost;
Query OK, 0 rows affected (0.03 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.04 sec)

still if you face any issue with password policy while creating user then follow below command

mysql> ALTER USER 'redmineuser'@'localhost' IDENTIFIED WITH mysql_native_password BY 'password';
Query OK, 0 rows affected (0.01 sec)

Install phusion Passenger

Phusion Passenger is web application server that can be used together with apache and nginx. It supports multiple languages like Ruby, Python and Nodejs. It  can handle more traffic.

we will install the Phusion Passenger and integrate it with our nginx web server. Install passenger with the gem command, then run the command passenger-nginx-module.

gem install passenger
passenger-install-nginx-module

The command will ask which programming language shall be used, select Ruby

Which languages are you interested in?
Use <space> to select.
If the menu doesn't display correctly, press '!'
 > (*)  Rubyy
   ( )  Python
   ( )  Node.js
   ( )  Meteor

Next it will ask about nginx installation 

Enter your chioce : 1

It will download and install nginx as default path /opt/nginx. press enter

Configure Nginx :

Edit nginx configuration file as below

vi /opt/nginx/conf/nginx.conf
Paste the configuration below at line 24 and save it.
include vhost/*.conf;

Create a new 'vhost' directory for the virtual host configuration

mkdir -p /opt/nginx/conf/vhost
vi /opt/nginx/conf/vhost/redmine.conf

paste below content to above file.

server {
        listen       80;
        server_name  redmine.me;
        root /var/www/redmine/public;
        passenger_enabled on;
        client_max_body_size      10m; # Max attachemnt size
        # redirect server error pages to the static page /50x.html
        #
        error_page   500 502 503 504  /50x.html;
        location = /50x.html {
            root   html;
        }
    }

Next we configure nginx for systemd. Go to the systemd directory and create new service file named 'nginx.service'.

vi /lib/systemd/system/nginx.service

paste below content to above file

[Unit]
Description=The NGINX HTTP and reverse proxy server
After=syslog.target network.target remote-fs.target nss-lookup.target
[Service]
Type=forking
PIDFile=/opt/nginx/logs/nginx.pid
ExecStartPre=/opt/nginx/sbin/nginx -t
ExecStart=/opt/nginx/sbin/nginx
ExecReload=/bin/kill -s HUP $MAINPID
ExecStop=/bin/kill -s QUIT $MAINPID
PrivateTmp=true
[Install]
WantedBy=multi-user.target

save and exit the file. Now reload systemd service and start nginx as below

[root@centos ~]# systemctl daemon-reload
[root@centos ~]# systemctl start nginx
[root@centos ~]# netstat -plntu | grep nginx
tcp        0      0 0.0.0.0:80              0.0.0.0:*               LISTEN      22748/nginx: master

Install Redmine

Go to /var/www directory and download Redmine with the svn command

[root@centos ~]# cd /var/www/
[root@centos www]# svn co https://svn.redmine.org/redmine/branches/4.0-stable redmine

you can go to Redmine directory and copy the configuration file and database configuration file as below

[root@centos redmine]# cp config/configuration.yml.example config/configuration.yml
[root@centos redmine]# cp config/database.yml.example config/database.yml
[root@centos redmine]# vi config/database.yml

In production section you can give database username and password

sample output:

[root@centos redmine]# cat config/database.yml
production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmineuser
  password: "password"
  encoding: utf8

save the file.create few directories and change permissions 

[root@centos redmine]# mkdir -p tmp tmp/pdf public/plugin_assets
[root@centos redmine]# chown -R nobody:nobody files log tmp public/plugin_assets
[root@centos redmine]# chmod -R 775 files log tmp public/plugin_assets

Install bundler 

gem install bundler
bundle install --without development test

Note: If you face any errors related to mysql or rmagic while bundle install refer below commands (For your reference)

 yum install mysql-community-devel
 gem install mysql2 -v '0.5.2'
 bundle install --without development test
 gem install rmagick -v '2.16.0
 yum install ImageMagick-devel
 gem install rmagick -v '2.16.0
 bundle install --without development test

Once bundle install run successfully, then generate the secret token, then generate the database with below commands

bundle exec rake generate_secret_token
RAILS_ENV=production bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

Then restart nginx and check redmine in yourbrowser with ip.

once loggedin, you can create new project and add users etc.



Warning! This site uses cookies
By continuing to browse the site, you are agreeing to our use of cookies. Read our terms and privacy policy