Suresh Payankannur

Saturday, September 3, 2011

Ubuntu + Redmine + Apache2 + Passenger + Enterprise Ruby + MySQL

This post describes how to install Redmine on Ubuntu, behind Apach2 and Passenger Mode using Enterprise Ruby. I am using Amazon 64-bit Ubuntu AMI.

Install MySQL

sudo apt-get install mysql-server
sudo apt-get install mysql-client
sudo apt-get install libmysqlclient-dev
mysql -u root -p
mysql> create database redmine set character utf8;
mysql> grant all privileges on redmine.* to '<redmine-user>'@'localhost' identified by '<redmine-pass>' with grant option;
mysql> flush privileges;

Install Apache

sudo apt-get install apache2

Install Redmine

cd /opt
sudo wget
sudo tar xvzf redmine-1.2.1.tar.gz
sudo ln -s redmine-1.2.1 redmine
sudo chown -R root:root redmine
sudo chown -R root:root redmine-1.2.1
cd redmine
sudo chmod 0755 log
cd log
sudo touch production.log
sudo chmod 0666 production.log
cd ../config
sudo cp database.yml.example database.yml
// Edit the database.yml and change the settings on production to reflect the MySQL database name, db user name and db password created in the above section.

Install Enterprise Ruby

mkdir ~/tmp
cd ~/tmp
tar xvzf ruby-enterprise-1.8.7-2011.03.tar.gz
cd ruby-enterprise-1.8.7-2011.03
sudo ./installer
This step will tell you what packages are missing. Follow the instructions and install all the required packages. Then re-run the installer. The installer will compile the ruby enterprise edition and will ask the directory to install. By default, it will be installed in the /opt directory.

In my case, the compiler came back with the following error:

ossl_ssl.c:104:1 - 'SSLV2_method' undeclared here (not in a function)
ossl_ssl.c:105:1 - 'SSLV2_server_method' undeclared here (not in a function)
ossl_ssl.c:106:1 - 'SSLV2_client_method' undeclared here (not in a function)

The solution was to comment out these lines from the source code ~/tmp/ruby-enterprise-1.8.7-2011.03/source/ext/openssl/ossl_ssl.c and re-run the installer.

Wait for the installer to finish. It will take a while.

Install Passenger

cd /opt/ruby-enterprise-1.8.7-2011.03/bin
sudo ./passenger-install-apache2-module

This step will tell you missing packages and how to install them.

Install some of the missing gems

cd /opt/ruby-enterprise-1.8.7-2011.03/bin
sudo ./gem install --no-rdoc --no-ri rack -v=1.1.0
sudo ./gem install  --no-rdoc --no-ri i18n -v=0.4.2
sudo ./gem install --no-rdoc --no-ri gruff
sudo ./gem install --no-rodc --no-ri fastercsv

Configure Apache

  • Edit /etc/apache2/sites-available/default and add the following, assuming you are hosting the redmine at the root.
    DocumentRoot /opt/redmine/public
    PassengerMaxPoolSize 10
    PassengerMinInstances 3
    PassengerHighPerformance on
    PassengerRoot /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.8
    PassengerRuby /opt/ruby-enterprise-1.8.7-2011.03/bin/ruby
    <Directory /opt/redmine/>
        Options FollowSymLinks -MultiViews
        AllowOverride none
        Order allow, deny
        allow from all
        PassengerAppRoot /opt/redmine
  • To load the passenger module, create a new file /etc/apache2/mods-available/passenger.load and add the following line:
    LoadModule passenger_module /opt/ruby-enterprise-1.8.7-2011.03/lib/ruby/gems/1.8/gems/passenger-3.0.8/ext/apache2/
  • Enable the module
    cd /etc/apache2/modes-enabled
    sudo ln -s ../modes-available/passenger.load passenger.load 

Start the apache

sudo /etc/init.d/apach2 start

Point the browser http://localhost and see if any libraries or gems are missing. Also inspect the /var/log/apache2/error.log and /opt/redmine/log/production.log for any issues.


Post a Comment

Blog Archive

Scroll To Top