Apache Solr, also called “Searching On Lucene w/Replication,” is an open-source REST-API-based search platform built on Apache Lucene Framework. It is written in Java Language and designed for scalability and fault tolerance. Generally, it is used for enterprise search and analytics use cases. It has a lot of features including full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features, and rich document handling. It also supports distributed, replication, sharing, clustering, and multi-node architecture.

In this post, we will show you how to install Apache Solr on Rocky Linux 8.

Step 1 – Install Java JDK

Apache Solr is written in Java, so Java must be installed on your server. If not installed, you can install it with the following command:

dnf install java-11-openjdk -y

Once installed, verify the Java version using the following command:

java --version

You should get the following output:

openjdk 11.0.12 2021-07-20 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.12+7-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.12+7-LTS, mixed mode, sharing)

You will also need to install the EPEL repository on your server. You can install it with the following command:

dnf install epel-release -y

Step 2 – Download Apache Solr

By default, Apache Solr is not included in the Rocky Linux default repository, so you will need to download it from their official website.

You can download it with the following command:

wget https://downloads.apache.org/lucene/solr/8.11.0/solr-8.11.0.tgz

Note: Apache frequently updates SOLR, and you may get an error downloading the above version if it’s been updated since the time of writing. Please check https://downloads.apache.org/lucene/solr/ for the latest versions.

Once Apache Solr is downloaded, download the SHA512 checksum using the following command:

wget https://downloads.apache.org/lucene/solr/8.10.0/solr-8.10.0-src.tgz.sha512

Next, calculate the SHA512 checksum of the Apache Solr downloaded file:

gpg --print-md SHA512 solr-8.10.0-src.tgz.sha512

Sample output:

solr-8.9.0.tgz: 15150B7F 191FD9E8 D2C1BD8B B619DD4B 3F27AF2E 0E94B760 9031F7E7
                45A2E263 391C30F6 8865C208 AFB97CCA A9BDE6D1 6050200E 9BFCCEF6
                5F762C2E D743C242

Next, compare the hash value to the contents of the SHA512 file:

cat 8.10.0-src.tgz.sha512

Sample output:

15150b7f191fd9e8d2c1bd8bb619dd4b3f27af2e0e94b7609031f7e745a2e263391c30f68865c208afb97ccaa9bde6d16050200e9bfccef65f762c2ed743c242 *solr-8.9.0.tgz

After matching the SHA512 hashes, extract the downloaded file with the following command:

tar xzf solr-8.10.0.tgz

Step 3 – Install Apache Solr

Next, run the following command to install Apache Solr to your system:

solr-8.10.0/bin/install_solr_service.sh solr-8.10.0.tgz

Once the installation is complete, you should get the following output:

Solr process 9970 running on port 8983
  "version":"8.10.0 05c8a6f0163fe4c330e93775e8e91f3ab66a3f80 - mayyasharipova - 2021-06-10 17:54:40",
  "uptime":"0 days, 0 hours, 0 minutes, 22 seconds",
  "memory":"31.8 MB (%6.2) of 512 MB"}

At this point, Apache Solr is running and listens on port 8983. You can check it with the following command:

ss -altnp | grep 8983

Sample output:

LISTEN 0      50                      *:8983            *:*    users:(("java",pid=9970,fd=153))                       

Step 4 – Configure Firewall

If a firewalld firewall is installed and running on your server, then you will need to allow port 8983 through firewalld. You can enable it with the following command:

firewall-cmd --add-port=8983/tcp --permanent

Next, reload the firewall using the following command:

firewall-cmd --reload

Step 5 – Access Apache Solr

Before accessing Apache Solr, create a test collection using the following command:

su - solr -c "/opt/solr/bin/solr create -c testcollection -n data_driven_schema_configs"

Sample output:

Created new core 'testcollection'

Now, open your web browser and access the Apache Solr web interface using the URL http://your-server-ip:8983. You should see the Apache Solr dashboard on the following page:
Apache Solr Dashboard


Congratulations! You have successfully installed Apache Solr on RockyLinux 8. You can now integrate Apache Solr with your application for search functionality. Get started on a dedicated server from Atlantic.Net today!