Install Apache Solr search platform on CentOS 8
Apache Solr is an open source search platform written in Java. Apache Solr is built on Apache Lucene. With Solr, you can create a custom search engine to index files, databases, and websites. Solr has a high degree of reliability, scalability and fault tolerance, and will provide many powerful features, such as distributed indexing, replication, load balancing queries, automatic failover and recovery, centralized configuration management and more enterprise functions.
Solr handles many types of data types, such as JSON, XML, many Office document types, CSV, etc.
In this tutorial, we will show you how to install Apache Solr 8.6.3 on CentOS 8.
A server running CentOS 8. A non-root user with sudo privileges is set up on the server.
Step 1: Install Java
Before we begin, let us update our system by running the following commands.
sudo dnf update
For the latest Apache Solr, we need to install Java 8 or higher.
First, we check whether Java is already installed in the machine by issuing the following command:
If Java is not installed, run the following command:
sudo dnf install java-11-openjdk
After installing Java, we can verify it by running the following command:
openjdk version "11.0.8" 2020-07-14 LTSOpenJDK Runtime Environment 18.9 (build 11.0.8+10-LTS)OpenJDK 64-Bit Server VM 18.9 (build 11.0.8+10-LTS, mixed mode, sharing)
Step 2: Install Apache Solr on CentOS 8
First, we need to download the latest version of Apache Solr from the official Apache website https://downloads.apache.org/lucene/solr/.
We can easily download it using the wget command:
Now, we use the following command to extract the tar file:
tar xzf solr-8.6.3.tgz solr-8.6.3/bin/install_solr_service.sh --strip-components=2
Now, install Solr as a service by running the following command:
sudo bash ./install_solr_service.sh solr-8.6.3.tgz
It will start the installation and we should see the following output:
It will create an account named solr on the system. By default, the Solr port is 8983. We can use the following command to verify:
netstat -tunelp | grep 8983
We should get the following output:
tcp6 0 0 :::8983 :::* LISTEN 974 38261 -
Apache Solr runs as a Systemd service. We can easily start | stop | restart the Solr service with the following command:
systemctl start solrsystemctl stop solrsystemctl restart solr
To check the status of the Apache Solr service, run the following command:
systemctl status solr
Now we enable the solr service by running the following command:
systemctl enable solr
Note:-We need to disable SELinux, edit the following file to disable SELinux permanently
And set as follows
SELINUX = disableds save and exit
Step 3: Firewall
By default, Solr listens on port 8983, so we will need to allow this port through the firewall.
We can do this by running the following command:
sudo firewall-cmd --zone=public --add-port=8983/tcp --permanentsudo firewall-cmd --reload
Step 4: Access Solr Web interface
Now that we have enabled access through the firewall, it is time to access the Solr web interface.
In the web browser, enter the URL
https://your-server-ip:8983/solr . We should see the Solr dashboard as follows:
Step 5: Create your first Solr collection
After successfully installing the Apache Solr service on our system, let us run the following command as root to set the password of the solr user
A collection is a logical index distributed on multiple servers.
Now, we will create the first collection using the following command.
su - solr -c "/opt/solr/bin/solr create -c testconnection -n data_driven_schema_configs"
Created new core 'testconnection'
This “testconnection” collection can be found on the dashboard on the left panel of the “Collection”.
In this tutorial, we learn how to install and configure Apache Solr in centos 8. It supports many plugins and many other functions. You can use this tool to take full advantage of the potential of vertical search. For more information, please visit the official Apache Solr website. https://lucene.apache.org/solr/