This Tutorial explains installation and configuration of Ruby, Rails, Passenger and Redmine.

Prerequisite to the this how to:

This tutorial work with following configuration: Ubuntu Server 10.04 LTS (VirtualBox VM).
Make sure you have apache2, phpmyadmin, php and mysql installed and running
Inc ase any of the above package is missing, you can install it through apt-get install [package name].

Legends:

Login as root

sudo -i
[enter password]

Install Ruby with all the packages

aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev

Install apache dependencies

apt-get install apache2 apache2-mpm-prefork apache2-prefork-dev

Install Mongeral Enable required apache mods and restart apache
Mongrel Cluster works as a proxy service under Apache (no additional modification is required).

sudo a2enmod proxy
sudo a2enmod proxy_http
sudo a2enmod rewrite
sudo /etc/init.d/apache2 restart
sudo apt-get install mongrel

Install RubyGems

apt-get install rubygems

add path variable at the end of bashrc file

vi ~/.bashrc
export PATH=/var/lib/gems/1.8/bin:$PATH

Install Rails

apt-get install rails

Install mysql dependencies

apt-get install libmysql-ruby libmysqlclient-dev

configure apache for ROR using passenger

gem install passenger
apt-get install apache2-dev libapr1-dev libaprutil1-dev
apt-get install libcurl4-openssl-dev
/var/lib/gems/1.8/bin/passenger-install-apache2-module

Note: “passenger-install-apache2-module” give you information about LoadModule and Virutal Host to be added. “passenger-install-apache2-module” will mention it as soon as it executes successfully.

Add LoadModule at the end /etc/apache2/apache2.conf

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

Create virtual host name redmine and add information to /etc/apache2/site-available/redmine

vi /etc/apache2/site-available/redmine

<VirtualHost *:80>
ServerName http://www.yourhost.com
DocumentRoot /somewhere/public    # <– be sure to point to ‘public’!
<Directory /somewhere/public>
AllowOverride all              # <– relax Apache security settings
Options -MultiViews            # <– MultiViews must be turned off
</Directory>
</VirtualHost>

I edited the Virtual Host according to my requirements. My Virtual Host looked like:

<VirtualHost *:80>
ServerName redminenxb.com
DocumentRoot /var/www/redmine/public
</VirtualHost>
Now restart apache2 and enable redmine.

a2ensite redmine
service apache2 restart

Ruby, Gems , Rails, Apache, Passenger are setup.

Redmine Installation

First we need to install all the dependencies:

apt-get install apache2-threaded-dev build-essential libapache-dbi-perl libapache2-mod-perl2 libapache2-svn libdigest-sha1-perl libgemplugin-ruby libgemplugin-ruby1.8 libruby-extras libruby1.8-extras mongrel rake ruby1.8-dev subversion

Create a directory and change where redmine is to be installed:

mkdir /var/www/redmine
cd /var/www/

Download the package

wget http://rubyforge.org/frs/download.php/66633/redmine-0.8.6.tar.gz

Extract it

tar -xvf redmine-0.8.6.tar.gz

Copy all its data from directory redmine-0.8.6 to redmine

cp -R /var/www/redmine-0.8.6 /var/www/redmine

Remove the extracted directory now

rm -rf /var/www/redmine-0.8.6 redmine-0.8.6.tar.gz

Change the permissions

chmod -R 777 /var/www/redmine/tmp

now our Redmine application is in the dir /var/www/redmine

Database Connectivity

Login PHPmyadmin as root from you browser:

First, click on “Databases” then, at the bottom of the screen, in the “Create new database” text box create a new database called “redmine” and set “Collation” to “utf8_general_ci”.
Now, go back to the home screen and click on:
“Privileges”
“Add a new User”
Fill out the “Login Information” boxes. Call your user “redmine”. Make sure you remember password you create here. It will be used when you set up the database connection details in Redmine.
In the “Database for user” section, check “Create database with same name and grant all privileges” and click on the “Go” button.
Log out of phpMyAdmin.

Create a database connection for redmine:

cd /var/www/redmine/config

Create a copy of database.yml.example and edit database.yml

cp database.yml.example database.yml
vi database.yml

Goto the production part and edit it according to your requirements:

production:
adapter: mysql
socket: /var/run/mysqld/mysqld.sock
database: redmine
host: localhost
username: redmine
password: [give you database password here]

Create the database structure

rake db:migrate RAILS_ENV=production

Insert the default configuration data in to the database

rake redmine:load_default_data RAILS_ENV=production

Use default administrator account to log in:
Login : admin
Password : admin

Now edit your hostfile according to the virtualhost to check the ROR workings:

vi /etc/hosts

mine looks like

10.28.79.159 redminenxb.com

———————————————————————————————-

To Troubleshooting keep monitoring LOGs

Reference:

https://help.ubuntu.com/community/RubyOnRails

http://www.redmine.org/projects/redmine/wiki/HowTo_Install_Redmine_in_Ubuntu#Step-2-Install-Redmine

Advertisements