• download the ruby source, then unzip, untar, configure and install
[root@railstestwebmin ~]#wget http://ftp.ruby-lang.org/pub/ruby/1.9/ruby-1.9.3-p194.tar.bz2
[root@railstestwebmin ~]#tar xjvf ruby-1.9.3-p194.tar.bz2
[root@railstestwebmin ~]#cd ruby-1.9.3-p194
[root@railstestwebmin ruby-1.9.3-p194]#./configure
[root@railstestwebmin ruby-1.9.3-p194]#make
[root@railstestwebmin ruby-1.9.3-p194]#make install
• check the ruby version
[root@railstestwebmin ~]#ruby -v
• download ruby gems and install
[root@railstestwebmin ~]#wget http://rubyforge.org/frs/download.php/76073/rubygems-1.8.24.tgz
[root@railstestwebmin ~]#tar xzvf rubygems-1.8.24.tgz
[root@railstestwebmin ~]#cd rubygems-1.8.24
[root@railstestwebmin rubygems-1.8.24]#ruby setup.rb
• installing Rails by using ruby gems (gem is a package manager)
[root@railstestwebmin ~]#gem install rails –include-dependencies
• creating an application
[root@railstestwebmin ~]#rails new prv —for creating prv application and rails is a binary command
inside this application root scripts folder, check the database.yml file for which database this application is using.
• running the application
[root@railstestwebmin prv]#rails server
inside that app directory run rails server command, it may give some error like, in this case i got sqlite3 is not found.
sqlite3 database it used by the app and it is not installed so, we need to install sqlite2.
[root@railstestwebmin prv]#yum install sqlite-devel
After, while running the app I got the error like
—-
“/usr/lib/ruby/gems/1.8/gems/execjs-1.4.0/lib/execjs/runtimes.rb:51:in `autodetect’: Could not find a JavaScript runtime. See https://github.com/sstephenson/execjs for a list of available runtimes. (ExecJS::RuntimeUnavailable)”
—
so we ve to install java script runner ie add a gem in Gemfile of that app
like gem ‘therubyracer’ or gem ‘execJS’ , here therubyracer and execJS are supports the java scripts.
after adding javascript gem in Gemfile
do bundle install it ll read the Gemfile and installs all gems which are mentioned in that file,
then run “rails server” in that app root ,
[root@railstestwebmin prv]#rails server
=> Booting WEBrick
=> Rails 3.1.0 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2012-09-07 17:09:45] INFO WEBrick 1.3.1
[2012-09-07 17:09:45] INFO ruby 1.8.7 (2010-06-23) [i386-linux]
[2012-09-07 17:09:45] INFO WEBrick::HTTPServer#start: pid=3049 port=3000
Go to the browser and You can see the Rails welcom page
http://<server ip/localhost>:3000
Get in touch with us.
Subscribe For Latest Updates
Related Posts