How to Install Apache Solr on Alpine Linux

Apache Solr is an open-source search engine platform that is used for indexing and searching data. In this tutorial, we will learn how to install Apache Solr on Alpine Linux.

Step 1: Update and Upgrade the System

Before installing Apache Solr, make sure that your system is up-to-date. You can update and upgrade your system by running the following commands:

$ sudo apk update
$ sudo apk upgrade

Step 2: Install Java

Apache Solr requires Java to be installed on your system. You can install OpenJDK 8 on Alpine Linux by running the following command:

$ sudo apk add openjdk8

Step 3: Download Apache Solr

Download the latest version of Apache Solr by visiting its official website (https://lucene.apache.org/solr/downloads.html). Alternatively, you can use the following command to download the latest version of Apache Solr:

$ wget https://archive.apache.org/dist/lucene/solr/8.10.0/solr-8.10.0.tgz

Extract the downloaded file:

$ tar xzf solr-8.10.0.tgz

Step 4: Create a Solr User

Create a solr user by running the following command:

$ sudo adduser -D -h /opt/solr -s /sbin/nologin solr

Step 5: Move Solr Files to the Solr User Directory

Move the extracted solr files to the solr user directory:

$ sudo mv solr-8.10.0 /opt/solr/

Step 6: Change Ownership of Solr Directory

Change ownership of the solr directory to the solr user:

$ sudo chown -R solr:solr /opt/solr/

Step 7: Configure Solr

Copy the default Solr configuration files to the Solr user directory:

$ sudo cp -p /opt/solr/server/solr/solr.xml /opt/solr/server/solr/solr.xml.orig 
$ sudo cp -r /opt/solr/server/solr/configsets/_default /opt/solr/server/solr/<collection-name>

Note: Replace <collection-name> with a name of your choice.

Step 8: Start Solr

Start Solr by running the following command:

$ sudo -u solr /opt/solr/bin/solr start -p 8983

Open your web browser and go to http://localhost:8983/solr. You should see the Solr administration panel.

Congratulations! You have successfully installed Apache Solr on Alpine Linux.

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!