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. It REST-like HTTP/XML and JSON APIs makes it usable from most other popular programming languages.
This tutorial will help you to install Apache Solr 8.5 on Ubuntu 20.04 LTS systems.
First of all, login 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 fulfill Java requirements of Apache Solr. If you don’t have java installed on your system visit below articles.
sudo apt install openjdk-8-jdk
Verify active Java version:
java -version openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09) OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
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.5.2.
cd /opt wget https://archive.apache.org/dist/lucene/solr/8.5.2/solr-8.5.2.tgz
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.5.2.tgz solr-8.5.2/bin/install_solr_service.sh --strip-components=2 sudo bash ./install_solr_service.sh solr-8.5.2.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 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 run 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.