Apache Solr is a powerful open-source search platform used for indexing and querying large datasets. Below is a step-by-step guide to installing Solr on Debian 12 or Ubuntu 24.04 LTS.
Step 1: Update the System
Begin by updating your package index and upgrading installed packages:
sudo apt update && sudo apt upgrade -y
Step 2: Install Java
Solr requires Java to run. Install the default Java Development Kit (JDK):
sudo apt install openjdk-17-jdk -y
Verify the Java installation:
java -version
Set up the environment variables for Java:
sudo vim /etc/environment
Add the following lines to the file:
JAVA_HOME="/usr/lib/jvm/java-17-openjdk-amd64"
JAVA_OPTS="-Xmx2048M -Xms1024M -Dfile.encoding=UTF-8"
Activate the changes:
source /etc/environment
Verify the variables:
echo $JAVA_HOME
echo $JAVA_OPTS
Step 3: Install Maven and Ant
Maven and Ant are optional but useful tools for building Java applications:
sudo apt install maven ant -y
Step 4: Download and Extract Solr
Download the latest Solr package (adjust the version as needed):
wget https://dlcdn.apache.org/solr/solr/9.7.0/solr-9.7.0.tgz
Extract the installation script:
tar xzf solr-9.7.0.tgz solr-9.7.0/bin/install_solr_service.sh --strip-components=2
Step 5: Install Solr as a Service
Run the installation script:
sudo bash ./install_solr_service.sh solr-9.7.0.tgz
Step 6: Start and Enable Solr
Start Solr and enable it to start on boot:
sudo systemctl start solr && sudo systemctl enable solr
Check Solr’s status:
sudo systemctl status solr
Step 7: Access the Solr Admin Interface
Solr’s web-based admin interface is accessible at:
http://your-server-ip:8983/solr
Replace your-server-ip with your server's IP address.
Conclusion
You have successfully installed Apache Solr on your Debian 12 or Ubuntu 24.04 LTS system. You can now begin indexing data and leveraging Solr’s powerful search capabilities.