Q: How to make your CentOS 5.8 compatibale with Ruby on Rails development environment and resolve libyaml error?

Answer: Exactly 3 months back I was new to Ruby on Rails but thanks to the documentation of ruby on rails and Head First guide which act like a mentor to me in understanding this wonderful framework.

So lets first focus on how to make our server compatible for ruby on rails development.

Follow the simple steps:

Point to remember always $yum update before installation
 If you are admin/root create a new user in your server as: 
1. useradd -m vidur -u 211 -g root -s /bin/bash -d /home/vidur
if Bug / Error :
 bash: adduser: command not found
solution: export PATH=/usr/sbin:PATH

change its password
2. passwd vidur

3. relogin as vidur

4. download Ruby  http://rubyonrails.org/download

Become admin again from vidur terminal
5. su  

6. mv ruby-1.9.3-p0 /opt/

Inside ruby-1.9.3-p0 directory
7. ./configure

8. make

9. make install

check if ruby is successfully installed ?
10. check ruby -v

11. gem update --system

12. gem install rubygems-update

Bug/Error Report:
It seems your ruby installation is missing psych (for YAML output).
To eliminate this warning, please install libyaml and reinstall your ruby.

Solution :
13. Reference: http://collectiveidea.com/blog/archives/2011/10/31/install-ruby-193-with-libyaml-on-centos/
    $ wget http://pyyaml.org/download/libyaml/yaml-0.1.4.tar.gz
    $ tar xzvf yaml-0.1.4.tar.gz
    $ cd yaml-0.1.4
    $ ./configure --prefix=/usr/local
    $ make
      $ make install
 Now reinstall the ruby
  $ wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p0.tar.gz
    $ tar xzvf ruby-1.9.3-p0.tar.gz
    $ cd ruby-1.9.3-p0
    $ ./configure --prefix=/usr/local --enable-shared --disable-install-doc --with-opt-dir=/usr/local/lib
    $ make
    $ make install

14. check gem --version

For IDE RubyMine
15. Donwload JDK 64 tar bit http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html

16. mv /home/vidur/Desktop/java /opt/

17. vim ~/.bashrc 

18. Both in su and vidur bashrc file
       export PATH=/opt/jdk1.7.0_07/bin:$PATH
       export JAVA_HOME=/opt/jdk1.7.0_07 

19. Download Rubymine from http://www.jetbrains.com/ruby/download/download_thanks.jsp?os=linux

20. mv RubyMine-4.5.4.tar.gz /opt/

21. gunzip RubyMine-4.5.4.tar.gz 

22. tar -xvf RubyMine-4.5.4.tar 

23. In bashrc of su and vidur
     export PATH=/opt/RubyMine-4.5.4/bin:$PATH

24. rubymine.sh   

25. sudo yum install mysql-server mysql mysql-devel

26. gem install passenger

creating new rails application
27. rails new myapp -d mysql

26. cd myapp

28. passenger start 

Now we have RubyMine as the development environment , mysql as database, Server Passenger & rails framework.
Happy coding




Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s