Installation Of Redmine With SVN On A cPanel/CentOS 5.6 Server - Page 2

On this page

  1. References:

After SVN is set up correctly let's deal with Redmine.

Go home:

# cd

Get latest Redmine stable source:

# svn co http://redmine.rubyforge.org/svn/branches/2.0-stable redmine-2.0

Install prerequisities:

# gem install bundler
# gem install rmagick

Install bundle:

# cd redmine-2.0
# bundle install --without development test postgresql sqlite

^^^^^^^^^^^^
Note that '--without' can have 'rmagick' as a parameter if it is not installed.

Create a database and user for Redmine (in this case MySQL):

# mysql -u [USERNAME] -p
mysql> create database redmine character set utf8;
mysql> create database redmine_devel character set utf8;
mysql> grant all privileges on [USERNAME]_redmine to [USERNAME];
mysql> grant all privileges on [USERNAME]_redmine_devel to [USERNAME];
mysql> show databases;
+--------------------------+
| Database |
+--------------------------+
| information_schema |
| [USERNAME]_redmine |
| [USERNAME]_redmine_devel |
+--------------------------+
3 rows in set (0.16 sec)
# cp config/database.yml.example config/database.yml
# vi config/database.yml

Modify the file according to your needs with previously set up database, e.g.:

production:
   adapter: mysql
   database: [USERNAME]_redmine
   host: localhost
   username: [USERNAME]
   password: [PASSWORD]
   encoding: utf8

development:
   adapter: mysql
   database: [USERNAME]_redmine_development
   host: localhost
   username: [USERNAME]
   password: {PASSWORD}
   encoding: utf8

Create secret token, fill in the database, etc...

# rake generate_secret_token
# RAILS_ENV=production rake db:migrate
# RAILS_ENV=production rake redmine:load_default_data
# mkdir -p tmp public/plugin_assets
# chown -R [USERNAME]:[USERNAME] files log tmp public/plugin_assets
# chmod -R 755 files log tmp public/plugin_assets

Now test if it works using WEBrick web server:

# ruby script/rails server webrick -e production

Point your webbrowser to http://[DOMAINNAME]:3000
Default admin account: admin / admin

Once checked and all seems working go back to terminal session and kill the WEBrick (e.g.: CTLR+C).

Redmine is set up - now we need to make it working with 'Phusion Passenger', aka 'mod_rails'.

Go back home (again :) and install Passenger:

# cd
# gem install passenger
# passenger-install-apache2-module

If everything goes well, installer will tell you what to do, e.g.:

--------------------------------------------
   The Apache 2 module was successfully installed.

Please edit your Apache configuration file, and add these lines:

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

After you restart Apache, you are ready to deploy any number of Ruby on Rails
   applications on Apache, without any further Ruby on Rails-specific configuration!

Press ENTER to continue.

--------------------------------------------
   Deploying a Ruby on Rails application: an example

Suppose you have a Rails application in /somewhere. Add a virtual host to your
   Apache configuration file and set its DocumentRoot to /somewhere/public:

<VirtualHost *:80>
   ServerName www.yourhost.com
   # !!! Be sure to point DocumentRoot to 'public'!
   DocumentRoot /somewhere/public
   <Directory /somewhere/public>
   # This relaxes Apache security settings.
   AllowOverride all
   # MultiViews must be turned off.
   Options -MultiViews
   </Directory>
   </VirtualHost>

And that's it! You may also want to check the Users Guide for security and
   optimization tips, troubleshooting and other useful information:

/usr/lib/ruby/gems/1.8/gems/passenger-3.0.15/doc/Users guide Apache.html

Enjoy Phusion Passenger, a product of Phusion (www.phusion.nl) :-)
   https://www.phusionpassenger.com

Phusion Passenger is a trademark of Hongli Lai & Ninh Bui.

Let's do it then!

# vi /usr/local/apache/conf/includes/pre_main_global.conf

Add following lines (according to output from Passenger installation):

   # Load passenger module
   LoadModule passenger_module /usr/lib/ruby/gems/1.8/gems/passenger-3.0.15/ext/apache2/mod_passenger.so

Now modify EA3 includes file:

# vi /etc/httpd/conf/userdata/std/2/[USERNAME]/[DOMAINNAME]/redmine.conf

Add following lines (again, according to previous output):

<IfModule mod_passenger.c>
   PassengerRoot /usr/lib/ruby/gems/1.8/gems/passenger-3.0.15
   PassengerRuby /usr/bin/ruby

# Optional - delete HTTP header which would be added by Passenger
   #        Header always unset "X-Powered-By"
   #        Header always unset "X-Rack-Cache"
   #        Header always unset "X-Content-Digest"
   #        Header always unset "X-Runtime"

# Optional - for passenger tuning
   #        PassengerLogLevel 0
   #        RailsAutoDetect On
   #        PassengerMaxPoolSize 20
   #        PassengerMaxInstancesPerApp 4
   #        PassengerPoolIdleTime 3600
   #        PassengerUseGlobalQueue on
   #        #PassengerHighPerformance on !!! conflict with DAV svn
   #        PassengerStatThrottleRate 10
   #        RailsSpawnMethod smart
   #        RailsAppSpawnerIdleTime 86400
   #        RailsFrameworkSpawnerIdleTime 0
   #        PassengerUserSwitching On
   #        PassengerDefaultUser apache
   #        PassengerMaxRequests 3000
   #        PassengerMinInstances 3

RailsBaseURI /redmine

<Directory /home/[USERNAME]/public_html/redmine>
   Options -MultiViews
   </Directory>

</IfModule>

Create a softlink and check:

# ln -s /home/[USERNAME]/redmine-2.0/public /home/[USERNAME]/public_html/redmine
# ls -l /home/[USERNAME]/public_html/redmine
lrwxrwxrwx 1 root root 33 Aug 12 04:05 /home/[USERNAME]/public_html/redmine -> /home/[USERNAME]/redmine-2.0/public/

Now open another terminal session and keep checking for errors:

# tail -f /usr/local/apache/logs/error_log

Back in the first terminal session:

# /scripts/verify_vhost_includes
Testing /usr/local/apache/conf/userdata/std/2/[USERNAME]/[DOMAINNAME]/redmine.conf...ok

If OK, then:

# /scripts/ensure_vhost_includes --user=[USERNAME]
# /scripts/rebuildhttpdconf
# /scripts/restartsrv_httpd

And that should be it! :)

 

References:

Share this page:

1 Comment(s)