Skip to main content

In this article I'll walk through the steps I went through to install Solr on Ubuntu.

 

Step 1: Java

Check if Java is installed on your server:

java -version

Not there - then Java is the first step for you to set up for Solr.  JAVA SE 8 or Later is required to run Apache Solr 8.  Utilisation taking after order to check in the event that you have Java introduced as of now on your system.

sudo apt install openjdk-11-jdk

Version check again and you now will get a response like:

openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu120.04)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Ubuntu-0ubuntu120.04, mixed mode, sharing)

 

Step 2: Download & Extract Solr 8.11.2

You can download the latest version of Apache Solr from the official website or use the following command to download the Apache Solr.  I'm not going to use the latest as CKAN at this stage doesn't use v9.  So cross-check with your other installations what version suits.

wget https://dlcdn.apache.org/solr/solr/8.11.2/solr-8.11.2.tgz?action=download

To download the tar file you will need to add ?action=download as the suffix.  However, doing this action has an impact on the directory naming:

drwxr-xr-x 5 root     root      4096 Aug 15 01:22  omi
-rw-r--r-- 1 root     root 218171227 Jun 13 18:19 'solr-8.11.2.tgz?action=download'

Use the move command to correct the filename

mv 'solr-8.11.2.tgz?action=download' solr-8.11.2.tgz

Now you can extract tar file:

tar xzf solr-8.11.2.tgz solr-8.11.2/bin/install_solr_service.sh –strip-components=2

Install Solr

./install_solr_service.sh solr-8.11.2.tgz

This action will create the account with the name of Solr on your system... using port 8983.

 

Step 3 – Manage Solr Service

Solr is configured as a service on your system. Therefore, use the following commands to Start, Stop and check the status:

sudo systemctl stop solr 
sudo systemctl start solr
sudo systemctl status solr

 

Step 4 – Create a core

So far so good.  Let's now create a collection in Apache Solr using the following command:

sudo su - solr -c "/opt/solr/bin/solr create -c {collection_name} -n data_driven_schema_configs"

Replacing {collection_name} with the name of the collection you want to generate.  As an example, using a collection name of codenames, the response will be:

Created new core 'codenames'

 

Step 5 – Access Solr panel

Ok, you have installed and fired up Solr.  Let's now see if you can access it via a browser.  The port to access is 8983.  Using your IP Address or hostname, add :8983 at the end.  Used as

https://your_IP_Address:8983

 

 

Related articles

Andrew Fletcher09 Jun 2024
Overcoming startup challenges with Apache Solr on Ubuntu 24.04
Recently, after upgrading to Ubuntu 24.04, we encountered a significant challenge with our Apache Solr service—it refused to restart. This post documents the steps I took to diagnose and resolve the issues, providing a clear guide for anyone facing similar troubles. Initial troubleshootingThe...