errorCodex - Computer Questions & Solutions Forum


  errorCodex - Computer Questions & Solutions Forum » Blue Screen » Basic How-tos

Basic How-tos Help Us Noobs by Sharing Your Wisdom

Reply
 
Thread Tools
  #1  
Old 27 November 2009, 11:54
Miraenda's Avatar
Miraenda Miraenda is offline
Mime Stalker
 
Join Date: Nov 2009
Location: Coralville Iowa
Age: 37
Posts: 75
Miraenda has disabled reputation
Default Installing Ruby and Rails on a cPanel Server

Install Ruby, Ruby Gem, Fastthread, Mongrel and Rails

Run the following command in root shell:
Code:
/scripts/installruby
This script will install all of these components--ruby, ruby gem, fastthread, mongrel, and rails. If the script complains about installing or a prior installation, use --force instead:
Code:
/scripts/installruby --force
___________________________________

Adding the ror_setup Script

Run the following command:
Code:
/usr/local/cpanel/bin/ror_setup
This will setup Ruby on Rails to activate when your system starts.
___________________________________

Check the Gems Installed

Check the following gems were all properly installed:
Code:
gem list --local
You should see the following (version numbers may vary):
Code:
actionmailer (2.3.4)
actionpack (2.3.4)
activerecord (2.3.4)
activeresource (2.3.4)
activesupport (2.3.4)
cgi_multipart_eof_fix (2.5.0)
daemons (1.0.10)
fastthread (1.0.7)
ffi (0.5.3)
gem_plugin (0.2.3)
mongrel (1.1.5)
rack (1.0.1)
rails (2.3.4)
rake (0.8.7)
rubygems-update (1.3.5)
If any are missing, run:
Code:
gem install name
Where name is the missing gem. For example, if fastthread didn't install, then run:
Code:
gem install fastthread
___________________________________

Install SQLite and SQLite Gem

Run the following commands to install SQLite:
Code:
yum install sqlite-devel
gem install sqlite3-ruby
If SQLite is not installed before running the first Rails application, the following errors will occur in /home/username/rails_apps/appname/log/development.log upon attempting to initialize a Rails application via cPanel (where username is the cPanel username, appname is the Rails application name, and development.log is the environment type selected):
Code:
  Status: 500 Internal Server Error
  no such file to load -- sqlite
___________________________________

Install MySQL gem

If MySQL will be used for the Rails application, the gem needs to be installed with the following command:
Code:
gem install mysql
If MySQL is used for the application, but the gem has not been installed, the following errors will occur in /home/username/rails_apps/appname/log/development.log upon attempting to initialize a Rails application via cPanel (where username is the cPanel username, appname is the Rails application name, and development.log is the environment type selected):
Code:
  Status: 500 Internal Server Error
  no such file to load -- mysql
Please ensure to place the following code in the /home/username/rails_apps/appname/config/database.yml file if using MySQL rather than SQLite:
Code:
  adapter: mysql
  database: username_dbname
  username: username_dbusername
  password: dbuser's password here
Some sites might mention to put the path to the socket, doing this may cause MySQL to not work on cPanel's Rails environment. Encoding or pool size lines may be included in the database.yml configuration file as well. All of these values hold true for development, test and production areas for the database.yml file.

The default database for all Rails applications on the server can be set as MySQL rather than SQLite using:
Code:
export RAILS_DEFAULT_DATABASE=mysql
___________________________________

Install PostgreSQL gem

If PostgreSQL will be used for the Rails application, the gem needs to be installed with the following command:
Code:
gem install postgres
If PostgreSQL is used for the application, but the gem has not been installed, the following errors will occur in /home/username/rails_apps/appname/log/development.log upon attempting to initialize a Rails application via cPanel (where username is the cPanel username, appname is the Rails application name, and development.log is the environment type selected):
Code:
  Status: 500 Internal Server Error
  no such file to load -- postgres
Note: If PostgreSQL has not already been installed on the machine, then it would have to be installed prior to adding the gem by using the following steps:
  1. Run /scripts/installpostgres
  2. Log into WHM > SQL Services > Postgres Config
    1. Click "Install Config" button
    2. Re-click on Postgres Config
    3. Enter a password in the Postgres Password field
    4. Click "Change Password" button
After doing the above steps, then the gem install postgres command should work.
___________________________________

Install a Rails Application in cPanel

In cPanel for your account, click on the Ruby on Rails icon under "Software / Services" area.

Under the Create Ruby on Rails Application section, enter the following:

App Name app1
Load on Boot? check this box
Application Path rails_apps/app1 (auto fills in, do not change)
Environment development

The application name can be anything, so app1 is just an example. Any name up to 15 characters long is acceptable.

The environment type can be changed to production after site development has been finished. The benefit of using development rather than production would be that caching for the pages will not occur in development unlike the production setting. The drawback would be that development sites tend to be slower and use more resources. Development is the best choice for a site being developed and changed, while production is the best choice for a site that has been completed and will not have many coding changes anymore.

Now that the settings have been selected, click on the "Create" button to complete the Rails application setup.

After the application creates, the screen will redirect to indicate it was successful with the following message:
Code:
Your app is installed, its name is app1
Click the "Go Back to Ruby on Rails Applications" link to go back to the Ruby on Rails Management area.
___________________________________

Start a Rails Application in cPanel

Under the "Available Ruby on Rails Applications" section, click the Run icon next to the created application under the Actions column.

After the application has been started, the screen will redirect to indicate it was successful with the following message:
Code:
The following Ruby on Rails application was started: app1
Click the "Go Back to Ruby on Rails Applications" link to go back to the Ruby on Rails Management area.
___________________________________

Check a Rails Application is Working in cPanel

Under the "Available Ruby on Rails Applications" section, click the URL icon next to the created application under the Rails Server column. The new application will appear in a browser. If it is working, you will see a message similar to the following:

Welcome aboard
You’re riding Ruby on Rails!

About your application’s environment

Click on the "About your application's environment" link to see details on the environment. If everything is working, the details may look similar to the following:

Code:
Ruby version 1.8.7 (i686-linux)
RubyGems version 1.3.5
Rack version 1.0
Rails version 2.3.4
Active Record version 2.3.4
Active Resource version 2.3.4
Action Mailer version 2.3.4
Active Support version 2.3.4
Application root /home/username/rails_apps/app1
Environment development
Database adapter sqlite3
Database schema version 0
If the environment information does not display and a 500 Internal Server error is showing instead, then something is not working properly and the /home/username/rails_apps/app1/log/mongrel.log and /home/username/rails_apps/app1/log/development.log files will both need to be reviewed for any errors to track down what is happening.
__________________
Miraenda
~ Ex uno disce omnes ~
Reply With Quote
  #2  
Old 3 May 2010, 14:26
shaycorl shaycorl is offline
Junior Member
 
Join Date: May 2010
Posts: 5
shaycorl is on a distinguished road
Default Re: Installing Ruby and Rails on a cPanel Server

When i execute ruby setup.rb and set up config file to have it configured for working ad then installing installer script ... till there its going well but after that where gem query is local and gem q-L i am getting missing gem error not sure where i am wrong.
__________________
VMWare
Reply With Quote
  #3  
Old 3 May 2010, 14:52
Miraenda's Avatar
Miraenda Miraenda is offline
Mime Stalker
 
Join Date: Nov 2009
Location: Coralville Iowa
Age: 37
Posts: 75
Miraenda has disabled reputation
Default Re: Installing Ruby and Rails on a cPanel Server

Please post the exact error message you are getting in the log.
__________________
Miraenda
~ Ex uno disce omnes ~
Reply With Quote
Reply

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 01:50.


A vBSkinworks Design
Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2010, Jelsoft Enterprises Ltd.