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.
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:
Leave your response!