Flex 2 SDK on OpenBSD 4.1

Posted by face on October 15, 2007

Java is a prerequisite. I tried building a simple mxml file with kaffe on OpenBSD, but kaffe failed with a CDATA error for flex 2 and then simply dumped core flex 3 beta. So before we start, lets build and install JDK for OpenBSD from source. Once you have built jdk-1.5, install it and ensure $JAVA_HOME is set and $JAVA_HOME/bin is on your path.

If you don’t already have wget and unzip installed, we can install them now:

sudo csh
setenv PKG_PATH ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.1/packages/i386
pkg_add wget unzip

The flex sdk is free and comes in a multi-platform binary format. Adobe forgot to put it in a directory, so lets make one for it now and then grab and unzip the sdk:

sudo mkdir /usr/local/flex2sdk-2.01
sudo ln -s /usr/local/flex2sdk-2.01 /usr/local/flex
cd /tmp
wget http://download.macromedia.com/pub/flex/sdk/flex2_sdk_hf1.zip
cd /usr/local/flex
sudo unzip /tmp/flex2_sdk_hf1.zip
rm -f  /tmp/flex2_sdk_hf1.zip
sudo chmod +x /usr/local/flex/bin/mxml

That should do it. Lets try it out. Place the following in a file called hello.mxml:


<?xml version="1.0" encoding="utf-8"?>
<mx:Application xmlns:mx="http://www.adobe.com/2006/mxml" horizontalAlign="center" verticalAlign="center">
  <mx:Panel title="Yo">
    <mx:Text htmlText="Hello &lt;b&gt;new&lt;/b&gt; World!" />
  </mx:Panel>
</mx:Application>

And now compile it:

/usr/local/flex/bin/mxmlc hello.mxml

And you should end up with hello.swf:


Digg! Delicious! Technorati Blinklist Furl Reddit

JDK 1.5.0.12 on OpenBSD 4.1

Posted by face on October 15, 2007

JDK 1.5 in the 4.1 ports is crufty at this point. I recommend back porting the current HEAD version (assuming you already have your ports tree configured and up to date, are part of the wsrc group, and the wsrc group has write permissions to /usr/ports. If my assumption is wrong, please configure your ports tree as suggested here 15.3 – Working with ports ):

Before we start lets get the manual files and put them in /usr/distfiles:

Now Lets update the port, install prerequisites as binaries to save time, and build the package (You probably need to up datasize-cur in /etc/login.conf for the user building java to be 1024M, mine was when I just built it):

setenv CVSROOT anoncvs@anoncvs3.usa.openbsd.org:/cvs
setenv PKG_PATH ftp://ftp2.usa.openbsd.org/pub/OpenBSD/4.1/packages/i386
sudo pkg_add gtar-1.16.1p0 zip unzip bzip2 openmotif libiconv kaffe jikes nspr gmake wget
cd /usr/ports/devel/jdk/1.5
cvs up -rHEAD .

This updated jdk/1.5/Makefile will fail in OpenBSD 4.1 after several hours with the following error: /bin/sh: syntax error: `(' unexpected. I tracked this down to the \(TM\) in the COMMENT-main and COMMENT-jre in the Makefile. Remove these \(TM\)s in those two comment variables in the Makefile with your favorite editor and we can continue.

cd /usr/distfiles
wget http://www.java.net/download/tiger/tiger_u12/jdk-1_5_0_12-fcs-src-b04-jrl-02_may_2007.jar
wget http://www.java.net/download/tiger/tiger_u12/jdk-1_5_0_12-fcs-bin-b04-jrl-02_may_2007.jar
wget http://www.apache.org/dist/xml/xalan-j/xalan-j_2_7_0-bin.tar.gz
cd /usr/ports/devel/jdk/1.5
make makesum # Need to rebuild checksums as 4.2 OpenBSD uses longer keys
make package  # This will take a while...a long while

After several hours we should have a shiny new native JDK for OpenBSD. We can install it now:

unsetenv PKG_PATH
pkg_add /usr/packages/i386/all/jdk-1.5.0.12.tgz
chmod -R +r,+x /usr/local/jdk-1.5.0   #Let's let everyone run it

Digg! Delicious! Technorati Blinklist Furl Reddit

Unofficial Guide to Install OpenBSD on a 1and1.com Dedicated Server

Posted by face on October 14, 2007

Update: I have dumped 1and1.com for poor customer service and slow connectivity to my "100Mbps" dedicated server. I now lease my servers from m5hosting.com and couldn't be happier.
I used to lease 6 dedicated servers from 1&1. I used to like 1and1 because they had an excellent network backbone that peers with about everyone (though now it is slow and I think oversold where my dedicated servers were). Combined with their raw network speed is all the automated tools I need for self service (serial console, web based hard boot, web based rescue boot into linux, web based reimage, dns). Customer service is adequate if you have no problems (24x7 fast to answer the phone, however, they can't do much as their systems are automated and they have no two way communication with the Admins). 1and1.com is German engineered...go figure. They offer managed services as well (windows) but if you are reading this guide you probably don't need that!


I love OpenBSD because it is lean, fast, secure, free, and did I mention secure. I started using OpenBSD many years ago for firewalls. These days I use it for everything that doesn't need massive thread scaling (java or MySQL at high load MP hardware). What a bonus to have the best firewall on the market built into every server.


Digg! Delicious! Technorati Blinklist Furl Reddit

OpenBSD Guide to configure an Anonymous ftp server.

Posted by face on October 14, 2007

This is a quick guide to configure PF and fptd for an OpenBSD 4.1 system.

All the software necessary comes preinstalled with OpenBSD 4.1 so all we need is some configuration.

NOTE: The following commands assume you have just installed OpenBSD 4.1 and haved not done any previous configuration. If this is not a virgin OpenBSD system make sure you study the current configuration and know what you are doing before cutting and pasting the commands below. Use the commands below at your own risk.

First, I assume you already have your basic firewall configured and running. I guess if your box is behind another firewall you might choose not to have one. If you don't have one you can install this this sample pf.conf to /etc/pf.conf before continuing (just change vr0 to be your interface going to the internet).

Now, let's configure everything. I use /var/www/ftp as my anonymouse root (www so my chrooted Apache can provide HTTP access to my ftp server dirs):

mkdir -p /var/www/ftp
groupadd ftp
useradd -c 'Anonymous ftp' -d /var/www/ftp -g ftp -s /sbin/nologin ftp
cd /var/www/ftp
mkdir -p bin etc pub
chmod 555 . pub
chmod 511 bin etc
cd etc
cp /etc/pwd.db .
cp /etc/group .
echo 'Welcome to my server....All transfers are logged.' >> motd
cd ..
chmod -R -w .
echo '# Set to NO if ftpd is running out of inetd'  >> /etc/rc.conf.local
echo 'ftpd_flags="-DllUSA"    # for non-inetd use: "-D"' >> /etc/rc.conf.local

echo 'net.inet.ip.porthifirst=6000'       >> /etc/sysctl.conf
echo 'net.inet.ip.porthilast=60100'       >> /etc/sysctl.conf

echo ''               >> /etc/pf.conf
echo '# FTP'              >> /etc/pf.conf
echo 'pass in on $ext_if proto {tcp,udp} from any to any \'   >> /etc/pf.conf
echo '  port { ftp, ftp-data, 6000:60100 } keep state'    >> /etc/pf.conf
echo ''               >> /etc/pf.conf

pfctl -f /etc/pf.conf
/usr/libexec/ftpd -DllUSA

That is it. Of course you might actually want to put some read only files in /var/www/ftp/pub/ for people to anonlymously get.

References:
man ftpd
man pf

Digg! Delicious! Technorati Blinklist Furl Reddit

Cygwin *** fatal error - couldn't allocate heap, Win32 error 487

Posted by face on October 13, 2007

Ok, lets recycle some content from the old myutil site and get this blog rolling...

I put this up here because it wasted me untold hours figuring it out.

Logitech Quick Camera 9.X crashes cygwin......AAAAAAaaarg!

Does this look familiar:


  *** fatal error - couldn't allocate heap, Win32 error 487

Sorry, the only solution I have at this point is to uninstall the Logitech Quck Camera driver. I read that the earlier driver worked with cygwin. I believe this to be a Logitech bug at this point and I can't use windows without cygwin. So, Quick Camera has been moved to /dev/null.

Update: Seems people out there are still having this problem. I have run into another problem: ruby is slow under cygwin (painful in my old laptop). I may give coLinux a try. It probably works with quick cam and ruby should fly...

Update: As Kevin Szabo points out in the comments to this post: "This may be a problem with a conflict with LVPrcSrv.exe". He provided a link to the thread here.

Digg! Delicious! Technorati Blinklist Furl Reddit