Ruby 1.8.6-111 on OpenBSD 4.2 (and Ruby-On-Rails)

Posted by face on November 04, 2007

Update: December 31, 2007: Official OpenBSD 1.8.6 patch level 111 ports have been checked into CVS. This post and the associated binaries have been updated to use the official port. My unofficial port has been discarded.

This article describes building a ruby port from source. If you want the binaries produced by this article, I have released them via this Rubyforge project.

If your ports tree is not already prepped, please begin by prepping your ports tree.

There is a message that you may run out of memory without modifying login.conf. My login.conf was already modified. My login is a member of the staff group:
staff:\
        :datasize-cur=1024M:\
        :datasize-max=infinity:\
        :maxproc-max=256:\
        :maxproc-cur=128:\
        :ignorenologin:\
        :requirehome@:\
        :tc=default:

We will be using the official OpenBSD port from CVS.

We will start by installing the prerequisites as binaries because if you have a fast internet connection, it is faster than building the ports from src:
sudo su
setenv PKG_PATH "ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386" 
# or export PKG_PATH="ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386" 
pkg_add libiconv gdbm tk-8.4.7p1
exit

Now lets update the ruby port from CVS HEAD and build it. I did this on December 31, 2007 and the snapshot of the source code to the port can be found here: ruby.tgz

export CVSROOT=anoncvs@anoncvs3.usa.openbsd.org:/cvs   # pls choose a mirror near you
# setenv CVSROOT anoncvs@anoncvs3.usa.openbsd.org:/cvs
cd :/usr/ports/lang/ruby
cvs up -rHEAD .
make package
Now we can install it:
sudo su
setenv PKG_PATH './:ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386'
# or:  export PKG_PATH='./:ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386'
cd /usr/packages/i386/all
pkg_add ruby-1.8.6.111 
# Or, of you already have ruby installed, try:  pkg_add -r ruby-1.8.6.111
And for a bonus, lets install Ruby-On-Rails:
pkg_add ruby-gems ruby-iconv-1.8.6.111  mysql-server mysql-client

# Update gems to version 1.0.1, apparently needed for rails 2.0.2 but will break things like ruby-openid-1.1.4
gem update --system

gem install rails
# For Rails 1.2.6
# gem install -v 1.2.6 rails

# Now let's optimize ruby for mysql
gem install mysql

# finally, mongrel rocks
gem install mongrel --include-dependencies
gem install mongrel_cluster

If this is a new MySQL install, don’t forget to follow the instructions in /usr/local/share/doc/mysql/README.OpenBSD.

Enjoy!


Digg! Delicious! Technorati Blinklist Furl Reddit
Comments

Leave a response

  1. Cameron RitterJanuary 03, 2008 @ 03:36 PM
    Hi, I have truble with your binary. fatal issues in installing ruby-1.8.6.111 Do I need prepare things early or any special thing? Thank you
  2. faceJanuary 04, 2008 @ 12:01 PM
    I don't have instructions for installing my binary listed above. You should be able to download the binaries to a local directory and follow the install instructions above. However, you can use pkg_add without even downloading anything:
    sudo su
    export PKG_PATH="http://myutil.com/ports/4.2/i386/:ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386/"
    # or, setenv PKG_PATH "http://myutil.com/ports/4.2/i386/:ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.2/packages/i386/"
    pkg_add ruby-1.8.6.111
    
    That should do the trick to install my i386 binary on a i386 OpenBSD 4.2 system. Thanks, -face
Comment

Hint: Comments now accept textile.