Installing and Enabling Elasticsearch for Koha on Ubuntu Server

Share this post on:

ElasticSearch is a distributed and highly available open-source search engine built on top of Apache Lucene. It’s open-source, built in Java, and thus, is known for many platforms. You store unstructured data in JSON format, making it a NoSQL database. So, unlike other NoSQL databases, ElasticSearch also provides search engine capabilities and other related features.

Elasticsearch, a powerful search engine compatible with Koha, offers enhanced speed, reliability, and scalability. Follow these steps to install and enable Elasticsearch for Koha seamlessly on an Ubuntu 22.04 server running Koha version 23.05.

1. Install OpenJDK

To begin, install OpenJDK 11, which is necessary for Elasticsearch:

sudo apt-get install openjdk-11-jdk-headless

2. Install Koha-Elasticsearch Package

Next, install the koha-elasticsearch package:

sudo apt-get install koha-elasticsearch

3. Install Elasticsearch Version 6.x

Note: Elasticsearch version 6.x is compatible with the latest version of Koha. Do not upgrade beyond this version. Perform the following steps to install version 6.x. Here’s a step-by-step breakdown:

  • Import the Elasticsearch GPG key:

sudo wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -

  • Add Elasticsearch repository to sources list:

sudo echo "deb https://artifacts.elastic.co/packages/6.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-6.x.list

  • Update and upgrade your system:

sudo apt-get update && sudo apt-get upgrade

  • Install Elasticsearch:

sudo apt-get install elasticsearch

4. Enable and Restart Elasticsearch Service

Enable and restart the Elasticsearch service using the following commands:

sudo /bin/systemctl daemon-reload
sudo /bin/systemctl enable elasticsearch.service

5. Install the analysis-icu Plugin

The analysis-icu plugin is required for Elasticsearch. Install it using:

sudo /usr/share/elasticsearch/bin/elasticsearch-plugin install analysis-icu

6. Restart Elasticsearch Service

After installing the plugin, restart the Elasticsearch service:

sudo service elasticsearch restart

7. Enable Elasticsearch on Koha Administration Screen

Navigate to Koha’s administration panel:

Administration > Global system preferences > Administration > Search engine

Enable Elasticsearch in the Search engine settings.

8. Rebuild Search Index

Finally, rebuild the search index for Koha using the following command:

sudo koha-elasticsearch --rebuild --verbose -d library

These steps ensure Elasticsearch is appropriately installed and integrated with Koha on your Ubuntu server, optimizing search functionality for your library system. Elasticsearch is a powerful tool that can help to make your Koha OPAC searchable effectively by providing robust features to return the most accurate and quick result set. This is the installation guide. The more settings can be tweaked with Elasticsearch. For more information, please refer to the official documentation on koha and Elasticsearch.

Author: Rupinder Singh

I am a tireless intelligence seeker, coincidentally I am a computer guy too, who is passionate about Information Tools and Open-Source software. I Read Books, play Computer Games, Climb Mountains, when I am not changing the code.

View all posts by Rupinder Singh >

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.