How to Install Apache Solr on CentOS 8

Install Apache Solr on CentOS 8

In this article, we will have explained the necessary steps to install and configure Apache Solr on CentOS 8. Before continuing with this tutorial, make sure you are logged in as a user with sudo privileges. All the commands in this tutorial should be run as a non-root user.

Apache Solr is a professional search server created in Java and sponsored by the Apache Foundation. It is used to store data and query it in near real-time. It is a most popular search engine that provides distributed indexing, replication, load balancing with automated failover, and recovery. It supports database queries through REST APIs like Elasticsearch.

Install Apache Solr on CentOS 8

Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.

sudo dnf install epel-release
sudo dnf update

Step 2. Install Java.

Java is one of the requirements for installing the latest Apache Solr. Run the following command to install it:

sudo dnf install java-latest-openjdk

After successful installation, verify the Java version:

[[email protected] ~]# java -version
openjdk version "11.0.9" 2021-01-06 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.9+11-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.9+11-LTS, mixed mode, sharing)

Step 3. Download and Install Apache Solr on the CentOS system.

Now we download the required Solr version from its official site:

tar xzf solr-8.7.0.tgz

Next, execute the command below to install Apache Solr on CentOS 8:

solr-8.7.0/bin/ solr-8.7.0.tgz

This will create an account named Solr on your system and finish the installation process. After that start the service default Solr port 8983.

Apache Solr service is managed under systemd services. Use the following commands to Start, Stop, and check the status of Solr service:

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

Step 4. Configure Firewall.

By default Solr runs on port 8983. If you have an active firewall, allow port 8983:

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

Step 5. Create a Solr Collection.

You can now create your first Solr collection:

sudo su - solr -c "/opt/solr/bin/solr create -c linuxcollection -n data_driven_schema_configs"

Sample output:

INFO - 2021-01-06 13:48:05.538; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
Created new core 'linuxcollection'

Step 6. Accessing the Apache Solr Admin Panel.

You can access the Apache Solr web interface using the URL http://your-server-ip-address:8983. You should see the Apache Solr web interface on the following screen:

Install Apache Solr on CentOS 8

That’s all you need to do to install Apache Solr on CentOS 8. I hope you find this quick tip helpful. For further reading on Apache Solr, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.