Apache Solr is an open-source, highly scalable search platform built on Apache Lucene. It is used for enterprise-level search functionality and can handle large volumes of data with speed and efficiency. This guide will show you how to install Apache Solr on Debian 12, whether you're running a local server or a VPS server environment.

Step 1: Update Your System

Before starting, make sure your Debian 12 server is up to date. Run the following commands to update your package list and install any available upgrades:

sudo apt update && sudo apt upgrade -y

Step 2: Install Java

Apache Solr requires Java to run. You can install OpenJDK, a free and open-source implementation of the Java Platform, using the following command:

sudo apt install default-jdk -y

Verify the Java installation by checking the version:

java -version

You should see output displaying the installed Java version.

Step 3: Download Apache Solr

Next, download the latest stable version of Apache Solr. Navigate to the official Apache Solr downloads page to get the latest version. You can use wget to download Solr directly. For example, to download Solr 9.0.0:

wget https://dlcdn.apache.org/lucene/solr/9.0.0/solr-9.0.0.tgz

Once the download is complete, extract the downloaded file:

sudo tar xzf solr-9.0.0.tgz

Step 4: Install Apache Solr

After extracting the Solr archive, navigate to the extracted directory and run the installation script:

sudo bash solr-9.0.0/bin/install_solr_service.sh solr-9.0.0.tgz

This will install Solr as a service on your system, configure it to run automatically at boot, and set the necessary permissions.

Step 5: Start and Enable Apache Solr

Once the installation is complete, start the Solr service and enable it to start automatically at boot:


sudo systemctl start solr
sudo systemctl enable solr
        

To verify that Solr is running, use the following command:

sudo systemctl status solr

Step 6: Access the Solr Admin Interface

By default, Apache Solr runs on port 8983. To access the Solr Admin interface, open a web browser and navigate to:

http://your_server_ip:8983/solr

You should see the Solr Admin Dashboard, where you can manage and monitor your Solr instances.

Step 7: Create a New Solr Core

In Solr, "cores" represent separate collections of indexed data. To create a new core, use the following command (replace my_core with your desired core name):

sudo su - solr -c "/opt/solr/bin/solr create -c my_core"

Once the core is created, you can manage it from the Solr Admin interface or via the command line.

Step 8: Secure Solr (Optional)

If you're running Solr on a public-facing VPS server, it's important to secure access to the Solr Admin interface. Consider setting up basic authentication or using a reverse proxy like Nginx with SSL encryption to protect access.

Set Up Basic Authentication

To enable basic authentication, you can install the solr-basic-authentication-plugin and configure authentication in the solr.in.sh file.

Configure Nginx as a Reverse Proxy with SSL

For an added layer of security, configure Nginx as a reverse proxy for Solr with Let's Encrypt SSL. First, install Nginx and Certbot:

sudo apt install nginx certbot python3-certbot-nginx -y

Set up a reverse proxy in the Nginx configuration file:


server {
    listen 80;
    server_name your_domain;

    location / {
        proxy_pass http://localhost:8983;
        proxy_set_header Host $host;
        proxy_set_header X-Real-IP $remote_addr;
        proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
        proxy_set_header X-Forwarded-Proto $scheme;
    }
}
        

Save the file and restart Nginx:

sudo systemctl restart nginx

Then, obtain a free SSL certificate from Let's Encrypt:

sudo certbot --nginx -d your_domain

Follow the prompts to complete the SSL configuration. Nginx will now proxy requests to Solr securely using HTTPS.

Running Apache Solr on a VPS Server

Apache Solr is ideal for search-heavy applications, and running it on a VPS server provides the scalability and performance needed for enterprise-level search functionality. Whether you're indexing large datasets or building search functionality into your application, a VPS offers the control and flexibility required for smooth operation.

Looking for a Reliable VPS Solution?

If you're looking for a powerful and scalable VPS server to run Apache Solr, consider using WindowsVPS. With WindowsVPS, you get high-performance VPS hosting with full control over your environment, perfect for running Solr and other demanding applications.

Was this answer helpful? 0 Users Found This Useful (0 Votes)