Kmaiti

  • Subscribe to our RSS feed.
  • Twitter
  • StumbleUpon
  • Reddit
  • Facebook
  • Digg

Thursday, 29 April 2010

What is Ruby on Rails? Install on linux plat form

Posted on 16:50 by Unknown
What is Ruby on Rails?

Ruby is a programming language just like Perl, Python or PHP. Rails is an open source Ruby framework for developing database-backed web applications. You could develop a web application at least ten times faster with Rails than you could with a typical Java framework. It is a web application framework written in the Ruby programming language.



We tried the installation of Ruby on Rails on a server with this configuration:

1. Red Hat Linux release 7.3

2. Plesk 5.0.5

3. Apache 1.3.27

4. PHP 4.3.4 # Run as an Apache Module

Install Ruby

Before installing Ruby, first check if zlib is installed in PHP. You can do this by running a simple script with this code.



Now you are all set to start the installation.

cd /usr/local/src

wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz

tar xvzf ruby-1.8.2.tar.gz

cd ruby-1.8.2

./configure

make

make install

ruby rubytest.rb

If the installaiton is successful, then you will get a message “test succeeded”.

Install RubyGems

cd /usr/local/src

wget http://rubyforge.org/frs/download.php/5207/rubygems-0.8.11.tgz

tar xvzf rubygems-0.8.11.tgz

cd rubygems-0.8.11

ruby setup.rb all

This step involves execution of `ruby setup.rb` with arguments `config / setup / install` all together

gem query --local

OR

gem q -L

Listing all installed gems

Install Rails

gem install rails OR # (Enter Y for all dependencies)

gem install rails --include-dependencies

Install FastCGI

wget http://fastcgi.com/dist/fcgi-2.4.0.tar.gz

tar -xvzf fcgi-2.4.0.tar.gz

cd fcgi-2.4.0

./configure

make

make install

Install mod_fastcgi

wget http://www.fastcgi.com/dist/mod_fastcgi-2.4.2.tar.gz

tar -xvzf mod_fastcgi-2.4.2.tar.gz

cd mod_fastcgi-2.4.2

/path/to/apxs -o mod_fastcgi.so -c *.c

/path/to/apxs -i -a -n fastcgi mod_fastcgi.so

In Apache’s httpd.conf, add this line.

Include /path/to/httpd/conf/fastcgi.conf

Now, add this text to fastcgi.conf

cat > /path/to/httpd/conf/fastcgi.conf

User apache

Group apache



FastCgiConfig -idle-timeout 900

AddHandler fastcgi-script .fcgi .fpl .rb

FastCgiIpcDir /tmp/fastcgi_ipc/

FastCgiSuexec /usr/sbin/suexec

To make FastCGI run as suexec. Use path to suexec





Ctrl + D

mkdir /tmp/fastcgi_ipc/

chown -R apache.apache /tmp/fastcgi_ipc

chmod 700 /tmp/fastcgi_ipc/

service httpd restart

NOTE : In some systems, the ownership of fastcgi_ipc is done by Apache itself, but its safe to include these steps in your routine.

Related files: /usr/local/lib/ruby/gems/1.8/gems/rails-1.0.0/dispatches/dispatch.fcgi # OR ~USER//public/dispatch.fcgi # Log file declaration & all

Install gem bindings

To install gem bindings for Fastcgi and MySQL

gem install fcgi

gem install mysql

Testing

1. Install Test Application

cd ~USER

rails testapp # Create a test application named 'testapp'

cd testapp/

./script/generate controller test

cd ~USER/httpdocs

ln -s ~USER/testapp/public rails

# In order to access the test application

'~USER/testapp/public' from the browser

In order to allow symlinks, enter the following in to ~USER/httpdocs/.htaccess

Options Indexes +FollowSymLinks

Now you need to set the correct ownership and permissions for the test application. I did the following for my project. You can learn from the example:

cd ~USER

chown -R USER.psacln testapp

chmod -R 755 testapp

chown -R USER.psacln httpdocs/rails

chmod -R 755 httpdocs/rails

Create Test Pages

cd ~USER

cd ~USER/testapp/app/controllers

Create a file called test_controller.rb and put in the following code:

cat > test_controller.rb

class TestController < ApplicationController

def hi

render :text => 'Hi world'

end

def hello

end

def index

render :text => 'Hi! This is the Index.'

end

end

Ctrl + D

Now create the test page.

cat > ~USER/testapp/app/views/test/hello.rhtml # The test page





Hello World





Hello from Rails!



The current time is <%= Time.now %>





Email ThisBlogThis!Share to XShare to FacebookShare to Pinterest
Posted in | No comments
Newer Post Older Post Home

0 comments:

Post a Comment

Subscribe to: Post Comments (Atom)

Popular Posts

  • unable connect to socket: No route to host (113)
    Guys, This error message usually comes when you try to access remote linux desktop using vncviewer. Please check the firewall in the linux s...
  • NDMP communication failure error
    Guys, Issue : Netbackup server sends alert NDMP communication failure once everyday. But there is no issue to run scheduled backup jobs. Env...
  • what does it mean by "cman expected_votes="1" two_node="1" in cluster.conf ?
    For two node clusters ordinarily, the loss of quorum after one out of two nodes fails will prevent the remaining node from continuing (if bo...
  • How to verify UDP packet communication between two linux system?
    Guys, Today, I had to check UDP packet communication between linux and a windows system. Main purpose of the windows system was to capturing...
  • How to make bridge over VLAN?
    How to make bridge over VLAN? Bridging over VLAN's : By constructing a bridge between a "normal" and a "VLAN" ethern...
  • How to install pdo_mysql module with php on 64 bit linux machine?
    Guys, The PHP Data Objects (PDO) extension defines a lightweight, consistent interface for accessing databases in PHP. Each database driver ...
  • configure: error: C preprocessor "/lib/cpp" fails sanity check + Resolved
    Guys, I got that error messages when I was going to configure any software on the linux server. I was unable to execute easyapache or ./conf...
  • How to redirect output of script to a file(Need to save log in a file and file should be menioned in the script itself?
    Expectation : @subject Steps : 1. Create a bash script. 2. add line : exec > >(tee /var/log/my_logfile.txt) That's it. All output ...
  • configure: error: could not find library containing RSA_new
    Guys, It seems you have enabled the SSL option during configuring the package. Please either resolve that dependency or disable the SSL opti...
  • Cannot find config.m4 + phpize +Resolved
    Guys, I got the same error messages and sorted out it. Here is the error that I got. ===== root@server [/home/cpeasyapache/src/php-5.2.9/ext...

Categories

  • ACL
  • ESX
  • Linux
  • Storage
  • UCS

Blog Archive

  • ►  2013 (5)
    • ►  May (1)
    • ►  April (3)
    • ►  February (1)
  • ►  2012 (10)
    • ►  July (1)
    • ►  June (1)
    • ►  April (1)
    • ►  March (3)
    • ►  February (3)
    • ►  January (1)
  • ►  2011 (86)
    • ►  December (3)
    • ►  November (2)
    • ►  September (19)
    • ►  August (9)
    • ►  July (5)
    • ►  June (9)
    • ►  May (12)
    • ►  April (3)
    • ►  March (4)
    • ►  February (5)
    • ►  January (15)
  • ▼  2010 (152)
    • ►  December (9)
    • ►  November (34)
    • ►  October (20)
    • ►  September (14)
    • ►  August (24)
    • ►  July (19)
    • ►  June (3)
    • ►  May (25)
    • ▼  April (3)
      • Install xen virtual server on linux platform
      • What is Ruby on Rails? Install on linux plat form
      • Various linux commands
    • ►  January (1)
Powered by Blogger.