Tuesday, 31 May 2011

How to Install Fedena on Fedora 13

How to Install Fedena on Fedora 13

1. Setup required ruby, rubygems, rails and other packages.

# yum install ruby rubygems ruby-mysql mysql-server

Wait. But Fedora 13 resitory has ruby version 1.8.6 . We need 1.8.7 in order to install fedena on fedora 13.
Its avalable in rawhide repository. We need to rebuild it.

1.1 Rebuilding rawhide ruby and rybygem

Asuming you have rpm build environment.


#yum remove ruby  Remove previously installed ruby rpms.
#yum install yum-utils fedora-release-rawhide
#yumdownloader --enablerepo=rawhide --source ruby rubygems ruby-libs ruby-devel
#yum install $( rpm -qRp ruby-*src.rpm | grep -v rpmlib)
#rpmbuild --rebuild ruby-*src.rpm
#cd /root/rpmbuild/RPMS/

Now we have folowing build rpms ready for install
ruby-1.8.7.334-1.fc13.x86_64.rpm
ruby-libs-1.8.7.334-1.fc13.x86_64.rpm
ruby-devel-1.8.7.334-1.fc13.x86_64.rpm
ruby-ri-1.8.7.334-1.fc13.x86_64.rpm
ruby-static-1.8.7.334-1.fc13.x86_64.rpm
ruby-tcltk-1.8.7.334-1.fc13.x86_64.rpm
ruby-irb-1.8.7.334-1.fc13.noarch.rpm
ruby-rdoc-1.8.7.334-1.fc13.noarch.rpm

#yum install x86_64/ruby-* --nogpgcheck
#yum install noarch/ruby-* --nogpgcheck

Now we got ruby 1.8.7 installed.

Now install rubygems

# yum install rubygems

2. Download latest fedena source code from GitHub.

# wget -c https://download.github.com/projectfedena-projectfedena_v2.0-a213125.tar.gz
extract it to the installation directory.

I normally uses /opt for non-fedora repository packages to install.

#tar -zxvf /home/user/Downloads/Packages/projectfedena-projectfedena_v2.0-a213125.tar.gz
#mv projectfedena-projectfedena_v2.0-a213125 /opt/fedena


3.Installing Rails version 2.3.5


Fedena runs on version 2.3.5 of rails,

This will fetch and install ruby packages by gem command.

# gem install rails -v=2.3.5
Fetching: activesupport-2.3.5.gem (100%)
:
:   ( Content suppresed)
:
Installing RDoc documentation for rails-2.3.5...

4. Setup mysql server and database details in database.yml.

Because fedena uses mysql database.

# yum install mysql-server mysql-client libmysql-ruby

start mysqld service.

# service mysqld restart

Restarting mysqld (via systemctl):                        [  OK  ]

Now put database details in database.yml file.

# cd /opt/fedena/

Open the file database.yml in the config folder of the fedena soucre. And change the following details.

# vim /opt/fedena/config/database.yml

database: fedena - The name of the database you want to use for fedena

username: root - Mysql username for fedena

password: mypass - The password for the above mysql user.

5 .Installing the prawn gem


#gem install prawn -v=0.6.3

6.Installing the rest of the gems

Install the rest of the gems by running

#rake gems:install        (According to install guide on projectfedena.org)

This command doesn't work in fedora. I got following error.

If you install rubygems version newer than  3.7-2. YOu will get the following error.

So remove it and install 3.7.2 rpm.

# rake gems:install
rake/rdoctask is deprecated.  Use rdoc/task instead (in RDoc 2.4.2+)
rake aborted!
uninitialized constant ActiveSupport::Dependencies::Mutex

(See full trace by running task with --trace)


So I tried following command. You need to be in fedena intallation home directory.

# gem install rake

Fetching: rake-0.9.0.gem (100%)
Successfully installed rake-0.9.0

1 gem installed
Installing ri documentation for rake-0.9.0...
Installing RDoc documentation for rake-0.9.0...

Then run above commend

# rake gems:install

This will install remaining gems dependancies required by fedena.


7. Now create fedena mysql database
In fedena source directory run following command to create fedena database,


# rake db:create

and
 
# rake db:migrate

8. Make  server scriptS executable.


#chmod +x script/*

 9. Now finally start the server by running server script.

#/opt/fedena/script/server

Your fedena application server is started now.
put http://serveraddress:3000 in your browser.
Note that your default admin user name is admin and password is admin123.

If you want to run fedena inside apache server.

# gem install passenger

make sure you have  gcc-c++ curl-devel zlib-devel httpd-devel apr-devel apr-util-devel installed.

# passenger-install-apache2-module            

follow the instructions.

Make changes in apache configuration file(httpd.conf).
Add following lines in httpd.conf file.

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


And add virtual host.


        ServerName fedena.yourhost.com
        DocumentRoot /opt/fedena/public
        ServerAlias www.fedena.yourhost.com
        ErrorLog logs/fedena.yourhost-error_log
        CustomLog logs/fedena.yourhost.com-access_log combined
       
        AllowOverride all
         Options -MultiViews
     

  
 
Reload apache

# service httpd reload

Now you can access fedena http://fedena.yourhost.com