How to Install Apache Solr on EndeavourOS

Apache Solr is an open-source search platform that provides fast and customizable search capabilities. In this tutorial, we will be guiding you through the process of installing Apache Solr on EndeavourOS.

Prerequisites

Before we begin, make sure you have the following requirements:

Step 1 - Install Java

Apache Solr requires Java Runtime Environment to run. If you don't have Java installed on your system, you can install it using the following command:

sudo pacman -S jre-openjdk

Once the installation is complete, verify the Java version using:

java -version

This should output something similar to:

openjdk version "13.0.2" 2020-01-14
OpenJDK Runtime Environment (build 13.0.2+8)
OpenJDK 64-Bit Server VM (build 13.0.2+8, mixed mode, sharing)

Step 2 - Download Apache Solr

The first step in installing Apache Solr is to download the latest version from their official website.

cd /tmp
curl -O https://downloads.apache.org/lucene/solr/8.8.0/solr-8.8.0.tgz

Once the download is complete, extract the archive:

tar -xf solr-8.8.0.tgz

After extraction, you can move the Solr directory to the /opt directory.

sudo mv solr-8.8.0 /opt/

Step 3 - Start Solr

To start Solr, navigate to the Solr directory and run the following command:

cd /opt/solr-8.8.0/bin
./solr start -c -p 8983

This will start Solr on port 8983 and create a new collection named techproducts. You can verify that Solr has started by visiting http://localhost:8983/solr in your web browser. This should open the Solr admin panel.

Step 4 - Stop Solr

To stop Solr, simply run the following command:

cd /opt/solr-8.8.0/bin
./solr stop -all

This will stop all running Solr instances.

Step 5 - Set up Solr as a System Service

Next, we will set up Solr as a Systemd service, so that it starts automatically when the system boots.

First, create a new file called solr.service in the /etc/systemd/system/ directory.

sudo nano /etc/systemd/system/solr.service

Paste the following content into the file:

[Unit]
Description=Apache Solr search platform
[Service]
WorkingDirectory=/opt/solr-8.8.0
ExecStart=/opt/solr-8.8.0/bin/solr start -cloud -p 8983
ExecStop=/opt/solr-8.8.0/bin/solr stop -all
Restart=always
User=solr
LimitNOFILE=1000000
[Install]
WantedBy=multi-user.target

Save and close the file.

Now reload the systemd daemon:

sudo systemctl daemon-reload

To start Solr as a system service, run:

sudo systemctl start solr

To enable Solr to start automatically at boot time, run:

sudo systemctl enable solr

That's it! You have successfully installed Apache Solr on EndeavourOS and set it up as a system service.

You can now visit http://localhost:8983/solr in your web browser to access Solr.

If you want to self-host in an easy, hands free way, need an external IP address, or simply want your data in your own hands, give IPv6.rs a try!

Alternatively, for the best virtual desktop, try Shells!