How To Install Redmine on CentOS 7

How To Install Redmine on CentOS 7

In this tutorial, we will show you how to install Redmine on CentOS 7. Redmine is a free and open source issue tracking and web-based project management application . Redmine is built on Ruby on Rails framework and it is cross-platform and cross-database. This guide should work on other Linux VPS systems as well but was tested and written for CentOS 7 VPS. Let’s get started with installing Redmine on your CentOS 7 server.

1. 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

2. Install MariaDB

To install the MariaDB package, run:

yum install mariadb-server

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

3. Create new user

Create a new system user for Redmine.

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

Switch to the new redmine user:

sudo su - redmine

4. Install Ruby using RVM

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

To verify everything is done correctly, use the command ruby --version.
The output should be similar to the following:

ruby --version
ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-linux]

5. Install 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

Open the database.yml file and update username/password

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

6. Install 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

7. Prepare the database

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

8. Puma 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:9000"

9. 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...

Finally your can start your browser and access your new Redmine installation at: http://IP_ADDRESS:9000

That’s it. You have successfully installed Redmine on your Ubuntu VPS. For more information about Redmine, please refer to the Redmine website.


Of course you don’t have to Install Redmine on CentOS 7, if you use one of our Redmine Hosting services, in which case you can simply ask our expert Linux admins to setup this for you. They are available 24×7 and will take care of your request immediately. We also published a guide on How to Install Redmine on CentOS 8.

PS. If you liked this post , on How To Install Redmine on CentOS 7, please share it with your friends on the social networks using the buttons on the left or simply leave a reply below. Thanks.

22 thoughts on “How To Install Redmine on CentOS 7”

  1. Thank you for this “How To”, very easy.
    2 very little improvments:
    – In §3, command “sudo adduser –home /opt/redmine –shell /bin/bash –gecos ‘Redmine application’ redmine” reutrns the error that –gecos is unknown option, -c must be used.
    – In §8, at the beginning just add command “cd /opt/redmine” (to be in the rigth folder)

    Reply
    • Thanks for your feedback, Nemehy.
      You are right, if the –gecos command is unknown by your system, you can use -c to specify the user’s full name.
      And yes, you need to make sure you are in the correct directory ‘/opt/redmine’ before running the ‘vim ./redmine/config/puma.rb’ command.

      Reply
  2. Do I need to do something with firewall? Followed all steps with no error and: http://MY_IP:9000 does not display anything but: ERR_CONNECTION_TIMED_OUT chrome msj

    Reply
  3. i kill puma for smtp settings.

    [redmine@redmine init.d]$ cd /opt/redmine/redmine/ && bundle exec puma –config config/puma.rb
    bundler: command not found: puma
    Install missing gem executables with `bundle install`

    Reply
    • Hi Huka,

      Please closely follow the instructions. If you do everything as described in our tutorial, you shouldn’t have any issues.
      However, you can try with
      $ rm .bundle/config (remove a broken bundler configuration)
      $ gem update –system (might help if rubygems is outdated/broken)
      $ gem update bundler (might help if bundler is outdated/broken)
      $ bundle install (install dependency)

      Reply
  4. When installing bundler, you should download a version < 2.0.0

    If you already have bundler in a newer version, type
    gem uninstall bundler
    to install specific version type
    gem install bundler –version '1.7.4'

    The author might wanna change this accordingly :-)

    Reply
  5. Thanks for this tutorial, very useful, not everything worked since first time but if you fix the problems one by one, you can success.

    Reply
  6. [redmine@redmine ~]$ source ~/.rvm/scripts/rvm
    bash: /opt/redmine/.rvm/scripts/rvm: No such file or directory

    What do I do here?

    Reply
    • Make sure that you have RVM installed on your server. You can install RVM with the command:

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

      or you can try the following:

      source /usr/local/rvm/scripts/rvm
      Reply
  7. this is worked for me for redmine version 3.4.x on centos 7.5. but after restart server, even reload bundle exec puma –config config/puma.rb and restart httpd, redmine is not browse and not reach. stop the firewalld and check db is ok. any idea for this please?

    Reply
      • the only suspect line i got with below..
        httpd: AH00558: httpd: Could not reliably determine the server’s fully qualified domain name, using ::1. Set the ‘ServerName’ directive globally to suppress this message

        Reply
        • Open the Apache configuration file and add the following line: ServerName yourdomain.com
          Replace yourdomain.com with the actual server hostname (or use a domain hosted on your server).
          Restart Apache for the changes to take effect.

          Reply

Leave a Comment