The best kittens, technology, and video games blog in the world.

Wednesday, November 28, 2007

Installing Oracle 10g Enterprise Edition on Ubuntu 7.10 gutsy gibbon

Snuzzle by chezmichelle from flickr (CC-NC)

As Trampoline Systems is doing "Enterprise" software we don't have a luxury of choosing whatever database we want (most likely mysql or postgresql, at least as far am I'm concerned), but need to support whichever database our customers use. I don't think there's any objective reason for customers being interested in database used by application any more than they should be interested in its programming language or ORM library, but for some reason the current tradition says that in "Enterprise" software applications can use any programming language and ORM they want, but the customer determines the database.

Now some people who never tried it claim that moving Rails application from one database to another is just a matter of a single line configuration change. How do I know they never tried it ? Because we did. At the very least it requires all tests to be run twice, once with mysql and the second time with Oracle. And number of things which work differently is just enormous. To make things worse most people here use Intel Macs, and there are not even Oracle clients for them, let alone servers, so when any problems happen they need to be fixed on a Linux server over ssh or on a borrowed Windows machine. It all works, but it's far from trivial.

Now since I wiped out OSX on my machine and installed Ubuntu, I thought I might be able to install Oracle 10g Enterprise Edition on it. Unfortunately Ubuntu is not an officially supported platform for Oracle, and Express Edition is apparently different enough that we don't want to use it. In the end it all worked quite less with just a little bit of hacking.

First you need to get Linux installer ( and unpack it. The installer relies on some binaries being in /bin instead of /usr/bin so you need to make a few links.

$ sudo ln -s /usr/bin/basename /bin/basename
$ sudo ln -s /usr/bin/awk /bin/awk

Now you need to add a "nobody" group. Debian-based system use nobody.nogroup instead of nobody.nobody, but we aren't losing any security by creating an extra group.
$ sudo addgroup nobody

Now enter installer directory (database), and run the installer. There are many questions, but they are straightforward to answer even if you know little about Oracle. You do not need to do it as root.
$ ./runInstaller -ignoresysprereqs

After you do that the installer will ask you to run two scripts as root. Paths to these scripts (shown in installer dialog) depend on your system, for me they were:
$ sudo /home/taw/oraInventory/
$ sudo /home/taw/oracle/product/10.2.0/db_1/

Now test if it works with your Rails. If it doesn't due to being unable to load either recompile OCI8, or more easily add the following line to your .bashrc:
export LD_LIBRARY_PATH=/home/taw/oracle/product/10.2.0/db_1/lib/

By this point you should have Oracle working. The only thing missing is getting it working again after reboot. Just create a /etc/init.d/oracle like this one (correct path and oracle account):


# if the executables do not exist -- display error

if [ ! -f $ORACLE_HOME/bin/dbstart -o ! -d $ORACLE_HOME ]
echo "Oracle startup: cannot start"
exit 1

# depending on parameter -- startup, shutdown, restart
# of the instance and listener or usage display

case "$1" in
# Oracle listener and instance startup
echo -n "Starting Oracle: "
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl start"
su - $ORACLE_OWNR -c $ORACLE_HOME/bin/dbstart
touch /var/lock/subsys_oracle
echo "OK"
# Oracle listener and instance shutdown
echo -n "Shutdown Oracle: "
su - $ORACLE_OWNR -c "$ORACLE_HOME/bin/lsnrctl stop"
su - $ORACLE_OWNR -c $ORACLE_HOME/bin/dbshut
rm -f /var/lock/subsys_oracle
echo "OK"
$0 stop
$0 start
echo "Usage: $0 start|stop|restart|reload"
exit 1
exit 0

and create symlinks to it:
$ sudo ln -s /etc/init.d/oracle /etc/rc0.d/K01oracle
$ sudo ln -s /etc/init.d/oracle /etc/rc2.d/S99oracle
$ sudo ln -s /etc/init.d/oracle /etc/rc6.d/K01oracle

Congratulations to the first person to finish jrpg

jrpg completed by Stephen Christenson

Congratulations to Stephen Christenson, who is the first person to finish jrpg, or at least the first to inform me of doing so. According to the savefile he sent me it didn't take that much kanji demon bashing to complete all quests (at least the crystal ball thinks so), so I should probably add a few more maps and quests.

In the last few months I got multiple feature requests for jrpg. Some of them like kana keyboard support seem relatively straightforward (if the operating system, SDL and PyGame support them). Fixing wrapping of long examples was requested often, and it shouldn't be that hard. The most popular request that simply cannot be done in a reasonable amount of work is providing translations for all words in the game.

It's really nice hearing from people who enjoy jrpg. Have fun and good learning.

Saturday, November 17, 2007

Mac vs Ubuntu

Lolcat based on photo by Kevin Steele from flickr (CC-NC)
I wiped out OS X on my Macbook and installed kUbuntu. I just couldn't stand it any more.

The good:

  • Packaging system is so massively better. Installing mysql is sudo apt-get install mysql-server-5.0 not spend a few hours on it. Upgrading actually works. Packages don't fail in the middle of installation, possibly fucking the entire system.
  • No need to register at random websites to have gcc. Did you know that they will spam you if you register, and "Unsubscribe" link in their spam won't work ? Now you do know. Oh and the spam is not even about Macs, it's about some crappy phones.
  • Window manager is way more functional. It manages focus of windows not applications. Managing focus of applications is simply braindead when application is something like Terminal or Textmate or Finder, windows of which live completely independent life. As far as my experience go, almost every single application with multiple windows should have them managed independently.
  • Middle click for the win ! Command-C, Command-V is so annoying. Unfortunately crappy Mac trackpad has only one button so I cannot middle-click it even with the standard "press both buttons" trick. Well, It's not like I planned to buy any more Apple hardware every.
  • Sane terminal emulator, with all keys working properly.
  • The system feels much faster, almost as if I upgraded the hardware.
  • Many applications are massively better. Amarok instead of some horrible piece of crap that I didn't use anyway because even command line music playing with mplayer was more convenient. Xchat instead of Colloquy. Nobody uses Safari even on OS X so Firefox doesn't really count as a change.
  • Polish Dvorak keyboard works.
  • All packages are reasonably up to date. I don't have to choose between ancient Ruby and working Java (Tiger), or recent Ruby and broken Java (Leopard), or spending way too much time to get it all working properly.
The bad. Most of it is Apple proprietary hardware's fault, not Ubuntu's fault:
  • Font rendering in kUbuntu is very ugly compared to OS X. They should really fix it.
  • No TextMate any more. I will need to find a decent replacement.
  • Interface looks somewhat less pretty. It doesn't have to look like Mac, but some nicer themes would be good.
  • I couldn't get secondary monitory working other than in shadowing mode. If I try to put secondary 1680x1050 monitor side by side to 1280x800 laptop screen I get error that total screen size would be bigger than the allowed maximum of 1680x1680. GPU driver issue ?
  • Wireless doesn't work out of the box, needed downloading some driver. Not very difficult, but downloading things when internet is down is an unnecessary complication.
  • Hibernate-on-lid-closure doesn't work out of the box.
  • Ubuntu doesn't autodetect FireWire-connected external hard drive (500GB LaCie). The same hard drive works when connected by USB 2.0. I blame Apple for including only 2 USB and 1 FireWire instead of at least 4 USBs. Mouse and keyboard alone take two slots for fuck's sake.
The random:
  • KDE used to have all configuration in one place - Control Center and it was good. Now it's randomly divided into Menu/System Settings, Menu/Settings, Menu/System.
  • It will take some time to get used to keyboard shortcuts being on Alt/Control instead of Command/Control/Alt system.