21 January 2012

This article will detail how to install Redmine, git and gitosis on Amazon EC2 Linux instance.

Installing Redmine

Download redmine from the project’s source tree.

sudo mkdir -p /src/redmine
sudo chown <your user id>:<your group id> /src/redmine
cd /src/redmine
svn co http://redmine.rubyforge.org/svn/branches/1.3-stable redmine-1.3

Create the databate configuration file. A sample is provided in the config directory, containing configuration examples for MySQL 5.x and PostgreSQL 8. In my case, SQLite3 will be sufficient.

cat <<EOT > /src/redmine/redmine-1.3/config/database.yml
  adapter: sqlite3
  dbfile: db/redmine.db

Redmine requires some gems and we’ll install bundler to manage them easily.

sudo gem install bundler

Then create the following Gemfile.

cat <<EOT /src/redmine/redmine-1.3/Gemfile
# file: /src/redmine/redmine-1.3/Gemfile
source "http://rubygems.org"
gem "rails", "2.3.14"
gem "rake", "0.8.7"
gem "rack", "1.1.0"
gem "i18n", "0.4.2"
gem "rdoc", "~>2.4.2"
gem "rubytree", "0.5.2", :require => "tree"
gem "RedCloth", "~>4.2.3", :require => "redcloth" # for CodeRay
gem "coderay", "~>0.9.7"

… and run bundler to install them

bundle install

You can optionaly set production as the default environment by uncomment the following line in file redmine/config/environment.rb:

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

Next generate the session store with

RAILS_ENV=production bundle exec rake generate_session_store

Then migrate the database models

RAILS_ENV=production bundle exec rake db:migrate

Finally load default data if you want redmine to be populated with example content.

RAILS_ENV=production bundle exec rake redmine:load_default_data

… and follow instructions.

Publishing on Apache

Create a symbolic link in the /var/www/html directory pointing to the public directory of the redmine source tree.

sudo ln -s /src/redmine/redmine-1.3/public /var/www/html/redmine

Next, install Phusion Passenger to simplify the deployment of web applications based on the Ruby on Rails framework. For more information on Phusion Passenger, go to modrails

Passenger’s requires some apache modules :

  • Apache 2 development headers
  • Apache Portable Runtime (APR) development headers
  • Apache Portable Runtime Utility (APU) development headers

To install them, simply run

sudo yum install apr-devel apr-util-devel httpd-devel

Then install the gem.

sudo gem install passenger

Then run passenger-install-apache2-module to install, as the name mention, the passenger module for apache.

sudo passenger-install-apache2-module
cat <<EOT | sudo sh -c 'cat - > /etc/httpd/conf.d/modpassenger.conf'
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

Define the apache configuration file for the redmine “site”

cat <<EOT | sudo sh -c 'cat - > /etc/httpd/conf.d/redmine.conf'
RailsEnv production
RailsBaseURI /redmine

Restart apache

sudo service httpd restart

blog comments powered by Disqus