Logo

NXLucene installation guide

Last modified: 10/18/2006 05:53 PM

logosmall.jpg

NXLucene Installation

Author: Julien Anguenot
Revision: INSTALL.txt 49615 2006-10-16 14:22:24Z janguenot

1   Requirements

  • Linux based operating system. NXLucene is using PyLucene and PyLucene is reported to work on windows and macos. It means running NXLucene on those platformes should be possible though. This is just not supported right now. You're welcome contributing installers for those platforms.

  • Building NXLucene requires GNU's compiler for Java, GCJ as PyLucene requires it. Use gcc-3.4.6. This is the only branch reported as working well on all the different Linux distributions. If you can choose your Linux distribution on which you are going to run NXLucene, I would advice you to choose the leading one which is Redhat or Fedora. Reason is simple : redhat do pay GCC devels.

    If your distributions doesn't come with one of the above disributions you can installed a version aside against which you will compile PyLucene. (see the Installation section)

  • Python-2.4.x installed.

  • PyLucene == 1.9.1.

  • ZopeInterface >= 3.0.1. This depends of the Twisted requirements. Note one version is embedded with NXLucene. You might install this one on your Python.

  • Twisted >= 2.2.0

  • TwistedWeb >= 0.5 : twisted.web is now package as a separted component by the twisted guys.

  • ElemenTtree and cElementTree >= 1.2.6-20050316

See the troubleshooting section if you are having errors at startup or while launching tests with the PyLucene installation.

2   Installation

Linux is currently the only supported and tested platform. See the requirements section above for more information.

Install GCC from source

$ cd /tmp
$ wget ftp://ftp.uvsq.fr/pub/gcc/releases/gcc-3.4.6/gcc-3.4.6.tar.bz2
$ mkdir gcc-3.4.6
$ cd gcc-3.4.6
$ bunzip2 -c ../gcc-3.4.6.tar.bz2 | tar -xvf -
$ mkdir build
$ cd build
$ ../gcc-3.4.6/configure --enable-threads=posix \
  --prefix=/usr/local/gcc-3.4.6 --enable-languages=c,c++,java
$ make bootstrap
$ sudo make install

Install PyLucene from source

For more information about the actual PyLucene installation see :

http://svn.osafoundation.org/pylucene/trunk/INSTALL

Installation on a Linux box

$ cd /tmp
$ wget http://downloads.osafoundation.org/PyLucene/src/PyLucene-src-1.9.1.tar.gz
$ tar -xzf PyLucene-1.9.1.tgz
$ cd PyLucene-1.9.1
$ vim Makefile

Here, edit the Makefile and change the configuration for your Linux system.

Basically, swig, Python and GCC locations. You should end up with something like this for the Linux section

# Linux
PREFIX=/usr/local
PREFIX_PYTHON=$(PREFIX)
SWIG=/usr/bin/swig
GCJ_HOME=/usr/local/gcc-3.4.6
GCJ_VER=3
#DB=$(PYLUCENE)/db-$(DB_VER)
#PREFIX_DB=$(PREFIX)/BerkeleyDB.$(DB_LIB_VER)
ANT=ant

$ make
$ sudo make install

Note, you do not need any bdb suport since NXLucene doesn't provide any support for it.

You can test out your PyLucene installation by running the tests

$ export LD_LIBRARY_PATH=/usr/local/gcc-3.4.6/lib
$ make test

You should not get any errors.

Install Python dependencies for NXLucene

Every Python dependencies can be easily installed using the following command

$ python setup.py build
$ sudo python setup.py install

Please, check the dependencies list above.

Install NXLucene

Uncompress the NXLucene archive

$ cd /usr/local/
$ tar -xzf /tmp/NXLucene-x.x-x.tgz

In the resulting folder

$ python setup.py build
$ sudo python setup.py install

This will install the core NXLucene libs within the site-packages of the Python interpertor. They might be useful for Python third party apps. Especially, the nxlucene.rss sub-module.

Add the gcj shared libs in the path

$ export LD_LIBRARY_PATH=/usr/local/gcc-3.4.6/lib

You can now start the NXLucene server

$ cd ./bin
$ ./nxlucened start

3   For administrators

Below are the needed steps to add NXLucene within your startup tables.

I assume an installation within /usr/local/NXLucene for instance.

As root :

Create a link on the startup script within the /etc/init.d

$ cd /etc/init.d/
$ ln -s /usr/local/NXLucene/bin/nxlucened .

Edit nxlucend and change the NXLUCENE_HOME value reflecting your installation. In our case, NXLUCENE_HOME=/usr/local/NXLucene.

Add nxlucened within the system startup table

$ /sbin/chkconfig --level 2345 nxlucened on

Server runs on port 9180 by default. You may change this within etc/nxlucene.conf

4   Testing for developpers

When working from a NXLucene checkout, do an in-place build instead:

$ python setup.py build_ext -i

followed by:

$ export LD_LIBRARY_PATH=/usr/local/gcc-3.4.6/lib
$ ./test.py -vk -s nxlucene

The test runner is a zope.testing runner. Use --help for all available options.

This command will run all the tests, printing a single dot for each test. When it finishes, it will print a test summary. The exact number of tests can vary depending on platform and available third-party libraries.:

Running tests from src
Running tests at level 1
Running unit tests:
  Running:
    ..................................................
    .
  Ran XX tests with 0 failures and 0 errors in 14.796 seconds.

5   Troubleshooting

If you need support check the cps-devel list

5.1   Python and unicode problem

Some distributions raise the error below while launching the tests above

Traceback (most recent call last):
  File "src/nxlucene/tests/test_xmlrpc_server.py", line 25, in ?
    import nxlucene.testing.xmlrpc
  File "src/nxlucene/testing/xmlrpc.py", line 28, in ?
    from nxlucene.core import LuceneServer
  File "src/nxlucene/core.py", line 25, in ?
    import PyLucene
File "/home/janguenot/NXLucene/src/PyLucene/python/PyLucene.py",
    line 4, in ?  import _PyLucene
ImportError:
/home/janguenot/NXLucene/src/PyLucene/python/_PyLucene.so: undefined
symbol: PyUnicodeUCS2_FromUnicode

The reason is that the binaries are commpiled with UCS2 support. If your system has en ICS4 support then this error will occur.

In this case you have 2 options :

  • Recompile a PyLucene version from source your system can support with UCS2 support. (Ubuntu users you will have to do that)

  • Install a second Python for your own programs and leave the system Python alone.

    You will certainly have to change the specified nxlucened Python interpretor in this case.

5.2   TwistedWeb missing dependencies

If you get the error below while launching the tests it means your twisted installation is incomplete. Your Python installation is missing TwistedWeb. (See the dependencies on top of this file):

Traceback (most recent call last):
  File "src/nxlucene/tests/test_xmlrpc_server.py", line 25, in ?
    import nxlucene.testing.xmlrpc
  File "src/nxlucene/testing/xmlrpc.py", line 27, in ?
    from nxlucene.xmlrpc import XMLRPCLuceneServer
  File "src/nxlucene/xmlrpc.py", line 24, in ?
    from twisted.web import xmlrpc
ImportError: No module named web

5.3   Lucene store directory

DO NOT create the store directory yourself, let NXLucene do it, just make sure the user lauching the process has enough rights to do so.

In case the directory exists but is empty, the server will fail and show logs like:

LuceneServer - INFO - Request <PyLucene.BooleanQuery; proxy of C++
org::apache::lucene::search::BooleanQuery instance at <PyCObject object at
0xb6106b18>> failed...

5.4   Analysers

If you are working with the French analyzer for instance, make sure the user running NXLucene has read rights on executable files and others like text files listing stop words.

This site is powered by CPS, which includes CPSSkins. CPS and its design are Copyright © 2002-2006 Nuxeo SAS.
CPSSkins is Copyright © 2003-2006 Jean-Marc Orliaguet.
powered_by_nuxeo.png