Steps to install Ruby on Rails
1) Setting up the Rails development environment
Ruby, rubygems, rails and other required packages can be installed by :
- sudo apt-get install build-essential
- $ sudo apt-get install ruby-full
- $ cd Downloads
- $ wget https://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
- $ tar xzvf rubygems-1.8.24.tgz
- $ sudo mv rubygems-1.8.24 /usr/local/src
- $ cd
- $ cd /usr/local/src
- $ cd rubygems-1.8.24
- $ sudo ruby setup.rb
- $ sudo update-alternatives –install /usr/bin/gem gem /usr/bin/gem1.8 1
If you got error in this step (ERROR: update-alterntives:error: unknown argument ‘–install’), then retype ‘–‘ (Two Hyphens) before install
- $ sudo gem install rails
2) Setting up MySQL Database
If you have already installed Mysql then ignore this step.
$ sudo apt-get install mysql-server
Well you have now install Ruby on Rails ,Now its time to test it. So Create a Rails’s application .Here name of Rails application is new ,you can give your own name.
Go to place where you want to create Ruby on Rails application and run these commands in terminal :
$ rails new
$ cd new
$ rails server
The rails server command launches a small web server named WEBrick which comes bundled with Ruby. You’ll use this any time you want to view your work through a web browser.
This command will give you the following output in terminal
=> Booting WEBrick => Rails 3.0.0 application starting in development on https://0.0.0.0:3000 => Call with -d to detach => Ctrl-C to shutdown server [2010-04-18 03:20:33] INFO WEBrick 1.3.1 [2010-04-18 03:20:33] INFO ruby 1.8.7 (2010-01-10) [x86_64-linux] [2010-04-18 03:20:33] INFO WEBrick::HTTPServer#start: pid=26086 port=3000
With just three commands we whipped up a Rails server listening on port 3000. Go to your browser and open https://localhost:3000, you will see a basic rails app running.
Congratulations ,You are now running Ruby on Rails.
If you want to stop server then Press Ctrl+C in terminal