Rails on OpenBSD part 2 - Updating

July 16th, 2007

One of the first things you want to do is setup your environment for using pkg_add in interactive mode. To do so open the .profile file (at this point you don't have much of a choice in the way of editors here so VI is probably what you are going to use) and add the following lines

PKG_PATH=ftp://ftp.openbsd.org/pub/OpenBSD/4.1/packages/i386/
export PKG_PATH
Once you have done this, simply reload your .profile by sourcing it, or by logging out and back in. Now you have the ability to use the pkg_add system in interactive mode.

The first thing to do now is install a useable shell. Let's install bash and some other important tools that we will need later

# pkg_add -i bash
# pkg_add -i cvsup (when prompted choose the no-x11 version)
# pkg_add -i curl

Now let's grab the sys, src, and ports archives so that we can use them for updating later.

# curl -O ftp://ftp.openbsd.org/pub/OpenBSD/4.1/src.tar.gz (core system)
# curl -O ftp://ftp.openbsd.org/pub/OpenBSD/4.1/sys.tar.gz (kernel source)
# curl -O ftp://ftp.openbsd.org/pub/OpenBSD/4.1/ports.tar.gz (ports tree)

Now let's move these packages to the proper places and extract them.

# mv src.tar.gz /usr/src
# cd /usr/src
# tar -xvzf src.tar.gz

# mv sys.tar.gz /usr/src
# cd /usr/src
#tar -xvzf sys.tar.gz

# mv ports.tar.gz /usr
# cd /usr
# tar -xvzf ports.tar.gz
You now have the update framework in place for future updating of your system. Now let's create the cvsup files needed to run updates for your server. The first file you will create will update your src directories. Let's call it cvsup-src.

# Defaults that apply to all the collections
*default release=cvs
*default delete use-rel-suffix
*default umask=002
*default host=anoncvs3.usa.openbsd.org
*default base=/usr
*default prefix=/usr
*default tag=OPENBSD_4_1

# If your network link is a T1 or faster, comment out the following line.
# *default compress

OpenBSD-src
Now just copy the file you created and name it cvsup-ports. The only thing you need to change is the last line. Just change it from OpenBSD-src to OpenBSD-ports. Now that you have all of these things in place let's run cvsup and grab the latest versions of the source trees.

# cvsup -g -L 2 cvsup-src
# cvsup -g -L 2 cvsup-ports
After you have run this you will now have the latest version of the OpenBSD source. I would recommend that you follow the next couple steps for actually rebuilding your system but they are technically not required.

Rebuilding your world
After you have run the update scripts you can now start the rebuilding process. The first step is building your kernel. Here's how we do it.

# cp /bsd /bsd.old

# cd /usr/src/sys/arch/i386/conf/
# config GENERIC

# cd /usr/src/sys/arch/i386/compile/GENERIC/
# make clean && make depend && make && make install

This step will take a bit of time to complete. Once you have completed without errors just reboot to test out your new kernel. You're not quite done yet, you still have to complete this step with your ports tree as well as the system itself. Let's take a look at the ports tree.

# cd /usr/ports/infrastructure/build/
# ./out-of-date

This will give you a list of ports that are out of date and need to be recompiled. Since you don't have anything installed from ports yet it's not really a big deal. Now let's tackle the most time consuming part of our rebuild, the system.

# 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 bit longer (usually somewhere around twice as long) than the kernel compile. Once you have completed successfully you can now reboot into your new running system.

That's all for this part of the tutorial. The next step will cover the ruby on rails stack install and basic application setup.

4 Responses to “Rails on OpenBSD part 2 - Updating”

  1. andres Says:
    Great article. When is the new one coming out. I need to get my hands on that one. thanks. andres
  2. Adam Patterson Says:
    Just out of curiosity is there something you dont like about the default shell (/bin/ksh)? It actually similar to bash in alot of functionality. Thanks.
  3. Scott Scites Says:
    Aaron, Thanks for bring OpenBSD to my attention. I'm eagerly awaiting your final tutorial. I'll see you at the CRB (Columbus Ruby Brigade)! Scott Scites
  4. Aaron Bedra Says:
    There really is nothing that I dislike about ksh, I am just very used to using bash so I stick with it.

Sorry, comments are closed for this article.

-U:**- index.html.erb   (Ruby RoR RHTML)
M-x visit-site http://aaronbedra.com