In this tutorial, we will show you how to install Apache Solr on CentOS 8. For those of you who didn’t know, Apache Solr is an open-source search platform written on Java. It is based on Apache Lucene and is written in Java. Just like Elasticsearch, it supports database queries through REST APIs. Solr aims at providing distributed indexing, replication, and load-balanced querying with automated failover and recovery.
This article assumes you have at least basic knowledge of Linux, know how to use the shell, and most importantly, you host your site on your own VPS. The installation is quite simple. I will show you through the step by step installation of Apache Solr in CentOS 8.
Install Apache Solr on CentOS 8
Step 1. First, let’s start by ensuring your system is up-to-date.
sudo dnf install epel-release sudo dnf update
Step 2. Installing Java on CentOS 8.
Currently, there are two LTS versions of OpenJDK – OpenJDK 8 and OpenJDK 11. You can also install the both Java version on any system and use as per your requirements.
- Installing OpenJDK 11.
sudo dnf install java-11-openjdk-devel
- Installing OpenJDK 8.
sudo dnf install java-1.8.0-openjdk-devel
Verify Java version:
Step 3. Installing Apache Solr on CentOS 8.
Now we download the latest version of Apache Solr from the Apache official website:
tar the file using the following command:
tar xzf solr-8.7.0.tgz solr-8.7.0/bin/install_solr_service.sh --strip-components=2
After that, use the extracted installation script to install Apache Solr on your CentOS system:
sudo bash ./install_solr_service.sh solr-8.7.0.tgz
It will start the installation, be patient until the process complete. Apache Solr service is managed under systemd services. Use the following commands to Start, Stop and check the status of Solr service:
sudo systemctl enable solr sudo systemctl start solr sudo systemctl status solr
Step 4. Configure Firewall.
If you use Firewall add a rule to allow access to Solr’s admin section and query Solr data:
sudo firewall-cmd --add-port=8983/tcp --permanent sudo firewall-cmd --reload
Step 5. Accessing Apache Solr on CentOS.
Apache Solr will be available on HTTP port 8983 by default. Access Solr dashboard in your web browser using server ip address or hostname with 8983 port:
Congratulations! You have successfully installed Apache Solr. Thanks for using this tutorial for installing Apache Solr on your CentOS 8 system. For additional help or useful information, we recommend you to check the official Apache Solr website.