blowmage A Mike Moore joint

Installing Rails on Shared Hosting

I stated in an earlier entry on installing the excellent Rublog that I may be simply delaying the inevitable move to Ruby on Rails, and I was right. The siren call of the new and shiny has won me over, and I decided to extend this site's Ruby support to include Rails. (The fact that the Typo blog engine now renders static HTML files dramatically improving performance also helped, but more on that next time.)

It is possible to install and use Rails on HostingPlex, but the performance will suffer. Rails is a large framework, and not having mod_ruby and FastCGI installed hurts performance tremendously. Until they are properly supported by HostingPlex, you should use at your own risk. But since you're reading this, I'll assume that you want to continue with installing Rails. ;)

The first step to installing Rails is to install RubyGems. Truth be known, you probably want to install gems whether you install Rails or not. Installing gems is as easy as our previous installations:

$ cd ~
$ wget http://rubyforge.org/frs/download.php/3463/rubygems-0.8.8.tgz
$ tar zxvf rubygems-0.8.8.tgz
$ cd rubygems-0.8.8
$ ruby setup.rb

Once gems is installed, installing Rails or any other gem is the easiest thing in the world:

$ gem install rails

Be sure to answer y when prompted by the Rails installation. While you are at it, you can also install a couple supporting libraries common to Rails apps.

$ gem update mysql
$ gem install redcloth

By default, Rails connects to a MySQL database using a library written in Ruby. This library isn't as fast as using a compiled library. James Duncan Davidson has a great article on improving the performance or Rails apps by using the native library. To install the native library you should use these commands:

$ cd ~
$ wget http://tmtm.org/downloads/mysql/ruby/mysql-ruby-2.6.3.tar.gz
$ tar zxvf mysql-ruby-2.6.3.tar.gz
$ cd mysql-ruby-2.6.3
$ ruby extconf.rb --with-mysql-dir=$HOME/local/mysql && make && make install

Is it me, or are these tasks getting easier?