Apache Solr is an open source platform written in Java. Apache Solr is based on Apache Lucene. With Solr you can create custom search engines that index files, databases and websites. Solr is highly reliable, scalable and fault-tolerant that provides many powerful features such as distributed indexing, replication, load-balanced query, automated redundancy and recovery, centralized configuration management and many more enterprise functions.
Solr handles many types of data types such as JSON, XML, many office document types, CSV and more.
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 set on your server.
Step 1: Install Java
Before we start, let’s update our system by running the following command.
sudo dnf update
For the latest Apache Solr, we need to install Java 8 or higher.
First, we check if Java is already installed in our machine by issuing the following command:
If Java is not installed, run the following command:
sudo dnf install java-11-openjdk
Once Java is installed, we can verify it by running the following command:
openjdk version "11.0.8" 2020-07-14 LTS
OpenJDK 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 with the command wget:
Now we extract the tar file with the following command:
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 starts the installation. We should see the following output:
It creates the account named solar on your system. By default, the Solr port is 8983. We can verify it with the following command:
netstat -tunelp | grep 8983
We should get the following results:
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 commands:
systemctl start solr
systemctl stop solr
systemctl restart solr
To check the status of the Apache Solr service, run the following command:
systemctl status solr
We now activate the solar 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 the following
SELINUX = disabled
save and exit
Step 3: Firewall
By default, Solr listens to port 8983, so we 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 --permanent
sudo firewall-cmd --reload
Step 4: Access the Solr web interface
Now that we have activated access via the firewall, it is time to access the Solr web interface.
Enter the URL in the browser
http://your-server-ip:8983/solr. We should see the Solr instrument panel as below:
Step 5: Create your first Solr collection
After successfully installing the Apache Solr service on our system, let’s set the password for solr users by running the following command as root
Collection is a logical index distributed on several servers.
Now we create our first collection with 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 is available on the instrument panel from the left panel Collections.
In this tutorial we will learn how to install and configure Apache Solr in centos 8, it supports many plugins and many more features. You can use this tool to exploit the full potential of a vertical search. For more information, visit the Apache Solr official website https://lucene.apache.org/solr/Advertisement