How to install Lucene-search

sudo apt-get install -y subversion ant openjdk-7-jdk sudo update-alternatives --set java /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java sudo mkdir /usr/local/search sudo mkdir /usr/local/search/ls2 sudo chown www-data /usr/local/search/ls2 sudo su www-data cd /usr/local/search/ls2 svn co https://svn.wikimedia.org/svnroot/mediawiki/trunk/lucene-search-2/ cd lucene-search-2 ant ./configure /srv/mediawiki ./build This will take quite a while for building the initial version of the search index. Next a startup script and an update script should be installed. For me it took about 30 minutes: Finished making spell-check index in 11m 46s Finished build in 20m 28s The startup script comes from http://ubuntuforums.org/showthread.php?p=12478976#post12478976 in a root shell type sudo vi /etc/init.d/lsearchd in vi press 'i' for insert and paste the following script #!/bin/sh -e ### BEGIN INIT INFO # Provides: lsearchd # Required-Start: $syslog # Required-Stop: $syslog # Default-Start: 2 3 4 5 # Default-Stop: 1 # Short-Description: Start the Lucene Search daemon # Description: Provide a Lucene Search backend for MediaWiki. Copied by John Ericson from: http://ubuntuforums.org/showthread.php?t=1476445 ### END INIT INFO # Set to install directory of lucense-search. For example: /usr/local/lucene-search-2.1.3 LUCENE_SEARCH_DIR="/usr/local/search/ls2/lucene-search-2" # Set username for daemon to run as. Can also use syntax "username:groupname" to also specify group for daemon to run as. For example: me:me RUN_AS_USER="www-data" OPTIONS="" test -x $LUCENE_SEARCH_DIR/lsearchd || exit 0 test -n "$RUN_AS_USER" && CHUID_ARG="--chuid $RUN_AS_USER" || CHUID_ARG="" if [ -f "/etc/default/lsearchd" ] ; then . /etc/default/lsearchd fi . /lib/lsb/init-functions case "$1" in start) cd $LUCENE_SEARCH_DIR log_begin_msg "Starting Lucene Search Daemon..." start-stop-daemon --start --quiet --oknodo --chdir $LUCENE_SEARCH_DIR --background $CHUID_ARG --exec $LUCENE_SEARCH_DIR/lsearchd -- $OPTIONS log_end_msg $? ;; stop) log_begin_msg "Stopping Lucene Search Daemon..." start-stop-daemon --stop --quiet --oknodo --retry 2 --chdir $LUCENE_SEARCH_DIR $CHUID_ARG --exec $LUCENE_SEARCH_DIR/lsearchd log_end_msg $? ;; restart) $0 stop sleep 1 $0 start ;; reload|force-reload) log_begin_msg "Reloading Lucene Search Daemon..." start-stop-daemon --stop -signal 1 --chdir $LUCENE_SEARCH_DIR $CHUID_ARG --exec $LUCENE_SEARCH_DIR/lsearchd log_end_msg $? ;; status) status_of_proc $LUCENE_SEARCH_DIR/lsearchd lsearchd && exit 0 || exit $? ;; *) log_success_msg "Usage: /etc/init.d/lsearchd {start|stop|restart|reload|force-reload|status}" exit 1 esac exit 0 now you can start the search and install the lucene deamon via sudo chmod +x /etc/init.d/lsearchd sudo /etc/init.d/lsearchd start sudo update-rc.d lsearchd defaults Install the extension cd /srv/mediawiki/extensions git clone https://git.wikimedia.org/git/mediawiki/extensions/MWSearch.git and add the following config to the Localsetting require_once( "$IP/extensions/SpamBlacklist/SpamBlacklist.php" ); $wgSearchType = 'LuceneSearch'; $wgLuceneHost = 'localhost'; #IP address of server $wgLucenePort = 8123; require_once( "$IP/extensions/MWSearch/MWSearch.php" ); # comment this out if you are using the old version 2.0 # (MUST be AFTER the require_once!) $wgLuceneSearchVersion = 2.1;

Comments

sun java

if you have problems obtaining sun-jre you can use sun-java6-jre instead