This is a brief outline of how to get, install, and use
the Lucene search engine in Linux.
Note: You must already have java installed on your Linux
Get the .jar files
Lucene is written in Java. For basic usage, we can use
the pre-compiled .jar files available from either the
web site, or one of the mirror sites
As of this writing, lucene-2.1.0.tar.gz is a gzipped-tar file with
the most recent .jar files.
In your Linux account, create a directory called lucene.
Download the lucene-2.1.0.tar.gz file and place it in the lucene directory.
Unpack the .tar.gz file in the lucene directory:
tar xvzf lucene-2.1.0.tar.gz
This should create a lucene-2.1.0 directory that contains
the Lucene .tar files.
cd into this directory and make sure these two files are present:
Set your CLASSPATH
Since Lucene is written in Java, you must set the CLASSPATH environment
variable so that Java will know where to find the Lucene classes.
If you are using the bash shell, the following command can be used
(replace youraccount with your account login name):
Note: you can copy and paste this command as-is into a bash shell.
However, if you are TYPING it, you should type it as ONE line
and NOT INCLUDE the '\' characters at the end of the first two lines.
Select a directory that has files that you would like to index.
cd to that directory and type the following command:
java org.apache.lucene.demo.IndexFiles .
This will create an index of the files in that directory
and its subdirectories.
To search the index, type:
And type in a query at the prompt.
For more details of how these programs work,
Building and Installing the Basic Demo
on the Apache Lucene web site.