CouchDB on Ubuntu

These results are now largely outdated by the couchdb package in the Ubuntu universe repository.

Installing CouchDB

I have eagerly been waiting to try out CouchDB. I find the concept of document storage, instead of strict relational storage, to be very interesting. Plus, Erlang seems to be gaining mindshare. I documented the process that I took to install CouchDB 0.7.2 on Ubuntu 7.10 (it is basically straight from with the CouchDB wiki, but with some small modifications to get it to work).

wget http://couchdb.googlecode.com/files/couchdb-0.7.2.tar.gz
tar -xzvf couchdb-0.7.2.tar.gz
cd couchdb-0.7.2/
sudo apt-get install automake autoconf libtool subversion-tools help2man build-essential erlang libicu36 libicu36-dev libreadline5-dev checkinstall
sudo checkinstall

Everything should be looking good. We need to add a user and give that user permission to some directories.

sudo adduser couchdb
sudo mkdir -p /usr/local/var/lib/couchdb
sudo chown -R couchdb /usr/local/var/lib/couchdb
sudo mkdir -p /usr/local/var/log/couchdb
sudo chown -R couchdb /usr/local/var/log/couchdb
sudo mkdir -p /usr/local/var/run
sudo chown -R couchdb /usr/local/var/run

You can run in a shell:

sudo -u couchdb couchdb

Or you can start the daemon:

sudo /usr/local/etc/init.d/couchdb start

To access to web view of the database, assuming you are running locally, go to: http://localhost:5984/_utils/index.html Stay tuned for some CouchDB programming...

Just upgraded to Gutsy Gibbon Tribe 2

After reading a post on Planet Ubuntu Users, I grew envious that I didn't have the latest and greatest of Ubuntu--so I decide to take the plunge. First I tried the sudo update-manager -c -d, which error'ed out. So I hacked away at the /usr/lib/python2.5/site-packages/UpdateManager/DistUpgradeFetcher.py file by adding import os. Everything started going fine, except my connection was crawling (almost dial-up speeds)--there was no way that I was going to wait. So I grabbed the latest ISO, picking the alternate install just to avoid the hassle of booting up into the live cd. Everything worked nicely--except I got a little worried when the install hung for ten minutes when installing Tomboy. But with a little patience, everything installed properly. I'm currently updating the system and looking into the new Dual Monitor tool. I am looking forward to exploring this new toy!

Code Statistics

I like looking at numbers. So when I saw an interesting gif on a friend's webpage saying that a certain piece of software had so many thousands of lines of code and cost so much money, I was naturally intrigued. After clicking on the link, I was directed to ohloh.net. This site analyzes public version control repositories and provides some interesting statistics about the project--including the lines of code and estimated cost to develop the software from scratch. I decided to try for myself and registered RadLex. I would have registered my VCSFrenzy branch, but currently only Subversion, CVS, and GIT are supported. After a little digging, it seems like ohloh uses David Wheeler's SLOCCount program. With an easy

sudo apt-get install sloccount

I was using SLOCCount to find out more stats about various other programs I was working on. I was happy to see that my afternoon of hacking on some Festival Python bindings is estimated to have cost $3,480. Now if only SLOCCount deposited that money in my bank account.... I was wondering what your favorite tracking/code stat programs are--let me know? I've been using CIA.vc, but are there any other must have code stat programs?

Sync Outlook, Thunderbird, a PDA, and your Smartphone

Since I first owned a PDA, I have been looking for an elegant solution to syncing my data with the PDA and 'nonstandard' applications (Thunderbird / Sunbird / anything in Linux) ... as apparently many people are.


I tried switching over to Outlook as my primary email/calendar program, my unholy marriage to Outlook lasted longer than I care to admit, mostly because syncing with my PDA <em>just worked</em>.


With the release of Thunderbird 1.5, I decided I had enough of MS Outlook. Around the same time, Lightning and Sunbird caught my attention. After extensive google'ing, I found an excellent product, BirdieSync. I installed the trial version, and was loving it, until my 20 day trial expired. At €19.95 (roughly 27 USD) the product was a little extravagant as a college student. If you have the money and only use Windows, this is a decent option.


After the trial of BirdieSync ended, I switched over to FinchSync. This free (but not open source) product did work, but did not utilize Activesync at all, so you needed two separate programs the PDA client and desktop client both on and looking for each other. It did have the benefit of allowing me to sync via wifi (and if I wanted to, I probably could have remotely synced over the internet). However, this product still needs some polishing to make it a real competitor.

Back to Outlook (but with webdav and RemoteCalendars)

I did not spend much time with FinchSync, it just bothered me having to open the application on my PDA and desktop to sync. In addition, I decided to switch over to Ubuntu almost full time. So I engineered a complex solution. I still used Thunderbird and Lightning (both in Windows and Linux) which synced a iCal file up to a WebDav server (I could have used Google Calendar). Then whenever I was using Windows and cradled my PDA, Outlook would open and sync with the calendar by using RemoteCalendars. This solution worked alright for a while, mainly since I was using Windows so much for work. But two issues plagues this solution: 1) Windows needed to be on to sync, 2) I could only do a one way sync from desktop to PDA, since the Activesync always viewed the recently downloaded iCal file as "fresher."

Finally, Funambol

Several weeks ago, I got a Motorola Q--a very nice Windows Mobile based smartphone. I went back to Google and my "knight in shining armor," Funambol, appeared (formerly Sync4j). As a commercial product with almost everything open source, I got an enterprise solution for free. First step was downloading and installing the server--which I put on my Ubuntu server. After 20 minutes of that and configuring my firewall, I was onto getting plugins. I installed one into Thunderbird that syncs Lightning and my contacts. I installed one on my new Motorola Q, one in my old PDA, and one in Outlook for good measure. The plugins have nice integration into Thunderbird, Outlook, and Windows Mobile, while not using Activesync. One awesome benefit is that I can now sync through the internet--no more USB cable. It just works.

The Winner

Funambol, in my mind, is the clear winner of syncing solutions. Cross-platform, open source, free, nice UI, remote syncing, and solid performance. There are plugins for Blackberry, Palm, Evolution, SugarCRM, Exchange, LDAP, iPod, and quite a few others. I now have my calendar and contacts synced on multiple computers and smart devices. I am happy since I am free of Windows and getting the most out of my smartphone.

Update: damo corrected me, BirdieSync is roughly $27, not $40--thanks damo!

Upgrade to VirtualBox 1.4.0

VirtualBox 1.4.0 was released yesterday, so I thought I would write a very quick guide to installing it in Ubuntu Feisty. My previous post detailed downloading the file directly and several troubleshooting steps. If you run into a problem, check that post out. Add VirtualBox Repository Open up /etc/apt/sources.list (with sudo gedit) and add this line:

deb http://www.virtualbox.org/debian feisty non-free

Add the VirtualBox Public Key

wget http://www.virtualbox.org/debian/innotek.asc
sudo apt-key add innotek.asc

Update Apt and Install

sudo apt-get update
sudo apt-get install virtualbox

If you already installed VirtualBox, you may just need a simple

sudo apt-get upgrade

after adding the repo and updating apt. Troubleshooting If you run into a error when starting VirtualBox, execute a quick:

sudo /etc/init.d/vboxdrv setup

and everything should be fine. Again, look at the previous post if you have a problem.

Getting Involved with Ubuntu

My history with Linux started off with RedHat 9 then moved through Mandrake, Mandriva, openSUSE, and most recently, Ubuntu. I must admit that Ubuntu is by far the most polished/easy to use/accessible distribution yet. I am excited by the progress of the project and the community. Therefore, since I get such a nice operating system to use everyday for free, I want to give something back to the community and get more people involved with Ubuntu. I've been writing quite a few guides to using Ubuntu (or a least tools on Ubuntu); but I have also started getting involved in some Ubuntu projects, most notably VCS Frenzy. I've also updated my Launchpad Profile and my wiki page. Maybe one day I'll get into the respected ubuntu-dev group.

Install Pidgin in Ubuntu

Sure, there are some posts on the Ubuntu Forums with links on how to install a deb package of Pidgin from some untrusted repository. Personally, I'm not too thrilled about using a package that hasn't gone through the community process of being added to Ubuntu. So I have two goals:

  1. Install Pidgin
  2. Show you how to install something from source

Don't be afraid by that last point--a few months ago I was too, but there is no reason to be afraid, because in 7 commands/15 minutes you are going to have Pidgin on your system.

Get the dependencies

Compiling from source does not get all the dependencies like apt-get does, but luckily I will tell you. From the command line type:

sudo apt-get install libgtk2.0-dev libxml2-dev gettext libnss-dev libnspr-dev

Additionally, if you want spell checking, include libgtkspell-dev in that list. Get the source: In my case 2.0.1 was the latest code, so check out the download page just to make sure. If there is a newer version, download that source version and skip this step:

wget http://easynews.dl.sourceforge.net/sourceforge/pidgin/pidgin-2.0.1.tar.bz2

Now unpack it:

tar xvfj pidgin-2.0.1.tar.bz2
cd pidgin-2.0.1

Configure and Install

Now the part that will take a few minutes between each command.

sudo make install


You installed the latest IM client! Now, you have to remember that it is your responsibility to reinstall anytime a newer version comes out, apt-get will not do it for you. So do this until Ubuntu backports Pidgin or until you upgrade to Gutsy Gibbon.


If you you get an error message like:

configure: error:

You must have the GTK+ 2.0 development headers installed to compile Pidgin.
If you only want to build Finch then specify --disable-gtkui when running configure.

then make sure you installed the dependencies:

sudo apt-get install libgtk2.0-dev

Or if you get:

configure: error:

You must have libxml2 >= 2.6.0 development headers installed to build.

Same thing, install the dependencies:

sudo apt-get install libxml2-dev

Thanks to amosharper for catching this one:

configure: error:

The msgfmt command is required to build libpurple.  If it is installed on your system, ensure that it is in your path.  If it is not, install GNU gettext to continue.

Again, install the dependencies:

sudo apt-get install gettext

Additionally, if you are getting a warning at the end of configuration that MSN and Google will not work, or if they simple do not work, make sure you have the last two dependencies:

SSL Library/Libraries......... : None (MSN and Google Talk will not work
without SSL!)

Again, install the dependencies:

sudo apt-get install libnss-dev libnspr-dev

Do you want spell checking? If so, you should install libgtkspell-dev with apt-get, then rerun the configure/make/sudo make install.

Open Sourcing RadLex

I finally got a chance today to release part of a project that I have been working on for the past year: RadLex. RadLex is a medical terminology, specifically designed for radiology. I created the servlet and a set of plugins for Protege that aid in the development and distribution of RadLex. We recently decided to open source the plugins, so I have spent the past several days preparing the plugins for a release on Sourceforge. Stay tuned as more documentation is added to the plugins (and stay on the lookout for a new release of the servlet and terminology). Remember, you can already develop an application around the RadLex API. - Wiki user page.


I noticed an interesting project on Planet Ubuntu yesterday--VCSFrenzy. This tool allows you to get desktop notifications of changes to version control systems (VCS). Sure, some VCS let you have hooks that email you whenever a commit occurs--but this tool provides a lightweight and simple method of keeping track of multiple vcs's. So I have started helping Pete work on this project. So far we have support for subversion and bazaar (additionally with mercurial in my branch right now). Stay tuned as this program gets some support for more VCS's and gets some cool new features.

Vista on Ubuntu Using VirtualBox

Check out the new guide to installing VirtualBox 1.4.0 from a repository. This is a guide to installing Microsoft Windows Vista on a Ubuntu Edgy machine using VirtualBox. Note that Feisty is not yet fully supported by VirtualBox, but the edgy package is reported to work in feisty. Certain versions of Vista may be illegal to run in a virtual machine, according to the EULA, namely the Home flavors of Vista.

Get Ready

I like to keep stuff clean, so I am going to download everything to a folder. Adjust according if you decide to not make this folder. At the terminal:

mkdir ~/install_files

Install VirtualBox

Get VirtualBox and the necessary libraries.

cd ~/install_files
sudo apt-get install libxalan110 libxerces27
wget http://www.virtualbox.org/download/1.3.8/VirtualBox_1.3.8_Ubuntu_edgy_i386.deb
sudo dpkg -i VirtualBox_1.3.8_Ubuntu_edgy_i386.deb

If you have any dependancy issues:

sudo apt-get -f install

Add yourself to the vboxusers group. System > Adminstration > Users and Groups > Manage Groups > vboxusers > Properties, click the box next to your user's name. Make sure to restart. If you get an error "VirtualBox kernel driver not accessible, permission problem ...", make sure you are in the vboxusers group and restart your computer. (Logging in and out, did not work for me).

Set Up VirtualBox

From the terminal:


Go through the steps to make a new virtual machine (Click "New"). Remember that Vista has a minimum requirement of 512 MB RAM and 15 GB HD (if you have a powerful system, consider using 1 GB RAM and 20 GB HD, with a dynamic disk). ubuntugeek.com has a screen by screen guide for making a new virtual machine On the settings tab, mount your Vista DVD (or ISO if you have it and want a speedy install). Now just start the virtual machine, and wait about an hour as Vista installs. You won't get any Aero fanciness with a virtual machine (but you should already be running Beryl ...right?)

Install the VirtualBox Additions

From the Devices menu, click "Install Guest Additions"

Get the Missing Network Driver

Microsoft decided to not include the network driver that VirtualBox uses in Vista, so you will have to install it yourself. (Doesn't Microsoft claim that Windows has better driver support than Linux ... ?)

cd ~/install_files
wget http://www.amd.com/us-en/assets/content_type/utilities/V4.51.zip
unzip V4.51.zip -d driver
mkisofs -o driver.iso -R -J driver

In the VirtualBox window, mount driver.iso . Then go to: Control Panel > Hardware and Sound > Device Manager. Right click on Ethernet Controller > Update Driver Software > Browser my computer... Navigate to the CDROM drive, and click ok. Wait a minute... and congratulations, you have installed Vista


I did upgrade to Feisty, but had an issue when upgrading. There seemed to be an issue of upgrading the kernel. I was told to run /etc/init.d/vboxdrv setup, however, this kept on erroring out, which showed a compilation error in /var/lib/vbox-install.log . To rectify the situation, find out what version of the kernel you are running:

uname -r

This should give you what version of the Ubuntu linux kernel you are running. In my case it was "2.6.20-13-386". Now you want to install the kernel headers for your specific version of the kernel. In my case:

sudo apt-get install linux-headers-2.6.20-13-386

Modify the numbers of the end of the apt-get command to match what uname -r tells you! Now, just reinstall the VirtualBox package (I had to do it twice, until I got no errors) that you downloaded earlier,

cd ~/install_files
sudo dpkg -i VirtualBox_1.3.8_Ubuntu_edgy_i386.deb

Now everything should work nicely! If you have any further issues, post them in the comments and I will try to help.

Upgrade to Feisty Fawn from Edgy

Ubuntu 7.04, Feisty Fawn, has just been released, so why not upgrade your machine. To replace all your repositories, at the terminal:

sudo sed -e 's/edgy/feisty/g' -i /etc/apt/sources.list

System Message: WARNING/2 (<string>, line 13)

Explicit markup ends without a blank line; unexpected unindent.

not tried this, directly. I have upgrade from Dapper to Edgy using this method before. So you could upgrade to Edgy first, or go straight to Feisty (if you are brave):

Now update:

sudo apt-get update

If you get any error messages, comment those lines out of /etc/apt/sources.list (make sure you sudo to edit the file). Certain repositories, such as automatix are not ready for Feisty yet. Now upgrade:

sudo apt-get upgrade

You will be asked to keep certain configuration files, it is up to you (I am not responsible if you overwrite your perfectly crafted configuration files). I was only asked for a handful of packages. I may take a while to download and setup (several hours). You can likely let apt download for an hour or two, but then you should be around to answer the configuration questions. I haven't noticed any problems just keeping the old versions... One more command:

sudo apt-get dist-upgrade

This command should be quicker than the plain upgrade, but will still likely take an hour. You likely will have to restart your computer. You should run the update, upgrade, and dist-upgrade apt commands regularly. I have noticed that there are changes almost daily to the packages. You could add something like the following to your crontab. Make sure to get root's crontab, via sudo crontab -e

0 4 * * * apt-get -y update && apt-get -y upgrade && apt-get -y dist-upgrade && apt-get -y clean

This will update your system every night. Congratulations, you are running the latest and greatest version of Ubuntu.

RSS Alarm Clock

I finally managed to get a sound card for an old computer. Now, I can make my Ubuntu Alarm Clock! What better way to wake up each morning, than to have your friendly linux box read the news to you? The techniques that I am using are nothing new (Hak5 did it and some people at the Ubuntu Forums have talked about it). It is pretty simple, just download and install the rss2html.pl file and the necessary perl libaries, then create a bash script and add it to the crontab.

Get the programs

You will need festival and perl. You will also need mplayer if you want to play music. You can do the standard "sudo apt-get install ..." to get these (they were all installed in my basic`edgy <http://www.ubuntu.com/>`_ installation).

I am going to use cpan to install the perl modules. cpan is like apt for perl. You might have to set up cpan if this is your first time using it. If you are asked to set it up, I recommend typing "no" on the first question, and cpan will autoconfigure.

At the terminal:

sudo cpan

This is the cpan terminal, autoconfigure if necessary. It may take a while to install each package. If it says it requires other modules, install them as well.

install XML::RSS
install XML::Parser
install DateTime::Format::Mail
install DateTime::Format::W3CDTF

Create a file called "rss2html.pl" in ~/alarm and put this in it:


#!/usr/bin/perl -w
# rss2html - converts an RSS file to HTML
# It take one argument, either a file on the local system,
# or an HTTP URL like http://slashdot.org/slashdot.rdf
# by Jonathan Eisenzopf. v1.0 19990901
# Copyright (c) 1999 Jupitermedia Corp. All Rights Reserved.
# See http://www.webreference.com/perl for more information
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.

#  ~~~P1mped 0ut l33t hax0r s7yle by d1gital~~~

use strict;
use XML::RSS;
use LWP::Simple;

# Declare variables
my $content;
my $file;

# check for command-line argument
die "Usage: rss2html.pl <lines> (<RSS file> | <URL>)\n" unless @ARGV == 2;

# get the command-line argument
my $arg = shift;

my $lines = $arg;
$arg = shift;
# create new instance of XML::RSS
my $rss = new XML::RSS;

# argument is a URL
if ($arg=~ /http:/i) {
    $content = get($arg);
    die "Could not retrieve $arg" unless $content;
    # parse the RSS content

# argument is a file
} else {
    $file = $arg;
    die "File \"$file\" does't exist.\n" unless -e $file;
    # parse the RSS file

# print the HTML channel

sub print_html {
    my $rss = shift;
    print <<HTML;

    # print the channel items
    my $i = 0;
    foreach my $item (@{$rss->{'items'}})
      next unless defined($item->{'title'});
      print "$item->{'title'}... ... ... ... ...\n";
      if($i==$lines - 1){
       $i = $i + 1;

    print <<HTML;

Play a Random Song

You don't have to do this, but I want to hear a song after the news, so make a file, music.sh in ~/alarm From the Ubuntu Forum


#made by rusl modifying file
#from http://www.macosxhints.com/article.p...51108193636341

# File locations

# Create a temporary logfile of all matches
find $WritingsPath -iregex ".*.mp3" > $TempLog
find $WritingsPath -iregex ".*.ogg" >> $TempLog
find $WritingsPath -iregex ".*.wav" >> $TempLog

# Choose a random line number (any number from 1 to the length of the file)
UpperBound=$(cat $TempLog | wc -l)
RandomLine=$(( $LowerBound + ($UpperBound * $RANDOM) / ($RandomMax + 1) ))

# Use sed to grab the random line
Command=$(sed -n "$RandomLine{p;q;}" "$TempLog")

# open the random line in TextEdit
mplayer "$Command"

Make Your Alarm File

Make a file alarm.sh in ~/alarm


rm -rf alarm.txt
echo "good morning , today is" >> alarm.txt
date >> alarm.txt
echo "From Digg" >> alarm.txt
~/alarm/rss2html.pl 6 http://digg.com/rss/index.xml >> alarm.txt

echo "From Slashdot" >> alarm.txt
~/alarm/rss2html.pl 6 http://rss.slashdot.org/Slashdot/slashdot >> alarm.txt

festival --tts alarm.txt
rm -rf alarm.txt


You can add any number of news sources.

Set Permissions

cd ~/alarm
chmod +x rss2html.pl
chmod +x alarm.sh

Set Your Alarm

Use the crontab to set your alarm. From the terminal:

crontab -e

And paste this into the file:

0 7 * * * /home/USERNAME/alarm/alarm.sh

Further Additions

Hak5 has a script to get the weather.

ClamAV Email Checking on a Shared Host

This guide is designed for users who have a shared hosting account (no root access), namely on DreamHost. We will make use of ClamAV, procmail, and ClamAssassin.

If you add a ~/.procmailrc file to DreamHost, you will likely be unable to use the DreamHost Control Panel's Junk Filtering. Therefore, it is recommended that you check out this excellent SpamAssassin guide and the Dreamhost wiki.

Note that I have installed everything in a ~/packages folder, which the previously mentioned guide does not do, so you should adjust accordingly. I also installed a more recent version of SpamAssassin than the previous guide (3.1.8 vs 3.1.0).

Install ClamAV

mkdir ~/install_files
mkdir ~/packages
cd ~/install_files
wget http://freshmeat.net/redir/clamav/29355/url_tgz/clamav-0.90.1.tar.gz
tar xvzf clamav-0.90.1.tar.gz
cd clamav-0.90.1
./configure --prefix=$HOME/packages --disable-clamav
make install

The --disable-clamav flag allows the package to be installed without a special user for clamav.

Modify Your Environment Variables

In your ~/.bash_profile, add the

export PATH="$HOME/packages/bin:$PATH"

At the console enter:

source ~/.bash_profile

Set up ClamAV

In ~/packages/etc/clamd.conf, comment out the line "Example". In ~/packages/etc/freshclam.conf, comment out the line "Example".

Install ClamAssassin

ClamAssassin is a wrapper for ClamAV for use in procmail.

cd ~/install_files
wget http://drivel.com/clamassassin/clamassassin-1.2.4.tar.gz
tar xvzf clamassassin-1.2.4.tar.gz
cd clamassassin-1.2.4
./configure --prefix=$HOME/packages --disable-clamdscan --enable-subject-rewrite
make install

The --disable-clamdscan flag forces ClamAssassin to use clamscan rather than clamd (you don't have to open any ports for a daemon). The --enable-subject-rewrite[=message] flag prepends an alert[=message] to the subject line of the email. Add an entry to ~/.procmailrc to call ClamAssassin and move the email if a virus is found

# Scan for virii with clamassassin
| $HOME/packages/bin/clamassassin

# Send virus email to special folder
* ^X-Virus-Status: Yes

Update ClamAV

Update with FreshClam in your crontab

crontab -e

Add this line, to update the virus definitions at 1 AM everyday:

0 1 * * * /home//packages/bin/freshclam


Send an email to yourself, you should see the X-Virus-Status header (view all the headers). On thunderbird, go to View > Headers > All. You should see


(Optional) Clean up the install dir

cd ~/install_files
rm -rf *

MediaWiki Markup for WordPress

Just found a nice tool for using MediaWiki's markup inside of Wordpress at Zech's Blog. The WYSIWYG editor is Wordpress is nice, but staying at the keyboard with the wiki markup is nice (without the clutter of XHTML). I have started to become a fan of the MediaWiki markup, because it leaves the text of document less cluttered than XHTML. I have recently been working quite a bit on wiki's (RadLex and several Trac installations). I originally coded the RadLex wiki text in XHTML, before I learned about MediaWiki's markup. But picking up the wiki markup was quick and I found reformatting the RadLex page in wiki markup to be much quicker than my first attempt with XHTML (which I have years of experience with).

Update: The plugin does not play well with WP-FLV.