Home » Technology

How To Install Ruby On Rails Server On Ubuntu

17 July 2010 48 views No Comment Print This Post Print This Post Save Post As PdfDownload As PDF
            

The other day I wanted to setup ruby on rails server on Ubuntu for some experimentation. After some trial and error and a few google searches – I was able to get the server running on Ubuntu. Following are the steps that worked for me on Ubuntu 10.04

Step 1 – Install ruby

Ruby is the object oriented language based on which the web framework called rails has been built.


sudo apt-get install ruby-full build-essential

Step 2 – Check ruby installation


ruby -v
ruby -ropenssl -rzlib -rreadline -e "puts :Hello"

Example output of above two commands is as given below.


$ ruby -v
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux]
$ ruby -ropenssl -rzlib -rreadline -e "puts :Hello"
Hello
$

Step 3 – Install Gems

Gems is a kind of package manager for Ruby.


sudo apt-get install rubygems

Step 4 – Install Rails


sudo apt-get install rails

Step 5 – Install Sqlite3

Rails is pre-configured to use sqlite3. However, you need to download and install it.


sudo apt-get install sqlite3

Step 6 – Create sample application


rails myrailsapp

This creates a folder myrailsapp in the directory from where it is run.

Step 7 – Run the Ruby on Rails server


cd myrailsapp/
ruby script/server

Example output of this command is as given below


ruby script/server
=> Booting WEBrick...
=> Rails 2.2.3 application started on http://127.0.0.1:3000
=> Ctrl-C to shutdown server; call with --help for options
[2010-07-16 19:56:59] INFO  WEBrick 1.3.1
[2010-07-16 19:56:59] INFO  ruby 1.8.7 (2010-01-10) [i486-linux]
[2010-07-16 19:56:59] INFO  WEBrick::HTTPServer#start: pid=13936 port=3000

Step 8 – Validate Server installation by accessing through web browser

Open the web browser and access the URL http://localhost:3000/. If everything is installed fine, you should get a page opened with content similar to snapshot given below.

Ruby on Rails Ubuntu

If you are interested in some further information on the individual steps and their meaning, you may refer to the Rails installation on Linux Wiki, from which I derived most of the above steps.

If you found this post useful, do share it with your friends. You can also submit to us any tools/web services/tips that help improve productivity.

Enter your email address to receive regular updates:

Related posts:

  1. How To Install a Wordpress Blog on Windows PC
  2. ActionController Invalid Authenticity Token Solution For Using Ajax On Rails
  3. How To Display CSS/HTML/PHP/Ruby Code Snippets Inside Wordpress Post
  4. WordPress 3.0.1 One Click Install Available On Dreamhost
  5. How to Identify Font Used In Text Of A Website

Inficone

Leave your response!

Add your comment below

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Spam Protection by WP-SpamFree

Follow On Twitter
Follow On Facebook
Follow Using RSS
Follow Using Email
Tweet This Post
Share Post On Facebook
Digg This Post
Add To Delicious
Stumble Upon