Introduction
Apache Solr is an open-source search platform written on Java.Solr provides full-text search, spell suggestions, custom document ordering and ranking, Snippet generation, and highlighting. Solr handles a variety of data types out of the box, including JSON, XML, many Office documents, CSV, and more.
Solr is designed for scalability and fault tolerance. alsoused for enterprise search and analytics use cases and has an active development community and regular releases.
Also Solr is the popular, blazing-fast, open source enterprise search platform built on Apache Lucene™.
Update Linux Software Packages
Update software packages in your Linux operating system.
# dnf update -y
Install OpenJDK
Apache Solr is written in Java, it requires Java Development Kit (JDK)
OpenJDK is available in standard yum repository and can_be installed easily.
So we are installing OpenJDK 11 on Linux server with the following command:
# dnf install -y java-11-openjdk
So OpenJDK has been installed on your Linux server.
Install Apache Solr
You can download Apache Solr from Github or from official website to get the latest version.
Right now the latest version is solr-8.9.0
[root@unixcop ~]# wget https://downloads.apache.org/lucene/solr/8.9.0/solr-8.9.0.tgz
--2021-08-25 10:06:52-- https://downloads.apache.org/lucene/solr/8.9.0/solr-8.9.0.tgz
Resolving downloads.apache.org (downloads.apache.org)... 135.181.209.10, 135.181.214.104, 88.99.95.219, ...
Connecting to downloads.apache.org (downloads.apache.org)|135.181.209.10|:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 202942547 (194M) [application/x-gzip]
Saving to: 'solr-8.9.0.tgz'
solr-8.9.0.tgz 100%[=======================================================================>] 193.54M 401KB/s in 8m 41s
2021-08-25 10:15:34 (380 KB/s) - 'solr-8.9.0.tgz' saved [202942547/202942547]
Extract the installation script from downloaded tarball as shown below.
[root@unixcop ~]# tar xzf solr-8.9.0.tgz solr-8.9.0/bin/install_solr_service.sh --strip-components=2
[root@unixcop ~]# ls
anaconda-ks.cfg install_solr_service.sh solr-8.9.0.tgz
[root@unixcop ~]#
Execute the installation script to install Apache Solr Search Server.
[root@unixcop ~]# ./install_solr_service.sh solr-8.9.0.tgz
We recommend installing the 'lsof' command for more stable start/stop of Solr
id: 'solr': no such user
Creating new user: solr
Extracting solr-8.9.0.tgz to /opt
Installing symlink /opt/solr -> /opt/solr-8.9.0 ...
Installing /etc/init.d/solr script ...
Installing /etc/default/solr.in.sh ...
Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh
*** [WARN] *** Your open file limit is currently 1024.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
*** [WARN] *** Your Max Processes Limit is currently 3901.
It should be set to 65000 to avoid operational disruption.
If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
NOTE: Please install lsof as this script needs it to determine if Solr is listening on port 8983.
Started Solr server on port 8983 (pid=15862). Happy searching!
Found 1 Solr nodes:
Solr process 15862 running on port 8983
{
"solr_home":"/var/solr/data",
"version":"8.9.0 05c8a6f0163fe4c330e93775e8e91f3ab66a3f80 - mayyasharipova - 2021-06-10 17:54:40",
"startTime":"2021-08-25T14:20:43.324Z",
"uptime":"0 days, 0 hours, 0 minutes, 19 seconds",
"memory":"79.9 MB (%15.6) of 512 MB"}
[root@unixcop ~]#
This will create an account named solr on your system and finish the installation process.
Also don’t worry about the above warning, we will solve it.
Install lsof as required by the Apache Solr.
# dnf install -y lsof
Enable Solr service using command:
[root@unixcop ~]# systemctl enable solr
solr.service is not a native service, redirecting to systemd-sysv-install.
Executing: /usr/lib/systemd/systemd-sysv-install enable solr
[root@unixcop ~]#
Verify that the Solr search service is running on default port 8983.
[root@unixcop ~]# ss -tulpn | grep 8983
tcp LISTEN 0 50 *:8983 *:* users:(("java",pid=15862,fd=153))
[root@unixcop ~]#
You need to define the security limits as required by the Apache Solr Enterprise Search Server.
So edit the limits.conf file in vim editor.
# vi /etc/security/limits.conf
And add following in this file.
solr soft nofile 65536
solr hard nofile 65536
solr soft nproc 65536
solr hard nproc 65536
Then restart the Solr service
[root@unixcop ~]# service solr restart
Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 15862 to stop gracefully.
Waiting up to 180 seconds to see Solr running on port 8983 [\]
Started Solr server on port 8983 (pid=16988). Happy searching!
[root@unixcop ~]#
Also you need to allow 8983 port (which used by solr) in firewall.
[root@unixcop ~]# firewall-cmd --permanent --add-port=8983/tcp
success
[root@unixcop ~]# firewall-cmd --reload
success
[root@unixcop ~]#
Create New Solr Collection
A collection is the group of cores that together form a single logical index. A collection has a different set of configuration files and schema definitions than other collections. You can create a collection by running the following command:
[root@unixcop ~]# su - solr -c "/opt/solr/bin/solr create -c Unixcop_col1 -n data_driven_schema_configs"
Created new core 'Unixcop_col1'
[root@unixcop ~]#
Access Solr Admin Panel
By default, the Solr server runs on port 8983. Access Solr dashboard in your web browser using server ip address or hostname with 8983 port.
http://ip_address:8983/
You can view statics of created collection named “Unixcop_col1”. Click on “Core Selector” and select created collection.
Conclusion
In this installation guide, you have learned how to install Apache Solr Enterprise Server on CentOS / RHEL 8.