FreeBSD Apache Solr Installation Guide and How to Use

In today's modern applications, search capabilities are the main feature that must be present. Even though what we are looking for is in large amounts of data, this feature must be able to find what we are looking for quickly and without any delay. Typically used SQL query based scripts to implement search functionality.

This is where Apache Solr comes into play, to simplify and simplify the work process on the search feature. Apache Solr works automatically to search each category using facets, and there are many more advantages of Apache Solr.

Searching On Lucene Replication or what is known as Apache Solr is a free open source search engine. Apache Solr is based on the Apache Lucene library, a subproject of which has been available since 2004. Currently, Apache Solr is one of the most popular search engines in the world. However, Apache Solr is not only used as a search engine, Solr is also often used as a document-based NoSQL database with transactional support that can be used for storage purposes and even key value storage.

Apache Solr is written in Java, Solr has a REST ful XML/HTTP and JSON API as well as client libraries for many programming languages such as Ruby, C#, Java, PHP, Python and many more which are used to build search-based and big data analysis applications for websites. web, files, images, databases, and others.

In this article we will learn how to use Apache Solr, the installation and configuration process. The implementation of Apache Solr in this article uses the FreeBSD 13.2 server.

1. System Requirements

OS: FreeBSD 13.2
IP address:
Hostname: ns3
Java: openjdk17
Web server: apache24
PHP version: PHP82

2. Install Apache Solr

Before you start this guide, you must install java openjdk on your FreeBSD machine. Solr requires Java version 11 or higher. In the article we use OpenJDK17 as a free and lightweight alternative, but we will not explain the OpenJDK17 installation process here. You can read the previous article which reviews the opnejdk17 installation process. You can install apache Solr with the following command.

root@ns3:~ # cd /usr/ports/textproc/apache-solr
root@ns3:/usr/ports/textproc/apache-solr # make install clean
If you like the PKG package, run the following command to install Apache Solr.

root@ns3:~ # pkg install apache-solr-9.5.0,1
To complete the Apache Solr library, you can install several dependencies as below

p5-Apache-Solr php82-pecl-solr p5-Apache-Solr
root@ns3:~ # pkg install p5-Apache-Solr php82-pecl-solr p5-Apache-Solr lsof jetty

3. Configuration Startup Solr

After you complete the Solr installation process, activate Solr in the /etc/rc.conf file so that Solr can run automatically on FreeBSD. Type the script below in the /etc/rc.conf file.

root@ns3:~ # ee /etc/rc.conf
Solr has two configuration files, namely /usr/local/etc/ and /var/db/solr/solr.xml. Open the file and edit some scripts by following the guide below.

root@ns3:~ # cd /usr/local/etc
root@ns3:/usr/local/etc # ee
SOLR_OPTS="$SOLR_OPTS -Dlog4j2.formatMsgNoLookups=true"
To save all Solr log files, you must create a directory and log files.

/var/db/solr  /var/log/solr
root@ns3:~ # touch /var/db/solr/log4j2.xml
root@ns3:~ # mkdir -p /var/log/solr
To distinguish Solr files from other files, create a file ownership, namely "solr:solr".

root@ns3:~ # chown -R solr:solr /var/db/solr
root@ns3:~ # chown -R solr:solr /var/log/solr
Once you are sure there is nothing wrong with all the configurations above, you can run Solr. Before you run Solr, run the following command.

Restart Solr
root@ns3:~ # service solr restart
Check whether TCP port is open or not?

Check TCP Connection
root@ns3:~ # lsof -i :8983
lsof: WARNING: compiled for FreeBSD release 13.2-RELEASE-p10; this is 13.2-RELEASE.
java    16561 solr 45u  IPv4 0xfffffe0095b78518        0  TCP>*:* (LISTEN)
If the results are as above, it means that TCP Port is open on your FreeBSD server.

After that, you can immediately run Solar via the Google Chrome browser, Microfot Edge or any other web browser you like. In the address bar menu type "".

If you successfully configure Solr on FreeBSD, it will appear as shown in the image below.

Apache Solr is an advanced search platform that can run on the Apache web server. Using Solr in your website search menu really helps visitors find the data or files they need. Combining your website with Apache Solr will have the advantage of performing precise full-text searches for your domain. With complex variables and customizable filters, you can customize your vertical search engine to suit your needs.
Iwan Setiawan

I Like Adventure: Mahameru Mount, Rinjani Mount I Like Writer FreeBSD

Post a Comment

Previous Post Next Post