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:

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 "" 
# or export PKG_PATH="" 
pkg_add libiconv gdbm tk-8.4.7p1

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   # pls choose a mirror near you
# setenv CVSROOT
cd :/usr/ports/lang/ruby
cvs up -rHEAD .
make package
Now we can install it:
sudo su
setenv PKG_PATH './:'
# or:  export PKG_PATH='./:'
cd /usr/packages/i386/all
pkg_add ruby- 
# Or, of you already have ruby installed, try:  pkg_add -r ruby-
And for a bonus, lets install Ruby-On-Rails:
pkg_add ruby-gems ruby-iconv-  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.


Digg! Delicious! Technorati Blinklist Furl Reddit

Prepping Ports for OpenBSD

Posted by face on November 04, 2007

This follows 15.3 – Working with ports. Here are the main steps:

Your /etc/mk.conf should look similar to this:

The assumption is you have placed the 4.2 ports.tar.gz in /tmp:
sudo su
cd /usr
tar xpfz /tmp/ports.tar.gz
chgrp -R wsrc /usr/ports
find /usr/ports -type d -exec chmod g+w {} \;
mkdir -p /usr/distfiles /usr/obj/ports /usr/packages
chgrp -R wsrc /usr/distfiles /usr/obj/ports /usr/packages
chmod g+w /usr/distfiles /usr/obj/ports /usr/packages

No ensure you are part of the wsrc group. You should be able to do the following as a normal user:

setenv CVSROOT "" 
#or, export
cd /usr
cvs -q up -P -rOPENBSD_4_2 ports

Reference: 15.3 – Working with ports

Digg! Delicious! Technorati Blinklist Furl Reddit

Building A OpenBSD-4.2-current (patched) CD

Posted by face on November 04, 2007

I have to update several OpenBSD systems so I find it easiest to make a 4.2-current (patched) distribution. This can also be burned to a cd so new installs or upgrades via cd are also patched.

So, I have just upgraded to 4.2 OpenBSD. I am now going to build a patched distribution, patching the system in the process.

Let’s do it:

sudo su
# setenv CVSROOT "" 
export CVSROOT="" 
cd /usr
mv src src-4.1
# rm -rf src-4.1 &
mkdir src
cd /usr/src
tar xpfz /tmp/src.tar.gz
tar xpfz /tmp/sys.tar.gz 

cd /usr
cvs -q up -P -rOPENBSD_4_2 src 
cd src/sys/arch/i386/conf

#use GENERIC for non MP or HT servers
/usr/sbin/config GENERIC.MP
cd ../compile/GENERIC.MP
make clean && make depend && make

# if you did not do the 'set image' step above, then just 'make install'
rm -f /
ln / /
cp bsd /nbsd
mv /nbsd /


Log back in as root after reboot, you should see the kernel now has a name like “OpenBSD 4.2-stable (GENERIC.MP) #0”. The -stable means the eratta patches where applied.

cd /usr/src
rm -rf /usr/obj/*
cd /usr/src
make obj
cd /usr/src/etc && env DESTDIR=/ make distrib-dirs
cd /usr/src
make build
# This will take a while


When the build completes, your system is up to date. If you have only 1 machine, you are done. However, I need patched distribution sets for my other boxes:

export DESTDIR=/usr/dest
export RELEASEDIR=/usr/rel
# setenv DESTDIR /usr/dest
# setenv RELEASEDIR /usr/rel
cd /usr/src/distrib/crunch && make obj depend all install
test -d ${DESTDIR} && mv ${DESTDIR} ${DESTDIR}.old && rm -rf ${DESTDIR}.old &
cd /usr/src/etc
make release
cd /usr/src/distrib/sets/
sh checkflist

We now have a release in /usr/rel. I combine this with an official distribution to get the x-windows sets as I am not building them here. Basically, I copy everything except MD5 from /usr/rel into the 4.2/i386 dist dir that has everything from the ftp server except install42.iso. Then I edit the MD5 to include the new checksums. Now put everthing under a directory structure OpenBSD/4.2/i386. For this example, say it is all in /tmp/OpenBSD/4.2/i386 we can now make the iso cd image:

cd /tmp
mkhybrid -A "OpenBSD-4.2-stable-i386" -P "Me" -V  "OpenBSD-4.2-stable-i386" -r -b 4.2/i386/cdbr -c 4.2/i386/boot.catalog -o OpenBSD-4.2-Stable-i386.iso OpenBSD


Digg! Delicious! Technorati Blinklist Furl Reddit

Remote Upgrade of OpenBSD 4.1 to 4.2

Posted by face on November 04, 2007

The first assumption is that you have a remote OpenBSD server running 4.1 with a serial port console.

Before you start, read the OpenBSD 4.2 upgrade faq here . For the most part, you will be following that faq. This is simply a supplemental guide to get things rolling…

I’m upgrading a i386 system. bsd.rd is the install/upgrade kernel. If we already have a remote system running, we can upgrade bsd.rd first, then boot from it and upgrade the rest of the system.

sudo cp /bsd.rd /bsd.rd-4.1
sudo cp bsd.rd /bsd.rd
sudo shutdown -h now "Upgrading to 4.2"  # if you don't get a boot prompt, read the NOTE below

Now get on the serial console. You should see that the os is halted and Please press any key to reboot.. When you see the boot prompt type:

boot bsd.rd

Digg! Delicious! Technorati Blinklist Furl Reddit