Skip to content
ksinkar edited this page May 17, 2011 · 15 revisions

HOW-TO Install MOSTFIT

Installation Script

  • git://gist.github.com/915390.git
    You can install Mostfit using the above installation script or manually install Mostfit using the following instructions

Preliminaries

Purpose

Follow the steps to get MOSTFIT up and running

Credits

By Ravi Shankar and Krishnan Mani

Target environment

  • It should be possible to run MOSTFIT pretty much anywhere one can install Ruby and connect to a MySQL server. However, setting up MOSTFIT is easiest with Ubuntu, both 8.04 LTS (Hardy Heron) and 9.10 (Karmic Koala). This HOW-TO was created from installations on Ubuntu

Pre-requisites

  • MOSTFIT doesn’t need a great deal of memory or disk space. It should be possible to run it on any desktop or laptop with a decent amount of memory, even half a gig (total) should be enough

Supporting software

  1. Ruby 1.8.6+ (Ruby 1.9 is not currently supported)
  2. MySQL Server 5.0+
  3. Ruby gems package manager
  4. Git (to obtain the sources for MOSTFIT)

Resources

  1. Git repo is at: “git clone git://github.com/Mostfit/mostfit.git”
  2. Ruby gems package manager download (v1.3.6 at this time): http://rubyforge.org/frs/?group_id=126

TODO

  1. bin/rake db:create (perhaps it needs to connect as MySQL root user first in order to create the database?)
  2. mostfit/tasks/merb.thor/utils.rb may be missing “require ‘pathname’” (perhaps not an issue with later versions of ruby)
  3. Which one’s the definitive git repo for the latest source? What about stable releases?

Logical Steps to Setup MOSTFIT Server

  1. Install C compiler
  2. Install ruby
  3. Install MySQL, if not already available
  4. Install MySQL libraries for Ruby
  5. Install gem package manager and other Ruby stuff
  6. Install git, fetch the source code for MOSTFIT from github
  7. Create a database for MOSTFIT, and tell MOSTFIT how to find it
  8. Install the gems required by MOSTFIT
  9. Run MOSTFIT

The real deal!

  • Get some basic development goodies (including the C compiler)
sudo aptitude install build-essential
  • Get ruby
sudo aptitude install ruby
sudo aptitude install ruby1.8-dev
sudo aptitude install libopenssl-ruby
  • (Optional, if you already have MySQL) Install MySQL server
sudo aptitude install mysql-server
  • Some MySQL libraries
sudo apt-get install libmysql-ruby
sudo apt-get install libmysqlclient16-dev #libmysqlclient-dev on Debian

NOTE: On Ubuntu 8.04, i had to get libmysqlclient15-dev instead

  • Download and install gem
wget http://rubyforge.org/frs/download.php/69365/rubygems-1.3.6.tgz
tar xvf rubygems-1.3.6.tgz
cd rubygems-1.3.6
sudo ruby setup.rb
gem -v

NOTE: i found it best to install gem from source, `gem update —system` doesn’t always work with an older gem version that you might install using apt, for example

  • Some other Ruby essentials
sudo apt-get install rake
sudo apt-get install ri
  • Get the sources for MOSTFIT
sudo aptitude install git-core git
git clone git://github.com/Mostfit/mostfit.git
  • Setup the database and tell MOSTFIT how to find it
    • Create the database, setup the user and permissions
    • Verify you can connect as the user just created
    • Edit MOSTFIT’s database configuration to point to the database(change username and password in database.yml)
mysql -u root -p
mysql> create database mostfit;
mysql> grant all on mostfit.* to 'mostfit_user'@'localhost' identified by 'mostfit_pass';
mysql> flush privileges;
mysql> exit

mysql -u mostfit_user mostfit -p
mysql> show tables;
mysql> exit

cd mostfit/config/
cp database.example.yml database.yml
emacs database.yml

Hint: At least one space is needed between a key and its value, such as “host: localhost”

  • Get thor (not the God!)
sudo gem install thor -v 0.9.9
sudo gem install dm-observer -v 0.10.1
  • Let MOSTFIT install bundled gems

If you use RVM, do the following first to install all the gems in the current gemset:

cd mostfit/gems/cache
gem install --local *

then,

cd mostfit
bin/thor merb:gem:redeploy
bin/thor merb:gem:install
  • Install some other gems
sudo gem install uuid
sudo gem install pdf-writer
sudo gem install mongrel
sudo gem install log4r
gem install ruby-debug #for merb -D

*NOTE: From gem1.8 onwards, gem command does not work, alias it or use gem1.8 (or whatever version of gem you have) instead

  • Let MOSTFIT setup the database
cd mostfit
bin/rake db:autoupgrade

NOTE: Check your database for the tables and other data that should now be created.

  • Done! Run MOSTFIT
cd mostfit
bin/merb
  • Fire up your browser and navigate to the homepage for MOSTFIT: http://localhost:4000

NOTE: To Run Upload functionality on Local system. Need to install following gems

  1. sudo gem install nokogiri -v 1.4.2
  2. sudo gem install google-spreadsheet-ruby -v 0.1.1
    Once you complete with this
    create a folder named uploads in the public directory of MOSTFIT……..
    DONE! You can upload excel file
Clone this wiki locally