Orbited is an open-sourced scalable HTTP daemon specifically targeted at long lasting comet connections via AJAX. It’s Python based and allows you to write server side code in Python to extend the functionality of incoming and outgoing content. While there is a work around to get Orbited working on Python 2.4, it is written in 2.5 and I would rather go with the intended setup.

This post will give you a quick step by step guide to get Python 2.5 installed on CentOS 5, with Twisted and Orbited.

The first step is to install Python 2.5. Sadly, we can’t simply update the Python 2.4 that comes stock with CentOS 5 as it is required for yum to work properly. To get around this we will be installing a parallel version of Python 2.5. This part of the setup is using the parallel install of Python as described and created by Geekymedia.com.

This first step will set up our environment to download to which is in /opt/install. Obviously this can be changed and is not required. We then will download all the required files as created by Geekymedia.com. The last step is to install them locally and by using yum we can take care of any dependencies required.

# mkdir -p /opt/install/python25
# cd /opt/install/python25
# for PACKAGE in python25-2.5.1-bashton1.i386.rpm \
               python25-debuginfo-2.5.1-bashton1.i386.rpm \
	       python25-devel-2.5.1-bashton1.i386.rpm \
	       python25-libs-2.5.1-bashton1.i386.rpm \
	       python25-test-2.5.1-bashton1.i386.rpm \
	       python25-tools-2.5.1-bashton1.i386.rpm \
	       tkinter25-2.5.1-bashton1.i386.rpm; \
   do wget http://mirrors.geekymedia.com/centos/$PACKAGE; done
# sudo yum --nogpgcheck localinstall *.rpm

Please note that since you have installed it in parallel and without taking over the main Python package already installed, you will need to use python25 as opposed to python when you want to run packages within this version.

Next we want to install Twisted. Twisted is an event-driven networking engine written in Python and is required for Orbited to work. This next step will create the build environment, download the required package and install it.

# mkdir -p /opt/installs/twisted
# cd /opt/installs/twisted
# wget http://tmrc.mit.edu/mirror/twisted/Twisted/9.0/Twisted-9.0.0.tar.bz2
# tar -xjvf Twisted-9.0.0.tar.bz2
# cd Twisted-9.0.0
# python25 setup.py install

Now we move on to installing Orbited. This time we will be getting the ez_setup script to aide in the install process.

# mkdir -p /opt/installs/Orbited
# cd /opt/installs/Orbited
# wget http://peak.telecommunity.com/dist/ez_setup.py
# python25 ez_setup.py setuptools
# easy_install orbited

We also need to obtain a default config file for Orbited and put that in /etc.

# cd /etc
# wget http://orbited.org/export/675/trunk/daemon/orbited.cfg

Last but not least, we will want to test our Orbited install to ensure it works.

# python25
>>> import orbited
>>> quit()

If no errors are reported after you do import orbited than all went as planned!

One last thing to note. On the Orbited installation instructions page, they mention that Orbited relies on a package called demjson for encoding JSON data. They suggest installing a C-based JSON library such as cjson or simplejson for improved performance. This can be done using easy_install from earlier:

# easy_install python-cjson

or

# easy_install simplejson

Update:
Seems that even though the package install works fine; you may encounter an error when you actually run Orbited. The error is in regards to zope.interface not being found. To install zope.interface do the following:

# mkdir /opt/installs/zopeinterface
# cd /opt/installs/zopeinterface
# wget http://www.zope.org/Products/ZopeInterface/3.3.0/zope.interface-3.3.0.tar.gz
# tar -xzvf zope.interface-3.3.0.tar.gz
# cd zope.interface-3.3.0
# python25 setup.py build
# python25 setup.py install