How To Install Apache Solr on Debian 11

In this article, we want to teach you How To Install Apache Solr on Debian 11.

Apache Solr (stands for Searching On Lucene w/ Replication) is a free, open-source search engine based on the Apache Lucene library.

It’s also often used as a document-based NoSQL database with transactional support that can be used for storage purposes and even a key-value store.

How To Install Apache Solr on Debian 11

Before you start to set up Apache Solr on Debian11, you need to log in to your server as a non-root user with sudo privileges. To do this, you can follow our article the Initial Server Setup with Debian 11.

Now you can follow the steps below to set up Apache Solr on Debian 11.

Install Java on Debian 11

To set up Apache Solr, you need to have Java installed on your Debian 11. First, update your local package index with the following command:

sudo apt update

Then, install Java and the required packages on Debian 11 with the command below:

sudo apt install default-jdk gnupg2 apt-transport-https wget -y

When your installation is completed, you can verify your Java installation by checking its version:

java -version

In your output you will see:

Output
openjdk version "11.0.13" 2021-10-19
OpenJDK Runtime Environment (build 11.0.13+8-post-Debian-1deb11u1)
OpenJDK 64-Bit Server VM (build 11.0.13+8-post-Debian-1deb11u1, mixed mode, sharing)

Installing Apache Solr on Debian 11

First, you need to check the latest version of Apache Solr from the Solr Downloads Page.

Then, download Solr on Debian 11 with the following command, just remember to replace the version of Solr:

wget https://downloads.apache.org/lucene/solr/8.11.0/solr-8.11.0.tgz

Now you need to extract your downloaded file with the following command:

tar xzf solr-8.11.0.tgz

Here you can install Apache Solr with the command below:

bash solr-8.11.0/bin/install_solr_service.sh solr-8.11.0.tgz

When your installation is completed, you should see the following output:

Output
solr.service - LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/init.d/solr; generated)
Active: active (exited) since Thu 2021-12-09 07:23:55 EST; 5s ago
Docs: man:systemd-sysv-generator(8)
Process: 4288 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCE>
CPU: 14ms

You can use the following command to start your Solr service on Debian 11:

sudo systemctl start solr

To enable Solr to start at boot you can run the following command:

/lib/systemd/systemd-sysv-install enable solr

You can check your Apache Solr status with the command below:

sudo systemctl status solr

Also, you can create a new Solr collection to test the Apache Solr functionality with the following command:

su - solr -c "/opt/solr/bin/solr create -c newcollection -n data_driven_schema_configs"

In your output you will see:

Output
Created new core 'newcollection'

Access Apache Solr Web Interface

At this point, you can access to Solr web interface by typing your server’s IP address in your web browser followed by 8983:

http://your-server-ip:8983

You will see the Apache Solr dashboard screen:

Apache Solr dashboard

From the core selector on the left side, you can choose my collection to view statics of your collection created in the previous step:

Apache Solr statics

Conclusion

At this point, you learn to set up Apache Solr on your Debian 11.

Hope you enjoy it.

Newsletter Updates

Enter your email address below and subscribe to our newsletter

Leave a Reply

Stay informed and not overwhelmed, subscribe now!