Skip to main content

Rails 1.2.1 with Ruby 1.8.x installation tips


ROR Setup (Ruby 1.8.6 , patch level 111, rails 1.2.1, CentOs 6.2 62 bit, Postgres 8.3)
Make sure rpmforge included in your yum.repo ‘s, you can make it is available through
cd /tmp/
rpm -K rpmforge-release-0.5.2-2.el6.rf.*.rpm
rpm -i rpmforge-release-0.5.2-2.el6.rf.*.rpm
Download and install ruby 1.8.6

cd /tm/

wget ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.6-p111.tar.bz2
tar jxf ruby-1.8.6-p111.tar.bz2 
cd ruby-1.8.6-p111

./configure
make
Note: If you found any error like
make
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c array.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c bignum.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c class.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c compar.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c dir.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c dln.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c enum.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c error.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c eval.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c file.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c gc.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c hash.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c inits.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c io.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c marshal.c
gcc -g -O2  -DRUBY_EXPORT -D_GNU_SOURCE=1  -I. -I.  -c math.c
math.c:37:13: error: missing binary operator before token "("
make: *** [math.o] Error 1
Just open math.c [Don’t locate any where just use vi math.c from the same same location where you are executing the command ‘make’]
And look at the line
“#elif define(ERANGE)” it should be “#elif defined(ERANGE)”
Note: not “define”, it is “defined” => d is missing in this phrase
Modify it and again run the same command “make”
Make install
Gem installation
============
cd rubygems-1.3.2
ruby setup.rb
Rails installation
============
gem install rails -v 1.2.1
it will installs the following
Successfully installed rake-0.9.2.2
Successfully installed activesupport-1.4.0
Successfully installed activerecord-1.15.1
Successfully installed actionpack-1.13.1
Successfully installed actionmailer-1.3.1
Successfully installed actionwebservice-1.2.1
Successfully installed rails-1.2.1
7 gems installed
Installing ri documentation for activesupport-1.4.0...
Installing ri documentation for activerecord-1.15.1...
Installing ri documentation for actionpack-1.13.1...
Installing ri documentation for actionmailer-1.3.1...
Installing ri documentation for actionwebservice-1.2.1...
Installing RDoc documentation for activesupport-1.4.0...
Installing RDoc documentation for activerecord-1.15.1...
Installing RDoc documentation for actionpack-1.13.1...
Installing RDoc documentation for actionmailer-1.3.1...
Installing RDoc documentation for actionwebservice-1.2.1...
Postgresql Install
=============
cd postgresql-8.1.4
./configure

If you found any error like: "readline library not found" then just try to install devel for readline.

yum install readline-devel

then do the configure again using

./configure
make
make install
.~/.bash_login or restart
env ARCHFLAGS='-arch i386' gem install \postgres -- --with-pgsql-dir=/usr/local/pgsql 
Note: We need the postgres gem version 0.7.9.2008.01.28
or
env ARCHFLAGS='-arch i386'
gem install postgres-0.7.9.2008.01.28.gem -- --with-pgsql-dir=/usr/local/pgsql
mkdir /usr/local/pgsql/data
chown postgres:postgres /usr/local/pgsql/data
ls -ld /usr/local/pgsql/data
su postgres
cd /tmp
/usr/local/pgsql/bin/postmaster -D /usr/local/pgsql/data >logfile 2>&1 &
createdb omie_dev => if needed
pg_dump omie_dev < omie_dev_backup.sql
psql omie_dev
PDF Writer
========
gem install color-tools
gem install hoe -v 2.6.1
gem install transaction-simple
gem install pdf-writer-1.1.3.gem 
ImageMagick 
==========
yum install ImageMagick-devel
clear
[ `grep /usr/local/lib /etc/ld.so.conf | wc -l` -eq 0 ] && echo "/usr/local/lib" >> /etc/ld.so.conf
ldconfig
gem install rmagick -r --no-ri --no-rdoc
Lighttpd installation
=============
yum install lighttpd lighttpd-devel mod-lighttpd
/usr/sbin/lighttpd -v
yum install pcre-devel
yum install mod_fastcgi
yum install lighttpd-fastcgi
fcgi installation
===========
yum install fcgi
if it is not work then use the source [you need to download the fcgi with exact version]
cd fcgi-2.4.0
ls /usr/local/fcgi
mkdir /usr/local/fcgi
./configure --prefix=/usr/local/fcgi --exec-prefix=/usr/local/fcgi
make
If you found any error like: 
make[2]: *** [fcgio.lo] Error 1
make[2]: Leaving directory `/somepath/fcgi-2.4.0/libfcgi'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/somepath/fcgi-2.4.0'
make: *** [all] Error 2
just go include/fcgio.h and add the code “#include <stdio.h>” after 
“#include <iostream>”
gem install fcgi -r -- --with-fcgi-lib=/usr/local/fcgi/lib --with-fcgi-include=/usr/local/fcgi/include
Follow the openssl things at:
http://kannannadarajan.blogspot.in/2012/03/lighttpd-with-fastcgi-for-ror-121.html

install pdfkit and wkhtmltopdf
gem install pdfkit -v 0.5.0
gem install wkhtmltopdf -v 0.1.2
gem install wkhtmltopdf-binary
Make sure the following gem list is installed properly with the specific version
actionmailer (1.3.1)
actionpack (1.13.1)
actionwebservice (1.2.1)
activerecord (1.15.1)
activesupport (1.4.0)
color (1.4.1)
color-tools (1.3.0)
docsplit (0.5.0)
fcgi (0.8.8)
hoe (2.6.1)
json_pure (1.6.6)
mime-types (1.16)
parseexcel (0.5.2)
payment (1.0.1)
pdf-writer (1.1.3)
pdfkit (0.5.0)
polyglot (0.3.2)
postgres (0.7.9.2008.01.28)
rails (1.2.1)
rake (0.9.2.2)
rmagick (2.13.1)
roo (1.9.3)
ruby-ole (1.2.11.1)
rubyforge (2.0.4)
spreadsheet (0.6.5.4)
transaction-simple (1.4.0)
treetop (1.4.10)
wkhtmltopdf (0.1.2)
wkhtmltopdf-binary (0.9.5.3)
If your wkhtmltopdf is not working then use the following:
tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2
mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf
chmod +x /usr/local/bin/wkhtmltopdf
service iptables stop
pkill -9 ruby
pkill -9 lighttpd
/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd-omie-dev-ssl.conf/usr/sbin/lighttpd -f /etc/lighttpd/lighttpd-omie-dev.conf
su postgres
cd /tmp//usr/local/pgsql/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

Comments

Popular posts from this blog

Errno::ENOENT: No such file or directory

HTML to PDF conversion is very easy in rails and pdfkit will be useful in this case, wkhtmltopdf tool will be supporting tool so you can easily convert an html to pdf.  In my experience I used the following steps: gem install pdfkit -v 0.5.0 gem install wkhtmltopdf -v 0.1.2 gem install wkhtmltopdf-binary Some times this sequence will not work, so I use the following as per the instruction from  https://github.com/pdfkit/pdfkit/wiki/Installing-WKHTMLTOPDF Be careful to download the appropriate wkhtmltopdf tar ball, it depends on your os architecture, like i386 or 64 wget http://wkhtmltopdf.googlecode.com/files/wkhtmltopdf-0.9.9-static-amd64.tar.bz2 tar xvjf wkhtmltopdf-0.9.9-static-amd64.tar.bz2 mv wkhtmltopdf-amd64 /usr/local/bin/wkhtmltopdf chmod +x /usr/local/bin/wkhtmltopdf Try to convert html to pdf after restarting your web servers.  If you get any error like: Errno::ENOENT: No such file or directory then I have a straightforward method and