Install Apache Solr Server on CentOS 8 - CentLinux


Monday, 16 November 2020

Install Apache Solr Server on CentOS 8

Install Apache Solr Server on CentOS 8

Apache Solr is an open search enterprise search software. Here, you will learn how to install Apache Solr Server on CentOS 8.


Table of Contents:


What is Solr? :

Solr (pronounced "solar") is an open-source enterprise-search platform, written in Java, from the Apache Lucene project. Solr is available to use under Apache License 2.0.

Solr major features include full-text search, hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration, NoSQL features and rich document (e.g., Word, PDF) handling. Providing distributed search and index replication.

Solr is designed for scalability and fault tolerance. Solr is widely used for enterprise search and analytics use cases and has an active development community and regular releases.

Solr runs as a standalone full-text search server. It uses the Lucene Java search library at its core for full-text indexing and search, and has REST-like HTTP/XML and JSON APIs that make it usable from most popular programming languages. Solr's external configuration allows it to be tailored to many types of applications without Java coding, and it has a plugin architecture to support more advanced customization.

Solr powers the search and navigation features of many of the world's largest internet sites.


Environment Specification:

We are using a minimal CentOS 8 KVM machine with following specifications.

  • CPU - 3.4 Ghz (2 cores)
  • Memory - 2 GB
  • Storage - 20 GB
  • Operating System - CentOS 8.2
  • Hostname -
  • IP Address - /24


Update CentOS 8 Software Packages:

Connect with as root user by using a ssh client.

By using dnf command, update software packages in your Linux server.

[root@solr-01 ~]# dnf update -y Last metadata expiration check: 0:00:24 ago on Sun 15 Nov 2020 08:12:06 PM PKT. Dependencies resolved. Nothing to do. Complete!

Our Linux operating system is already up-to-date. The output may vary on your Linux server.

Verify the Linux operating system and Kernel version.

[root@solr-01 ~]# uname -r 4.18.0-193.28.1.el8_2.x86_64 [root@solr-01 ~]# cat /etc/redhat-release CentOS Linux release 8.2.2004 (Core)


Install OpenJDK on Linux Server:

Apache Solr is written in Java programming language, therefore it requires Java Development Kit (JDK) 8 or later.

OpenJDK is available in standard yum repository and can be installed easily. Alternatively, you can also install Oracle Java SE on your Linux server.

For the sake of simplicity, we are installing OpenJDK 11 on the Linux server.

[root@solr-01 ~]# dnf install -y java-11-openjdk ... Installed: abattis-cantarell-fonts-0.0.25-4.el8.noarch adwaita-cursor-theme-3.28.0-2.el8.noarch adwaita-icon-theme-3.28.0-2.el8.noarch alsa-lib- at-spi2-atk-2.26.2-1.el8.x86_64 at-spi2-core-2.28.0-1.el8.x86_64 atk-2.28.1-1.el8.x86_64 avahi-libs-0.7-19.el8.x86_64 cairo-1.15.12-3.el8.x86_64 cairo-gobject-1.15.12-3.el8.x86_64 colord-libs-1.4.2-1.el8.x86_64 copy-jdk-configs-3.7-1.el8.noarch cups-libs-1:2.2.6-33.el8.x86_64 dconf-0.28.0-3.el8.x86_64 fontconfig-2.13.1-3.el8.x86_64 fontpackages-filesystem-1.44-22.el8.noarch fribidi-1.0.4-8.el8.x86_64 gdk-pixbuf2-2.36.12-5.el8.x86_64 gdk-pixbuf2-modules-2.36.12-5.el8.x86_64 giflib-5.1.4-3.el8.x86_64 glib-networking-2.56.1-1.1.el8.x86_64 graphite2-1.3.10-10.el8.x86_64 gsettings-desktop-schemas-3.32.0-4.el8.x86_64 gtk-update-icon-cache-3.22.30-5.el8.x86_64 gtk3-3.22.30-5.el8.x86_64 harfbuzz-1.7.5-3.el8.x86_64 hicolor-icon-theme-0.17-2.el8.noarch jasper-libs-2.0.14-4.el8.x86_64 java-11-openjdk-1: java-11-openjdk-headless-1: javapackages-filesystem-5.3.0-1.module_el8.0.0+11+5b8c10bd.noarch jbigkit-libs-2.1-14.el8.x86_64 json-glib-1.4.4-1.el8.x86_64 lcms2-2.9-2.el8.x86_64 libX11-1.6.8-3.el8.x86_64 libX11-common-1.6.8-3.el8.noarch libXau-1.0.8-13.el8.x86_64 libXcomposite-0.4.4-14.el8.x86_64 libXcursor-1.1.15-3.el8.x86_64 libXdamage-1.1.4-14.el8.x86_64 libXext-1.3.3-9.el8.x86_64 libXfixes-5.0.3-7.el8.x86_64 libXft-2.3.2-10.el8.x86_64 libXi-1.7.9-7.el8.x86_64 libXinerama-1.1.4-1.el8.x86_64 libXrandr-1.5.1-7.el8.x86_64 libXrender-0.9.10-7.el8.x86_64 libXtst-1.2.3-7.el8.x86_64 libdatrie-0.2.9-7.el8.x86_64 libepoxy-1.5.3-1.el8.x86_64 libfontenc-1.1.3-8.el8.x86_64 libgusb-0.3.0-1.el8.x86_64 libjpeg-turbo-1.5.3-10.el8.x86_64 libmodman-2.0.1-17.el8.x86_64 libproxy-0.4.15-5.2.el8.x86_64 libsoup-2.62.3-1.el8.x86_64 libthai-0.1.27-2.el8.x86_64 libtiff-4.0.9-17.el8.x86_64 libwayland-client-1.17.0-1.el8.x86_64 libwayland-cursor-1.17.0-1.el8.x86_64 libwayland-egl-1.17.0-1.el8.x86_64 libxcb-1.13.1-1.el8.x86_64 lksctp-tools-1.0.18-3.el8.x86_64 lua-5.3.4-11.el8.x86_64 pango-1.42.4-6.el8.x86_64 pixman-0.38.4-1.el8.x86_64 rest-0.8.1-2.el8.x86_64 ttmkfdir-3.0.9-54.el8.x86_64 tzdata-java-2020d-1.el8.noarch xorg-x11-font-utils-1:7.5-40.el8.x86_64 xorg-x11-fonts-Type1-7.5-19.el8.noarch Complete!

After successful installation, verify the Java version.

[root@solr-01 ~]# java -version openjdk version "11.0.9" 2020-10-20 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)

OpenJDK has been installed on Linux server.


Install Apache Solr on Linux Server:

You can download Apache Solr from Github or their official website.


From Solr Download Page, copy the URL of your required version of Apache Solr and then use wget command to download Solr from the copied URL.

[root@solr-01 ~]# cd /tmp [root@solr-01 tmp]# wget --2020-11-15 20:28:48-- Resolving (, 2a01:4f8:10a:201a::2 Connecting to (||:443... connected. HTTP request sent, awaiting response... 200 OK Length: 200805960 (192M) [application/x-gzip] Saving to: âsolr-8.7.0.tgzâ solr-8.7.0.tgz 100%[===================>] 191.50M 125KB/s in 28m 24s 2020-11-15 20:57:13 (115 KB/s) - âsolr-8.7.0.tgzâ saved [200805960/200805960]

Extract the Solr installation script from downloaded tarball as follows.

[root@solr-01 tmp]# tar xf solr-8.7.0.tgz solr-8.7.0/bin/ --strip-components=2

Now, use the extracted installation script to install Apache Solr on your Linux server.

[root@solr-01 tmp]# ./ solr-8.7.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.7.0.tgz to /opt Installing symlink /opt/solr -> /opt/solr-8.7.0 ... Installing /etc/init.d/solr script ... Installing /etc/default/ ... Service solr installed. Customize Solr startup configuration in /etc/default/ *** [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 *** [WARN] *** Your Max Processes Limit is currently 3674. 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 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=2241). Happy searching! Found 1 Solr nodes: Solr process 2241 running on port 8983 Solr at http://localhost:8983/solr not online.

Don't worry about the above warnings, we will rectify them one by one.

Install lsof software package as required by the Apache Solr.

[root@solr-01 tmp]# dnf install -y lsof Last metadata expiration check: 1:07:30 ago on Sun 15 Nov 2020 08:12:06 PM PKT. Dependencies resolved. ================================================================================ Package Architecture Version Repository Size ================================================================================ Installing: lsof x86_64 4.91-2.el8 BaseOS 253 k Transaction Summary ================================================================================ Install 1 Package Total download size: 253 k Installed size: 630 k Downloading Packages: lsof-4.91-2.el8.x86_64.rpm 114 kB/s | 253 kB 00:02 -------------------------------------------------------------------------------- Total 76 kB/s | 253 kB 00:03 Running transaction check Transaction check succeeded. Running transaction test Transaction test succeeded. Running transaction Preparing : 1/1 Installing : lsof-4.91-2.el8.x86_64 1/1 Running scriptlet: lsof-4.91-2.el8.x86_64 1/1 Verifying : lsof-4.91-2.el8.x86_64 1/1 Installed: lsof-4.91-2.el8.x86_64 Complete!

Enable Apache Solr service using following Linux command.

[root@solr-01 tmp]# systemctl enable solr solr.service is not a native service, redirecting to systemd-sysv-install. Executing: /usr/lib/systemd/systemd-sysv-install enable solr

Verify that the Solr service is running on default port 8983.

[root@solr-01 tmp]# ss -tulpn | grep 8983 tcp LISTEN 0 50 *:8983 *:* users:(("java",pid=2241,fd=153))

To rectify the warnings during startup of Apache Solr about File and Process limits. You need to define the security limits as required by the Apache Solr.

Open limits.conf file in vim editor.

solr-01 tmp]# vi /etc/security/limits.conf

And add following directives in this file.

solr soft nofile 65536 solr hard nofile 65536 solr soft nproc 65536 solr hard nproc 65536

Restart the Solr service using legacy service command. There will be no warnings this time.

[root@solr-01 tmp]# service solr restart Sending stop command to Solr running on port 8983 ... waiting up to 180 seconds to allow Jetty process 4524 to stop gracefully. Waiting up to 180 seconds to see Solr running on port 8983 [/] Started Solr server on port 8983 (pid=4865). Happy searching!

Apache Solr uses default network port 8983/tcp. Therefore, you need to allow this port in Linux firewall.

[root@solr-01 tmp]# firewall-cmd --permanent --add-port=8983/tcp success [root@solr-01 tmp]# firewall-cmd --reload success

Create a test collection in Apache Solr server.

[root@solr-01 tmp]# su - solr -c "/opt/solr/bin/solr create -c testcol1 -n data_driven_schema_configs" Created new core 'testcol1'

Open URL in a client browser.


You are now at the dashboard of the Apache Solr web UI. You can check the recently created collection by selecting it from the drop-down box in left-side pane.




In this installation guide, you have learned how to install Apache Solr Server on CentOS 8. Have a look at Mastering Apache Solr 7.x: An expert guide to advancing, optimizing, and scaling your enterprise search by Packt Publishing.

No comments:

Post a Comment