Apache Solr is an open-source search platform written on Java. Solr provides full-text search, spell suggestions, custom document ordering and ranking, Snippet generation, and highlighting. Apache Solr runs as a standalone full-text search server. Its REST-like HTTP/XML and JSON APIs make it usable from most other popular programming languages.
This tutorial will help you to install Apache Solr 8.9.0 on Ubuntu 20.04 LTS systems.
First of all, log in to your Ubuntu system with sudo privileged account. Now, run the below command to upgrade the current packages on your system.
sudo apt update && sudo apt upgrade
Step 1 – Installing Java
Apache Solr 8 required Java 8 or greater to run. Make sure your system fulfills the Java requirements of Apache Solr. If you don’t have java installed on your system, execute the following command:
sudo apt install openjdk-11-jdk
Verify active Java version:
java -versionopenjdk version "11.0.11" 2021-04-20 OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04) OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)
You can also follow this tutorial to install Java on Ubuntu Linux.
Step 2 – Install Solr on Ubuntu
Now download the required Solr version from its official site or mirrors. Or simply use the following command to download Apache Solr 8.9.0 on your system.
Then, extract Apache Solr service installer script from the downloaded Solr archive file. Run the installer followed by the archive file as below:
tar xzf solr-8.9.0.tgz solr-8.9.0/bin/install_solr_service.sh --strip-components=2 sudo bash ./install_solr_service.sh solr-8.9.0.tgz
Step 3 – Manage Solr Service
Solr is configured as a service on your system. You can simply use the following commands to Start, Stop and check the status of the Solr service.
To view the status of solr server, type:
sudo systemctl status solr
Use following commands to stop and start Apache solr service:
sudo systemctl stop solr
sudo systemctl start solr
Step 4 – Create Collection in Solr
After the successful installation of Solr on your system. Create the first collection in Apache Solr using the following command.
sudo su - solr -c "/opt/solr/bin/solr create -c mycollection -n data_driven_schema_configs"
Created new core 'mycollection'
Step 5 – Access Solr Admin Panel
The default Apache Solr runs on port 8983. So, you can access your Solr service to this port in your web browser using server IP or domain name.
Now, select “mycollection” under Core Selector drop down in left sidebar. This will show you the statics of the selected collection.
In this tutorial, you have learned to install Apache Solr on Ubuntu 20.04 LTS system. Also created a collection in the Solr.