Today we're diving deep into the world of Apache Solr, a robust open-source search platform that’s perfect for high-powered search and indexing capabilities. From websites to e-commerce, Solr is a go-to solution for streamlined data retrieval. In this guide, we'll walk you through an engaging step-by-step process on installing Apache Solr on your Debian 12 server, complete with securing it and creating your first Solr index. Ready to get started? Let’s dive in!
Before we embark on this installation journey, make sure you've got the following squared away:
Solr runs on Java, so we'll start by setting up Java OpenJDK 17. Here's how:
sudo apt update sudo apt install default-jdk java --version Upon successful installation, you should see that Java OpenJDK 17 is ready to roll.
Now, the fun part! Let's download and install Apache Solr.
sudo apt install curl lsof bc curl. As of this writing, the latest version is 9.4.0: curl -qO https://downloads.apache.org/solr/solr/9.4.0/solr-9.4.0.tgz tar xzf solr-9.4.0.tgz solr-9.4.0/bin/install_solr_service.sh --strip-components=2
sudo bash ./install_solr_service.sh solr-9.4.0.tgz sudo service solr status Your Apache Solr should now be running like a charm!
Next, let's configure our Debian system and Solr to optimize performance.
Adjust kernel parameters and limits:
sudo echo 4294967295 > /proc/sys/kernel/shmmax
sudo echo 1536 > /proc/sys/vm/nr_hugepages /etc/security/limits.conf: solr soft nofile 65000
solr hard nofile 65000
solr soft nproc 65000
solr hard nproc 65000 sudo -H -u solr bash -c "ulimit -aH" Allocate heap memory and bind to a specific IP:
sudo nano /etc/default/solr.in.sh SOLR_HEAP="4g"
SOLR_HOST="192.168.10.15"
SOLR_JETTY_HOST="192.168.10.15" sudo service solr restart Visit your Solr web interface at http://192.168.10.15:8983/.
Protect your Solr instance with BasicAuth. Here's how:
security.json file: sudo nano /var/solr/data/security.json {
"authentication":{
"blockUnknown": true,
"class":"solr.BasicAuthPlugin",
"credentials":{"solr":"IV0EHq1OnNrj6gvRCwvFwTrZ1+z1oBbnQdiVC3otuq0= Ndd7LKvVBAaZIF0QAVi1ekCfAJXr1GGfLtRUXhgrF8c="},
"realm":"My Solr users",
"forwardCredentials": false
},
"authorization":{
"class":"solr.RuleBasedAuthorizationPlugin",
"permissions":[{"name":"all", "role":"admin"}],
"user-role":{"solr":"admin"}
}
} sudo service solr restart Log back into Solr with your user credentials.
Now that Solr is secure, let’s create an index:
sudo nano /etc/default/solr.in.sh SOLR_AUTH_TYPE="basic"
SOLR_AUTHENTICATION_OPTS="-Dbasicauth=solr:SolrRocks" sudo service solr restart su - solr -c "/opt/solr/bin/solr create -c test_core -n TestCore" Visit your Solr dashboard, and under the "Core Selector," choose your newly created test_core.
Congratulations! You've mastered the installation of Apache Solr on Debian 12. From securing your instance to creating an index, you now possess the know-how to leverage Solr's powerful capabilities. Dive deeper into Solr configurations and consider scaling with Solr clusters for even more exhilarating search power. Go build something amazing! Happy indexing!
Magento is a free and open-source e-commerce platform written in PHP. It is simple, easy…
ISPConfig is an open-source control panel that allows users to manage multiple servers from a…
As a Linux administrator, you may find it necessary to troubleshoot or test your Simple…
Ubuntu 24.04, like many modern Linux distributions, relies on the NetworkManager for managing network connections.…
Restic is a modern, open-source backup program designed for efficiency, security, and simplicity. It enables…
phpMyAdmin is a popular free tool written in PHP intended to administer MySQL and MariaDB…