Wednesday, June 23, 2010

Installing Ruby On Rails on Debian/Ubuntu



After some experience in developing RubyOnRails applications in windows, i came to know that the best environment for rails development is Linux. So i choose to have the Debian version Ubuntu 10.04. 
Today i'm going to show you guys how to install Ruby on Rails in Ubuntu 10.04. This can be applied to lower versions also. 

Get Ruby

$ sudo apt-get install ruby-full build-essential
Note that ruby-full will install emacs and a slew of other non-essential packages. 
You can install all the necessary packages with this command:   
$ sudo aptitude install ruby build-essential libopenssl-ruby ruby1.8-dev 
To test the installation, type this command in console: 
$ ruby -v 
It will show up something like this: 
ruby 1.8.7 (2010-01-10 patchlevel 249) [i486-linux] 

Install RubyGems 

 To install the Ruby Gems type the following commands in Termainal 

$ sudo apt-get install rubygems

Install Rails
Type the following commands...
$ sudo gem install rails
TO check the installation type 
rails -v
It will give the installed version number.
Rails 2.3.5.

Install MySQL DB server (optional)

By default, Rails includes the sqlite3 gem and is automatically configured to use it. To use MySQL instead, follow the following steps:
$ sudo apt-get install mysql-server mysql-client
$ sudo apt-get install libmysql-ruby libmysqlclient-dev
$ sudo gem install mysql

Test your Rails installation

To test your Rails installation, generate a new Rails project:
$ rails myrailsapp
If you are using MySQL, use the following command:
$ rails myrailsapp -d mysql

No comments:

Post a Comment