How to install Redmine (version 3.1.1) on Apache — CentOS 7

Configuration of Redmine.

Following procedure should help you to install Redmine tool on your CentOS 7 machine.

Couple of Assumptions:-

  • You are logged on to machine as root user.
  • Apache 2.x & MySQL/MariaDB is installed on your machine and document root is /var/www/html
  • Installation of Ruby 2.2 is also taken care along with development tools for centos. If you need the instructions can be found on following URL
    http://www.server-world.info/en/note?os=CentOS_7&p=ruby22

Download the Redmine version 3.1.1 from Redmine Site

# wget http://www.redmine.org/releases/redmine-3.1.1.tar.gz

Extract Redmine from the gzip tarball

# tar zxvf redmine-3.1.1.tar.gz

Move extracted Redmine directory to /var/www

# mv redmine-3.1.1 /var/www/redmine
# cd /var/www/redmine

Now follow below steps to create user & database for Redmine.

  • mysql -u root -p (Enter the password and you will get to MySQL/MariaDB prompt)
  • CREATE DATABASE redmine;
  • GRANT ALL PRIVILEGES on redmine.* to username@’localhost’ identified by ‘YOUR PASSWORD’;
  • GRANT ALL PRIVILEGES on redmine.* to root@’localhost’ identified by ‘YOUR PASSWORD FOR ROOT’;
  • FLUSH PRIVILEGES;

With above steps you have created Database “redmine” and user to access it.

You are alredy in /var/www/redmine directory. Modify settings in database.yml to based on above steps.

# mv ./config/database.yml.example ./config/database.yml
# vi ./config/database.yml

Modify username and password with the one setup earlier during redmine database configuration. Save and Exit the file. Similarly modify confguration.yml file and change SMTP settings to enable redmine to send emails.

Install/update the bundler

# gem install bundler –no-rdoc –no-ri

Install Gem for Redmine

# bundle install –without development test postgresql sqlite

Generate Keys

# bundle exec rake generate_secret_token

Generate Tables
# bundle exec rake db:migrate RAILS_ENV=production

Install Passenger

# gem install passenger –no-rdoc –no-ri

Install modules for Apache

# passenger-install-apache2-module

Once you execute above command following message will be displayed and you need to proceed as per the instructions on the screen

This installer will guide you through the entire installation process. It shouldn’t take more than 3 minutes in total.
Here’s what you can expect from the installation process:

  • The Apache 2 module will be installed for you.
  • You’ll learn how to configure Apache.
  • You’ll learn how to deploy a Ruby on Rails application.

Don’t worry if anything goes wrong. This installer will advise you on how to solve any problems.
Press Enter to continue, or Ctrl-C to abort. Specify 1 and hit Enter.

Restart Apache process

# systemctl restart httpd

You are ready to deploy any number of web applications on Apache, with a minimum amount of configuration!

Create configuration file for passenger and add following lines to run Redmine on port 8080. As I am assuming that on default port 80 you might have some other website running already. You can change the port number based on your convenience and configuration of machine.

# vi /etc/httpd/conf.d/passenger.conf

LoadModule passenger_module /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.20/buildout/apache2/mod_passenger.so
PassengerRoot /usr/lib64/ruby/gems/2.2.0/gems/passenger-5.0.20
PassengerDefaultRuby /usr/bin/ruby
PassengerDefaultUser apache
NameVirtualHost *:8080
ServerName xxx.xxx.xxx.xxx #(Either IP of your machine or FQDN)
DocumentRoot /var/www/redmine/public

Save and exit out of vi editor.

Modify /etc/httpd/conf/httpd.conf and add following line into it
Listen 8080
Save and exit. Make sure that the port which you are defining is opened through firewall in order to accept the requests on this port.

Restart Apache process

# systemctl restart httpd

Now you can visit following URL to get to Redmine login page.
http://(IP address or FQDN of your webserver):8080

Techprimelab Software Pvt. Ltd.