Bobcares

Apache Solr Installation on Ubuntu 20.04/18.04 and Debian 10/9

by | Sep 13, 2021

Apache Solr Installation on Ubuntu 20.04/18.04 and Debian 10/9 aims at providing distributed indexing, replication, and load-balanced querying with automated failover and recovery.

As part of our Server Management Services, we assist our customers with several installation queries.

Today, let us see how our support techs perform the same.

Apache Solr Installation on Ubuntu 20.04/18.04 and Debian 10/9

Solr powers the search and navigation features of many of the world’s largest internet sites.

Moving ahead, we will see how to Install Latest Apache Solr on Ubuntu 20.04/18.04 & Debian 10/9.

Step 1: Install Java on Ubuntu / Debian

Initially, Apache Solr requires us to install Java.

To do so, we install OpenJDK on Ubuntu 20.04/18.04 & Debian 10/9:

sudo apt update
sudo apt install -y default-jdk

After that, we confirm that we can run the java command from the terminal:

$ java -version
openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment (build 11.0.11+9-Ubuntu-0ubuntu2.20.04)
OpenJDK 64-Bit Server VM (build 11.0.11+9-Ubuntu-0ubuntu2.20.04, mixed mode, sharing)

Step 2: Install Apache Solr on Ubuntu 20.04/18.04 & Debian 10/9

Generally, Apache Solr is not available on Ubuntu & Debian upstream repositories. We need to download and install it manually.

We can find the releases of Apache Solr from the official website. However, we need to check the link before we save the version to the LATEST_VER variable.

export LATEST_VER="8.8.2"
curl -O https://downloads.apache.org/lucene/solr/${LATEST_VER}/solr-${LATEST_VER}.tgz

Eventually, we extract the archive:

tar xvf solr-${LATEST_VER}.tgz

Now we go ahead and run the Apache Solr service installer script to setup Solr environment.

cd solr-${LATEST_VER}/bin/
sudo ./install_solr_service.sh ~/solr-${LATEST_VER}.tgz

Our output may look like this:

...
id: 'solr': no such user
Creating new user: solr
Adding system user `solr' (UID 111) ...
Adding new group `solr' (GID 116) ...
Adding new user `solr' (UID 111) with group `solr' ...
Creating home directory `/var/solr' ...

Extracting /home/vagrant/solr-8.8.2.tgz to /opt

Installing symlink /opt/solr -> /opt/solr-8.8.2 ...

Installing /etc/init.d/solr script ...

Installing /etc/default/solr.in.sh ...

Service solr installed.
Customize Solr startup configuration in /etc/default/solr.in.sh

The script will install and start Solr service.

Then, to check the status, we run:

$ systemctl status solr.service
* solr.service - LSB: Controls Apache Solr as a Service
Loaded: loaded (/etc/init.d/solr; generated)
Active: active (exited) since Thu 2019-04-25 22:32:27 PDT; 2min 45s ago
Docs: man:systemd-sysv-generator(8)
Process: 19840 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS)

Apr 25 22:32:21 ubuntu-01 solr[19840]: *** [WARN] *** Your open file limit is currently 1024.
Apr 25 22:32:21 ubuntu-01 solr[19840]: It should be set to 65000 to avoid operational disruption.
Apr 25 22:32:21 ubuntu-01 solr[19840]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Apr 25 22:32:21 ubuntu-01 solr[19840]: *** [WARN] *** Your Max Processes Limit is currently 3700.
Apr 25 22:32:21 ubuntu-01 solr[19840]: It should be set to 65000 to avoid operational disruption.
Apr 25 22:32:21 ubuntu-01 solr[19840]: If you no longer wish to see this warning, set SOLR_ULIMIT_CHECKS to false in your profile or solr.in.sh
Apr 25 22:32:27 ubuntu-01 solr[19840]: [194B blob data]
Apr 25 22:32:27 ubuntu-01 solr[19840]: Started Solr server on port 8983 (pid=19912). Happy searching!
Apr 25 22:32:27 ubuntu-01 solr[19840]: [14B blob data]
Apr 25 22:32:27 ubuntu-01 systemd[1]: Started LSB: Controls Apache Solr as a Service.
Ensure the service is set to start on boot.

$ sudo systemctl enable solr solr.service
solr.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable solr
solr.service is not a native service, redirecting to systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install enable solr

Step 3: Create Solr Collection

We can now create the first Solr collection:

su - solr -c "/opt/solr/bin/solr create -c collection1 -n data_driven_schema_configs"

Our output will look similar to this:

INFO - 2019-04-25 22:37:32.110; org.apache.solr.util.configuration.SSLCredentialProviderFactory; Processing SSL Credential Provider chain: env;sysprop
Created new core 'collection1'

Finally, the collection will be visible from the web interface.

[Need help with the installation? We’d be happy to assist]

Conclusion

In short, we saw how our Support Techs perform the installation of Apache Solr.

PREVENT YOUR SERVER FROM CRASHING!

Never again lose customers to poor server speed! Let us help you.

Our server experts will monitor & maintain your server 24/7 so that it remains lightning fast and secure.

GET STARTED

0 Comments

Submit a Comment

Your email address will not be published. Required fields are marked *

Never again lose customers to poor
server speed! Let us help you.