Installing Mephisto on Ubuntu 8.10

Justin / 19.Nov.2008

Note: this tutorial assumes you already have a working Ruby on Rails installation (installed via apt-get/aptitude with rubygems built from source). Bonus points will be awarded if you already have Ruby Enterprise Edition installed.

When it comes to Rails blog engines, there aren't too many choices; Typo and Mephisto are the two most popular packages, and both are rather stagnant in terms of development. Seeing as the Ruby world moves fast and the Rails world even faster, this can make it difficult to get either of these packages working with the current versions of Ruby and/or Rails. Ubuntu 8.10, the Intrepid Ibex from hell, has this problem. It took a few tries, but this blog is using Mephisto now, and I'd like to share the process that worked for me so you can get it running for your blog, too.

Ubuntu 8.10 comes with Ruby 1.8.7 and Rails 2.1.2. This is problematic for Mephisto in two ways: Mephisto only works with Rails <= 2.0.2, and Ruby 1.8.7 removes some Enumerate functionality that Mephisto relies on. But with a little maneuvering, we can get Mephisto working just fine. The process looks like this:
# install the required gem dependency:
sudo gem install tzinfo

# get Mephisto from GitHub
wget http://github.com/technoweenie/mephisto/tarball/master.tar.gz

# untar the file and cd into the directory
tar zxvf technoweenie-mephisto-*.tar.gz
cd technoweenie-mephisto-*

# put the 2.0.2 version of Rails on ice
rake rails:freeze:edge RELEASE=2.0.2

# use the 2.0.2 boot file in Mephisto
cp vendor/rails/railties/environments/boot.rb config/boot.rb

# create your production database
mysqladmin create mephisto_production

-- do the usual config/database.yml username/password/database setup--

# hack Mephisto to work with Rails 2.1.2 and Ruby 1.8.7
vi config/boot.rb and add the following lines at the top:
RAILS_GEM_VERSION = '2.0.2' unless defined? RAILS_GEM_VERSION

unless '1.9'.respond_to?(:force_encoding)
String.class_eval do
    begin
      remove_method :chars
    rescue NameError
      # OK
    end
  end
end

# bootstrap the production database
rake db:bootstrap RAILS_ENV=production

# restart your webserver for good measure
sudo /etc/init.d/apache2 restart
Provided you did this in a web accessible location, you should be able to log into Mephisto now. The magic is freezing Rails to 2.0.2, updating the boot.rb file to force 2.0.2 to be used and overriding Ruby 1.8.7's Enumerate weirdness. If you're using Ruby Enterprise Edition, you can ignore the 'unless' section above since REE is still 1.8.6. Make sure to install tzinfo with REE's gem binary, though, or mod_rails will give you a nice FAIL message when you try to access Mephisto.
So Ruby Enterprise Edition doesn't compile on Ubuntu 8.10. It appears as though the version of GCC that comes bundled in Intrepid's build-essential (4.3.2-1ubuntu11) is too awesome for REE to handle. Actually, it's due to some path hacking that REE does to work on systems like FreeBSD, but I digress...

So you've all but given up hope of getting REE to work on your Intrepid install. But fear not; the change is actually really simple! In order to make it compile properly, you just need to apply the following patch to the REE source:
--- /tmp/ruby-enterprise-1.8.6-20080810/installer.rb
+++ ruby-enterprise-1.8.6-20080810/installer.rb
@@ -159,9 +159,9 @@
@destdir += "/"
end

- ENV['C_INCLUDE_PATH'] = "#{@destdir}#{@prefix}/include:/usr/include:/usr/local/include:#{ENV['C_INCLUDE_PATH']}"
- ENV['CPLUS_INCLUDE_PATH'] = "#{@destdir}#{@prefix}/include:/usr/include:/usr/local/include:#{ENV['CPLUS_INCLUDE_PATH']}"
- ENV['LD_LIBRARY_PATH'] = "#{@destdir}#{@prefix}/lib:#{ENV['LD_LIBRARY_PATH']}"
+ #ENV['C_INCLUDE_PATH'] = "#{@destdir}#{@prefix}/include:/usr/include:/usr/local/include:#{ENV['C_INCLUDE_PATH']}"
+ #ENV['CPLUS_INCLUDE_PATH'] = "#{@destdir}#{@prefix}/include:/usr/include:/usr/local/include:#{ENV['CPLUS_INCLUDE_PATH']}"
+ #ENV['LD_LIBRARY_PATH'] = "#{@destdir}#{@prefix}/lib:#{ENV['LD_LIBRARY_PATH']}"


--- /tmp/ruby-enterprise-1.8.6-20080810/source/vendor/google-perftools-0.98/src/base/linuxthreads.c
+++ ruby-enterprise-1.8.6-20080810/source/vendor/google-perftools-0.98/src/base/linuxthreads.c
@@ -49,7 +49,7 @@
#include <asm/fcntl.h>
#include <asm/posix_types.h>
#include <asm/types.h>
-#include <linux/dirent.h>
+#include <dirent.h>
For those not well-versed in the intricacies of diff, you need to comment out the three ENV lines in installer.rb starting at line 161, and you need to change the <linux/dirent.h> include directive to point to plain ol' <dirent.h> in source/vendor/google-perftools-0.98/src/base/linuxthreads.c. The rest of the Ruby Enterprise Edition install works the same as in the documentation.

That's all there is to it. :-D

If you found this post at all useful, I would encourage you to buy an Enterprise License for Ruby Enterprise Edition to support Phusion. The gods of Karma will thank you.

Rebooted

Justin / 18.Nov.2008

Welcome to my new home. All hail Mephisto!

Previous Entries

back to top

© 2008; powered by ruby enterprise edition and mephisto