Adam
05-20-2005, 10:12 AM
http://enterprise.myriadnetwork.com/%7Emyriad/htimg/rails_logo.gif
Welcome!
This tutorial is going to go a bit in depth on how one would get Ruby on Rails up and running properly.
To best summarize what Rails is, I am going to extract a quote straight from there website.
Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups
For those of you that are wondering what ruby has to do with rails, please refer to the quote below.
Ruby is a pure object-oriented programming language with a super clean syntax that makes programming elegant and fun.
Now that we know what these two are made for we can get ahead with the install and implementation of both of them.
First thing that we will need to do is go ahead and download the Ruby application. This is basically the platform that Rails will run off of.
Currently if you are planning on using version 0.10 or later of Rails then you will need to download Ruby v1.8.2 or newer.
To do this you will need to issue the following command within your SSH window.
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz
Once the package has downloaded you will need to extract it using tarzxvf ruby-1.8.2.tar.gz. The files will now be extracted into a directory called
ruby-1.8.2. You will now need to change to that directory.
The next step in getting Ruby running would be to configure it. To do this one would need to run ./configure while being in the ruby-1.8.2 directory.
This takes about one minute to complete. If it has complete without any errors then it is now time to move on.
We will now need to make the application by running the 'make' command in the current directory. This can take anywhere from 1-5 minutes to
complete. If this has completed properly then you will see something that says "Test Succeeded", we have included a screen capture below of what should be seen.
http://enterprise.myriadnetwork.com/%7Emyriad/htimg/ror1.png
Now it is time to get the application installed, you will need to run 'make install' to do so. This process is quite fast and should finish without error.
Once that has been completed, we can move on to getting Rails installed.
Rails uses extensions called "Gems". These are easily installed via command line but need a program called RubyGems before this can be done.
You will need to run the following commands to get RubyGems installed so that we can get Rails installed on the machine.
First we need to download RubyGems using the following command.
wget http://rubyforge.org/frs/download.php/3700/rubygems-0.8.10.tgz
Next we need to change to the RubyGems directory:
cd rubygems-0.8.10
Now we will need to setup RubyGems, we will do this using the following command:
ruby setup.rb
You should see the following screen stating that it has installed properly.
http://enterprise.myriadnetwork.com/%7Emyriad/htimg/ror2.png
Now it is finally time to move on and get Rails installed. We will be doing this via the RubyGems application that we just installed, but first we need to update by running:
gem update
This will update any of the gem source that is currently installed. Once the update has been completed we can go ahead and install Rails. This is done simply via Gem by running:
gem install rails
When you are installing Rails you may be prompted to install a few dependencies that are needed as well, I would highly suggest choosing the Y option and installing these dependencies to avoid any problems down the line when you are ready to use these applications.
Below I have included a screen capture of what the install looked like for me.
http://enterprise.myriadnetwork.com/%7Emyriad/htimg/ror3.png
Now you are ready to create your application. This is done rather simply through Rails using one command.
You need to make sure that the directory that you are using is accessible via the Webserver that you are using, normally it would be best to use a directory in your /home tree for this but my example will be with a different directory.
To get this setup in my directory I simply ran:
rails /var/www/html/myapp
Now that you have this properly setup you will need to have your Webserver point to the folder named 'public' by default when your webpage is visited.
Below I have included a sample httpd.conf DocumentRoot entry that can be used.
Please Note: In order for this to run properly, mod_rewrite is going to need to be installed.
<VirtualHost *:80>
ServerName rails
DocumentRoot /path/application/public/
ErrorLog /path/application/log/apache.log
<Directory /path/application/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This installed all of the needed files in my directory.
You have now successfully installed Ruby on Rails. Now that this is done there is alot more that you can do with this application, there is various different resources around the internet that more information can be found on but I am going to go ahead and provide you with the links that I feel are most important.
FastCGI
I would suggest setting up FastCGI, this is used to speed up your applications and is integrated into Apache once you install it. More information regarding that can be found here. http://wiki.rubyonrails.com/rails/show/FastCGI
How-To's
The Ruby on Rails website is also full of How-To's for various things to do with this application. For anyone using this application I would highly suggest visiting the page below
http://wiki.rubyonrails.com/rails/show/Howtos
FastCGI Implementation & Apache HTTPD Implementation
Below is an excellent URL thast will show how to implement FCGI with Apache.
http://wiki.rubyonrails.com/rails/show/Fast+CGI+and+Apache2+for+Red+Hat+Linux+9
If you have not noticed all of the URL's I have provided you are from one page, this page has a vast array of documentation and should be looked at by anyone interested in using Ruby on Rails.
http://wiki.rubyonrails.com
Please note, the ROR logo is not property of Myriad Network and is only being used in this tutorial.
If you have any questions, please feel free to let us know, we would be glad to help you out.
Fast-track your Web apps with Ruby on Rails http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/?ca=dgr-lnxw06RubyRails
Welcome!
This tutorial is going to go a bit in depth on how one would get Ruby on Rails up and running properly.
To best summarize what Rails is, I am going to extract a quote straight from there website.
Rails is a full-stack, open-source web framework in Ruby for writing real-world applications with joy and less code than most frameworks spend doing XML sit-ups
For those of you that are wondering what ruby has to do with rails, please refer to the quote below.
Ruby is a pure object-oriented programming language with a super clean syntax that makes programming elegant and fun.
Now that we know what these two are made for we can get ahead with the install and implementation of both of them.
First thing that we will need to do is go ahead and download the Ruby application. This is basically the platform that Rails will run off of.
Currently if you are planning on using version 0.10 or later of Rails then you will need to download Ruby v1.8.2 or newer.
To do this you will need to issue the following command within your SSH window.
wget ftp://ftp.ruby-lang.org/pub/ruby/ruby-1.8.2.tar.gz
Once the package has downloaded you will need to extract it using tarzxvf ruby-1.8.2.tar.gz. The files will now be extracted into a directory called
ruby-1.8.2. You will now need to change to that directory.
The next step in getting Ruby running would be to configure it. To do this one would need to run ./configure while being in the ruby-1.8.2 directory.
This takes about one minute to complete. If it has complete without any errors then it is now time to move on.
We will now need to make the application by running the 'make' command in the current directory. This can take anywhere from 1-5 minutes to
complete. If this has completed properly then you will see something that says "Test Succeeded", we have included a screen capture below of what should be seen.
http://enterprise.myriadnetwork.com/%7Emyriad/htimg/ror1.png
Now it is time to get the application installed, you will need to run 'make install' to do so. This process is quite fast and should finish without error.
Once that has been completed, we can move on to getting Rails installed.
Rails uses extensions called "Gems". These are easily installed via command line but need a program called RubyGems before this can be done.
You will need to run the following commands to get RubyGems installed so that we can get Rails installed on the machine.
First we need to download RubyGems using the following command.
wget http://rubyforge.org/frs/download.php/3700/rubygems-0.8.10.tgz
Next we need to change to the RubyGems directory:
cd rubygems-0.8.10
Now we will need to setup RubyGems, we will do this using the following command:
ruby setup.rb
You should see the following screen stating that it has installed properly.
http://enterprise.myriadnetwork.com/%7Emyriad/htimg/ror2.png
Now it is finally time to move on and get Rails installed. We will be doing this via the RubyGems application that we just installed, but first we need to update by running:
gem update
This will update any of the gem source that is currently installed. Once the update has been completed we can go ahead and install Rails. This is done simply via Gem by running:
gem install rails
When you are installing Rails you may be prompted to install a few dependencies that are needed as well, I would highly suggest choosing the Y option and installing these dependencies to avoid any problems down the line when you are ready to use these applications.
Below I have included a screen capture of what the install looked like for me.
http://enterprise.myriadnetwork.com/%7Emyriad/htimg/ror3.png
Now you are ready to create your application. This is done rather simply through Rails using one command.
You need to make sure that the directory that you are using is accessible via the Webserver that you are using, normally it would be best to use a directory in your /home tree for this but my example will be with a different directory.
To get this setup in my directory I simply ran:
rails /var/www/html/myapp
Now that you have this properly setup you will need to have your Webserver point to the folder named 'public' by default when your webpage is visited.
Below I have included a sample httpd.conf DocumentRoot entry that can be used.
Please Note: In order for this to run properly, mod_rewrite is going to need to be installed.
<VirtualHost *:80>
ServerName rails
DocumentRoot /path/application/public/
ErrorLog /path/application/log/apache.log
<Directory /path/application/public/>
Options ExecCGI FollowSymLinks
AddHandler cgi-script .cgi
AllowOverride all
Order allow,deny
Allow from all
</Directory>
</VirtualHost>
This installed all of the needed files in my directory.
You have now successfully installed Ruby on Rails. Now that this is done there is alot more that you can do with this application, there is various different resources around the internet that more information can be found on but I am going to go ahead and provide you with the links that I feel are most important.
FastCGI
I would suggest setting up FastCGI, this is used to speed up your applications and is integrated into Apache once you install it. More information regarding that can be found here. http://wiki.rubyonrails.com/rails/show/FastCGI
How-To's
The Ruby on Rails website is also full of How-To's for various things to do with this application. For anyone using this application I would highly suggest visiting the page below
http://wiki.rubyonrails.com/rails/show/Howtos
FastCGI Implementation & Apache HTTPD Implementation
Below is an excellent URL thast will show how to implement FCGI with Apache.
http://wiki.rubyonrails.com/rails/show/Fast+CGI+and+Apache2+for+Red+Hat+Linux+9
If you have not noticed all of the URL's I have provided you are from one page, this page has a vast array of documentation and should be looked at by anyone interested in using Ruby on Rails.
http://wiki.rubyonrails.com
Please note, the ROR logo is not property of Myriad Network and is only being used in this tutorial.
If you have any questions, please feel free to let us know, we would be glad to help you out.
Fast-track your Web apps with Ruby on Rails http://www-128.ibm.com/developerworks/linux/library/l-rubyrails/?ca=dgr-lnxw06RubyRails