• Get In Touch
January 2, 2017

How to Install Redmine 3 on CentOS 7

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Redmine is a free and open source, web-based project management and issue tracking tool. You can manage multiple projects and sub-projects using Redmine. Redmine includes a calendar and Gantt charts to aid visual representation of projects and their deadlines. Redmine is based on Ruby on Rails framework. It is cross-platform and cross-database and released under the terms of the GNU General Public License v2 (GPL).

Some of the features of Redmine are listed below:

  • Multiple projects support
  • Flexible role based access control
  • Flexible issue tracking system
  • Gantt chart and calendar
  • News, documents & files management
  • Feeds & email notifications
  • Per project wiki
  • Per project forums
  • Time tracking.

Requirements

It does not require any special kind of hardware it will need only a CentOS 7 server and root privileges on it but it is recommended to update your system using following command:

yum -y update

Installing Dependencies

First of all login to your system as the root user. 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 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 iconv-devel subversion

It will install all dependencies and packages that are necessary for installation. If it will ask you to set a password for MySQL then you’ll have to type in your new password.

Now let’s install Ruby and RVM (Ruby Version Manager).

Installing Ruby and RVM

Redmine 3 supports Ruby 2.2 so we will install Ruby 2.2. We can manage and work with multiple Ruby on the same server using Ruby Version Manager.
run following command:

gpg2 --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3

Now run this command as shown below:

curl -L https://get.rvm.io | bash -s stable --ruby=2.2.5

It will take some time you’ll have to wait.

Reload the RVM using this:
source /usr/local/rvm/scripts/rvm

Now we have to add it the .bashrc file so it can be automatically reload and to add it to the .bashrc file run this:

echo '[[ -s "/usr/local/rvm/scripts/rvm" ]] && source "/usr/local/rvm/scripts/rvm"' >> ~/.bashrc

Reload the .bashrc file using this command:

source ~/.bashrc

Now run following command as shown below to check Ruby and RVM version:

ruby -v

For RVM version use this command:

rvm -v

You’ll see similar to this on your terminal screen:

[root@ip-172-31-16-36 ~]# ruby -v
ruby 2.2.5p319 (2016-04-26 revision 54774) [x86_64-linux]
[root@ip-172-31-16-36 ~]# rvm -v
rvm 1.28.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
[root@ip-172-31-16-36 ~]#

Configure Database Connection

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

rpm -Uvh https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm

It is recommended to check enable repository using following command:

yum repolist

You’ll have to install MySQL server using following command as shown below:

yum install mysql-server

Now start the mysqld service using systemctl command as shown below:

systemctl start mysqld

By running this MySQL will be started so now you’ll have to configure password for MySQL server and to do so use grep command as shown below:

grep 'temporary password' /var/log/mysqld.log

You’ll see something similar to this on your screen which contain temporary password for MySQL server:

2017-01-01T11:00:43.229642Z 1 [Note] A temporary password is generated for root@localhost: w8)pXQyNorBo

You can see the temporary password is quite complicated so we recommend you to change it and to do so run following:

mysql -u root -p

You’ll have to enter the generated password which we just got.

GENERATED PASSWORD: w8)pXQyNorBo

Now we will set a new password and to do so we will use Mysql query as shown below:

ALTER USER 'root'@'localhost' IDENTIFIED BY 'Aqwe123@!';

Now you’ll have to create a new database here below we are creating a database with named as ‘redmine’ with password ‘redmine’ but you can change the name of database anything you wish and we recommend you to use a strong and very secure password for your server.

create database redmine;
create user redmine@localhost identified by 'Redmine123@!';
grant all privileges on redmine.* to redmine@localhost identified by 'Redmine123@!';
flush privileges;
exit

You’ll see an output like this on your screen:

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

mysql> exit
Bye
[root@ip-172-31-16-36 ~]#

Now we have created a database and a user successfully.

Installing Nginx

Before installing Nginx we will have to install Phusion Passenger. It is a web application server which can be used with apache and Nginx so run following commands to do so as hown below:

gem install passenger --no-ri --no-rdoc

Now run passenger-install-nginx-module
With running above command you’ll be asked that which programming language will be used so it is recommended to select Ruby and Python as shown below:

Which languages are you interested in?

Use <space> to select.
If the menu doesn't display correctly, press '!'

 > (*)  Ruby
   (*)  Python
   ( )  Node.js
   ( )  Meteor

Now you’ll be asked about Nginx installation so select yes which is recommended as shown below:

Automatically download and install Nginx?

Nginx doesn't support loadable modules such as some other web servers do,
so in order to install Nginx with Passenger support, it must be recompiled.

Do you want this installer to download, compile and install Nginx for you?

 1. Yes: download, compile and install Nginx for me. (recommended)
    The easiest way to get started. A stock Nginx 1.10.2 with Passenger
    support, but with no other additional third party modules, will be
    installed for you to a directory of your choice.

 2. No: I want to customize my Nginx installation. (for advanced users)
    Choose this if you want to compile Nginx with more third party modules
    besides Passenger, or if you need to pass additional options to Nginx's
    'configure' script. This installer will  1) ask you for the location of
    the Nginx source code,  2) run the 'configure' script according to your
    instructions, and  3) run 'make install'.

Whichever you choose, if you already have an existing Nginx configuration file,
then it will be preserved.

Enter your choice (1 or 2) or press Ctrl-C to abort:

Next you’ll be asked to provide directory for the Nginx installation use the default directory ‘/opt/nginx/’ simply just press Enter.

Here you have installed Nginx successfully now let’s configure it as we are discussing below.

Configure Nginx

Nginx installation is completed so now let’s configure it so first of all go to the installation directory now you’ll have to edit the configuration file ‘nginx.conf’ with any text editor here we are using nano text editor you can use any text editor you want. Run following commands to edit the file:

If in any case you haven’t installed nano text editor on your system then first install it using these commands:

yum install nano

cd /opt/nginx/

cd conf/

Now we are in installation directory let’s edit the file.

nano nginx.conf

Add the following content at line 24 you can simply copy-paste this to file:

include vhost/*.conf;

Save and exit the text editor.

Now you’ll have to create a new directory called ‘vhost’ for virtual host configuration and to do so run following command as shown below:

mkdir -p /opt/nginx/conf/vhost

The new directory is created so go to the ‘vhost’ directory and create virtual host configuration using nay text editor as shown below:

cd /opt/nginx/conf/vhost/
nano redmine.conf

Add following content to the file:

    server {
        listen       80;
        server_name  www.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;
        }
    }   

And save the file.

Run following command to go to the systemd directory and use nano text editor to create a new service file as shown below:

cd /lib/systemd/system/
nano nginx.service

Add following content given below:

[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 the file and exit text editor.

It is recommended to reload the systemd service using following command:

systemctl daemon-reload

Now start nginx with systemctl command as shown below:

systemctl start nginx

Run netstat command to check nginx and open port number 80, to do so run following command:

netstat -plntu | grep nginx

Installing Redmine

First of all create a new directory for Redmine installation here we are using ‘/var/www/’ directory for the installation.

mkdir -p /var/www/

Now go to the directory you just created and download the Redmine from the official website as shown below:

cd /var/www/
svn co https://svn.redmine.org/redmine/branches/3.2-stable redmine

Now copy the configuration file and database file from the Redmine directory. To do so run following commands first of all go to the Redmine directory using ‘cd’ command:

cd redmine

Now we are in Redmine directory so copy the configuration file and database file using these commands:

cp config/configuration.yml.example config/configuration.yml

cp config/database.yml.example config/database.yml

Now you’ll have to edit the database.yml file using any text editor again here we are using nano text editor.

nano config/database.yml

You’ll see production section as shown below, fill in the database name user and password:

production:
  adapter: mysql2
  database: redmine
  host: localhost
  username: redmine
  password: "Redmine123@!"
  encoding: utf8 

Save the file.

Run following commands to change the owner to user and group nobody:

mkdir -p tmp tmp/pdf public/plugin_assets

sudo chown -R nobody:nobody files log tmp public/plugin_assets

sudo chmod -R 775 files log tmp public/plugin_assets

Now we will install the bundler and gem dependencies for Redmine and to do so run following command as shown below:

gem install bundler

bundle install --without development test

Run following in order to generate token and database default data set:

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

Finally restart the nginx using following command:

systemctl restart nginx

Now visit redmine domain in a web browser and in web browser you’ll see this http://yourserverIPaddress:

HP_NO_IMG/data/uploads/users/744ed2f1-2baa-42b2-b09d-ad15a2ae3934/1666829779.png” alt=” ” />

Now go to the login page and the default value of user and password is admin so enter ‘admin’ in both field.

HP_NO_IMG/data/uploads/users/744ed2f1-2baa-42b2-b09d-ad15a2ae3934/1581671048.png” alt=” ” />

Create a sample project and now you can manage it with Redmine. You can create as many projects as you want.

Conclusion

We learned how to install and work with Redmine 3 on CentOS. Now you can manage many projects and sub-projects associated with them.

Want your very own server? Get our 1GB memory, Xeon V4, 25GB SSD VPS for £10.00 / month.
Get a Cloud Server

Share this Article!

Related Posts

Node.js Authentication – A Complete Guide with Passport and JWT

Node.js Authentication – A Complete Guide with Passport and JWT

Truth be told, it’s difficult for a web application that doesn’t have some kind of identification, even if you don’t see it as a security measure in and of itself. The Internet is a kind of lawless land, and even on free services like Google’s, authentication ensures that abuses will be avoided or at least […]

Node.js and MongoDB: How to Connect MongoDB With Node

Node.js and MongoDB: How to Connect MongoDB With Node

MongoDB is a document-oriented NoSQL database, which was born in 2007 in California as a service to be used within a larger project, but which soon became an independent and open-source product. It stores documents in JSON, a format based on JavaScript and simpler than XML, but still with good expressiveness. It is the dominant […]

Using MySQL with Node.js: A Complete Tutorial

Using MySQL with Node.js: A Complete Tutorial

Although data persistence is almost always a fundamental element of applications, Node.js has no native integration with databases. Everything is delegated to third-party libraries to be included manually, in addition to the standard APIs. Although MongoDB and other non-relational databases are the most common choice with Node because if you need to scale an application, […]

Node.Js Vs Django: Which Is the Best for Your Project

Node.Js Vs Django: Which Is the Best for Your Project

Django and NodeJs are two powerful technologies for web development, both have great functionality, versatile applications, and a great user interface. Both are open source and can be used for free. But which one fits your project best? NodeJs is based on JavaScript, while Django is written in Python. These are two equally popular technologies […]

Nodejs Vs PHP:  Which Works Best?

Nodejs Vs PHP: Which Works Best?

Before getting into the “battle” between Node.js and PHP we need to understand why the issue is still ongoing. It all started with the increased demand for smartphone applications, their success forcing developers to adapt to new back-end technologies that could handle a multitude of simultaneous requests. JavaScript has always been identified as a client-side […]