Icono del sitio BorrowBits

How to install Redmine 1.3 on CentOS server with WHM/Cpanel.


This guide explains how to install Redmine on a server such as CentOS and WHM/CPanel. Unlike other distributions, we cannot configure Apache just like that since WHM has an internal template system for restoring the modified configuration files based on the server settings; this avoid troubles and provides great stability within production environments.

WHM is prepared to deploy Rails aplication that every user will be able to configure from his own CPanel. The only problem is that available (and needed) gems in WHM are not compatible with Redmine.

In order to set our application we are using Apache 2.2 together with phusion_passenger, besides Redmine 1.3 itself. So we firstly will get the required source code and then we will install Passenger. Let’s run over SSH the following commands:

cd /root/tmp
wget http://rubyforge.org/frs/download.php/75814/redmine-1.3.1.tar.gz
tar zxvf redmine-1.3.1.tar.gz
gem install passenger
passenger-install-apache2-module

Next step is to enable the Passenger module on Apache, we can do this from the Apache configuration panel when using WHM. Inside this panel we will find the «include editor» option and we are adding the following line to the previrtual-host selector:

LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11/ext/apache2/mod_passenger.so
PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.11
PassengerRuby /usr/bin/ruby

and then we press Update. This should reboot Apache without errors. In case we get any error, the path may not be correct. We can use «find» to find out where is what.

Let’s come back to SSH and prepare our project, ready to be deployed:

cd /root/tmp/redmine-1.3.1/config
mv database.yml.example database.yml
cd ../public
mv dispatch.cgi.example dispatch.cgi
mv dispatch.fcgi.example dispatch.fcgi
mv dispatch.rb.example dispatch.rb
mv htaccess.fcgi.example .htaccess

Now we are editing our DB configuration file:

cd ..
nano config/database.yml

Obviously we need to create one DB on MySQL and besides, we recommend to create a fully privileged user only for this DB (not for any other). We can do that either from Cpanel, either from the MySQL shell.

Now we must prepare the gems for Redmine, but we firstly had to get an older version of RubyGems:

cd /root/tmp
wget http://production.cf.rubygems.org/rubygems/rubygems-1.4.2.tgz
tar zxvf rubygems-1.4.2.tgz
cd rubygems-1.4.2
ruby setup.rb

gem install bundler

Let’s create a ./Gemfile and add the following lines:

source "http://rubygems.org"
gem "rake", "0.8.3"
gem "rack", "1.1.0"
gem "i18n", "0.4.2"
gem "rubytree", "0.5.2", :require => "tree"
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
gem "mysql"
gem "coderay", "~>0.9.7"

and run:

bundle install

Next we need to copy the Redmine folder to /home/public_html and change its name to «redmine».

cp /root/tmp/redmine-1.3.1 /home/{user}/public_html/
mv /home/{user}/public_html/redmine-1.3.1 /home/{user}/public_html/redmine
cd /home/{user}/public_html/redmine
chown -R apache:apache ./
chmod -R 755 ./

And we are proceeding to synchronize our DB:

Let’s edit the config/environment.rb file and uncomment the following line:

ENV['RAILS_ENV'] ||= 'production'

Let’s run:

RAS_ENV=production bundle exec rake generate_session_store
RAILS_ENV=prodILuction bundle exec rake db:migrate
RAILS_ENV=production bundle exec rake redmine:load_default_data

This last step will allow us to choose our system language.

If we got here succesfully, we did the hardest part, the application is ready to use. It only needs to be launched on Apache by using passenger. As I told you earlier we cannot edit the main configuration files, but we can ask the system to include additional files created by ourselves through the following script:

/scripts/ensure_vhost_includes --user=[your_username]
/scripts/rebuildhttpdconf
/scripts/restartsrv_httpd

Once that is done, we can add some additional configuration files to the folder /etc/httpd/conf/userdata/std/2/ which end by “.conf”

For example, we are creating the file:
/etc/httpd/conf/userdata/std/2/redmine.conf on which we are writing:

RailsEnv productiond
RailsBaseURI /redmine

Allow from all
Options -MultiViews

Once Apache is restarted:

/etc/init.d/httpd restart

it should be available at this URL: domain_name/redmine

Salir de la versión móvil