How to Install Apache Solr on Debian 11
Apache Solr is an open-source enterprise-search platform from the Apache Lucene project. Its major features include powerful full-text search, scalable and fault-tolerant, distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration, and more. It is written in Java and uses the Lucene library for indexing.
In this post, we will show you how to install the Apache Solr search platform on Debian 11.
- A server running Debian 11.
- A root password is configured on the server.
Apache Solr is written in Java. So Java must be installed on your server. You can install it using the following command:
apt-get install default-jdk gnupg2 apt-transport-https wget -y
Once the installation has been completed, verify the Java installation using the following command:
You should get the following output:
openjdk version "11.0.12" 2021-07-20 OpenJDK Runtime Environment (build 11.0.12+7-post-Debian-2) OpenJDK 64-Bit Server VM (build 11.0.12+7-post-Debian-2, mixed mode, sharing)
Install Apache Solr on Debian 11
At the time of writing this tutorial, the latest version of Apache Solr is 8.9.0. You can download it using the following command:
Once the download is completed, extract the downloaded file with the following command:
tar xzf solr-8.9.0.tgz
Next, install the Apache Solr using the following command:
bash solr-8.9.0/bin/install_solr_service.sh solr-8.9.0.tgz
Once the Apache Solr is installed, you should get the following output:
Service solr installed. Customize Solr startup configuration in /etc/default/solr.in.sh ? solr.service - LSB: Controls Apache Solr as a Service Loaded: loaded (/etc/init.d/solr; generated) Active: active (exited) since Sat 2021-09-18 15:28:56 UTC; 5s ago Docs: man:systemd-sysv-generator(8) Process: 4661 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS) CPU: 7ms Sep 18 15:28:47 debian11 systemd: Starting LSB: Controls Apache Solr as a Service... Sep 18 15:28:47 debian11 su: (to solr) root on none Sep 18 15:28:47 debian11 su: pam_unix(su-l:session): session opened for user solr(uid=107) by (uid=0) Sep 18 15:28:55 debian11 solr: Started Solr server on port 8983 (pid=4727). Happy searching! Sep 18 15:28:56 debian11 systemd: Started LSB: Controls Apache Solr as a Service.
By default, Apache Solr listens on port 8983. You can check it using the following command:
ss -antpl | grep 8983
You should see the following output:
LISTEN 0 50 *:8983 *:* users:(("java",pid=4727,fd=154))
Manage Apache Solr Service
To start the Apache Solr, run the following command:
systemctl start solr
To stop the Apache Solr, run the following command:
systemctl stop solr
To check the status of the Apache Solr, run the following command:
systemctl status solr
Create Apache Solr Collection
To test the Apache Solr functionality, create a new Solr collection with the following command:
su - solr -c "/opt/solr/bin/solr create -c newcollection -n data_driven_schema_configs"
Created new core 'newcollection'
Access Apache Solr Web UI
You can now access the Apache Solr web interface using the URL http://your-server-ip:8983. You should see the Apache Solr dashboard on the following screen:
In the left pane, click on the mycollection inside Core Selector to view statics of your collection created in previous steps.
Congratulations! you have successfully installed Apache Solr on Debian 11. You can now create your own search application using Apache Solr. For more information, visit the Apache Solr documentation.