Copyright © tutorialspoint.com
To develop a web application using Ruby on Rails Framework, install the following software:
We assume that you already have installed a Web Server and Database System on your computer. You can always use the WEBrick Web Server, which comes with Ruby. Most sites, however, use Apache or lightTPD in production.
Rails works with many database systems, including MySQL,PostgreSQL, SQLite, Oracle, DB2 and SQL Server. Please refer to a corresponding Database System Setup manual to setup your database.
Let's look at the installation instructions for Rails on Windows, Mac OS X, and Linux.
C:\> gem install rails --include-dependencies |
NOTE: Above command may take some time to install all dependencies. Make sure you are connected to the internet while installing gems dependencies.
Congratulations! You are now on Rails over Windows.
tp> tar xzf rubygems-x.y.z.tar.gz tp> cd rubygems-x.y.z rubygems-x.y.z> sudo ruby setup.rb |
tp> sudo gem install rails --include-dependencies |
NOTE: Above command may take some time to install all dependencies. Make sure you are connected to the internet while installing gems dependencies.
Congratulations! You are now on Rails over Mac OS X.
tp> tar -xzf ruby-x.y.z.tar.gz tp> cd ruby-x.y.z ruby-x.y.z> ./configure ruby-x.y.z> make ruby-x.y.z> make test ruby-x.y.z> make install |
tp> tar -xzf rubygems-0.8.10.tar.gz tp> cd rubygems-0.8.10 rubygems-0.8.10> ruby setup.rb |
tp> gem install rails --include-dependencies |
NOTE: Above command may take some time to install all dependencies. Make sure you are connected to the internet while installing gems dependencies.
Congratulations! You are now on Rails over Linux.
Assuming you installed Rails using RubyGems, keeping up-to-date is relatively easy. Issue the following command:
tp> gem update rails |
This will automatically update your Rails installation. The next time you restart your application it will pick up this latest version of Rails. While giving this command, make sure you are connected to the internet.
You can verify if everything is setup according to your requirements or not. Use the following command to create a demo project.
tp> rails demo |
This will generate a demo rail project, we will discuss about it later. Currently we have to check if environment is setup or not. Now next use the following command to run WEBrick web server on your machine.
tp> cd demo tp> ruby script/server => Rails application started on http://0.0.0.0:3000 => Ctrl-C to shutdown server; call with --help for options [2007-02-26 09:16:43] INFO WEBrick 1.3.1 [2007-02-26 09:16:43] INFO ruby 1.8.2 (2004-08-24)... [2007-02-26 09:16:43] INFO WEBrick::HTTPServer-start:pid=2836... .... |
Now open your browser and type the following address text box.
http://localhost:3000 |
If everything is fine then you should have a message something like "Welcome aboard" or "Congratulations".
Copyright © tutorialspoint.com