How To Install Ruby On Rails Server On Ubuntu

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 ubuntu How To Install Ruby On Rails Server On 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.






Related posts:

  1. Rails – Private Method `gsub!’ called for – Solution
  2. How To Install a WordPress Blog on Windows PC
  3. Get Ubuntu On Windows XP/Vista/7 Using Wubi
  4. ActionController Invalid Authenticity Token Solution For Using Ajax On Rails
  5. Get WordPress On Cloud Using Kodingen

Inficone runs on the Genesis Framework

Genesis Framework
Genesis empowers you to quickly and easily build incredible websites with WordPress. Whether you're a novice or advanced developer, Genesis provides the secure and search-engine-optimized foundation that takes WordPress to places you never thought it could go. It's that simple - start using Genesis now!
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

Comments

  1. Andy says:

    I tried to run ruby on my Debian server but I failed to access the WEBrick server from another PCs rather than localhost.

    Do you have the same situation? Please help. Thank you.

  2. Shivam Vaid says:

    @Andy Sorry to disappoint you – When I ran RoR, I only accessed it from localhost and not externally – so really cannot comment whether it was working or not.

  3. Andy says:

    I put RoR on a server with only console interface, so I cannot only use localhost web server. I tried to google this problem but haven’t succeeded yet.

  4. johan says:

    I trying installing the new version with RVM, may be this helping for all http://minimalbugs.com/questions/install-rails-3-0-3-in-ubuntu-with-help-of-rvm

Speak Your Mind

*

Spam Protection by WP-SpamFree