Installing Ruby on Rails on Plesk

To Install Ruby on Rails on a Plesk Server:

yum groupinstall “Plesk 8.1 Ruby”
yum install psa-miva (If Miva required)
yum groupinstall “Plesk 8.1 FastCGI” (if FastCGI required)

To Configure Ruby on Rails on a Plesk Server:

1. Create a domain in Plesk with Physical hosting.
2. Ensure that bin/bash access is enabled.
3. Ensure that CGI and FastCGI are enabled
4. SSH to server.yourservername.com with the FTP/SSH username and password.
5. Configure Ruby:
##Add Ruby to your path
export PATH=$PATH:/opt/ruby/bin/
##Change permissions on private folder
chmod 755 private

cd private
##Create Application (Replace myapp and test with your application name and controller name.)
rails myapp
cd myapp
script/generate controller test
cd ../../httpdocs
ln -s ../private/myapp/public rails

## Check App works, You should see the Welcome Aboard page

http://yourdomain.com/rails/

#Additional, to see if Ruby actually works (gives output):

cd ~/private/myapp/app/controllers/
edit file test_controller.rb
Change the text so that it reads

class TestController < ApplicationController
def hi
render :text => 'Hi world'
end
def hello
end
def index
render :text => 'Hi! This is the Index.'
end
end

quit and save.

edit ../views/test/hello.rhtml and add the text:

<html>
<head>
<title>Hello World</title>
</head>
<body>
<h1>Hello from Rails!</h1>
<p>The current time is <%= Time.now %></p>
</body>
</html>

#Then visit: http://yourdomain.com/rails/test/hello

If RubyGems (Ruby package installation/management/distributrion software) is required:
Download RubyGems at http://rubyforge.org

cd Rubygems directory

ruby setup.rb

If soap4r (ruby implementation of SOAP) is required:

gem install soap4r –source http://dev.ctor.org/download

Some Rails apps refuse to run because they cannot find the Rails Gem, In this instance Rails must be installed as a Gem:

(RubyGems is a packaging system so rails can be installed/removed/updated in the same way as Yum)

yum remove psa-ruby-rails

gem install rails -v 1.2.2 (or specific version requested)

You can leave a response, or trackback from your own site.

Leave a Reply