Install latest Apache Solr on Ubuntu 20.04

Last Updated:

In this tutorial, you will how to install latest Apache Solr on Ubuntu 20.04. Apache Solr is the popular, blazing-fast, open source enterprise search platform built on Apache Lucene. It is highly reliable, scalable and fault tolerant, providing distributed indexing, replication and load-balanced querying, automated failover and recovery, centralized configuration and more. Solr powers the search and navigation features of many of the world’s largest internet sites. With Solr, you put documents in it (called “indexing”) via JSON, XML, CSV or binary over HTTP. You query it via HTTP GET and receive JSON, XML, CSV or binary results.

Solr Features as outlined on Apache Solr Features page.

  • Advanced Full-Text Search Capabilities
  • Optimized for High Volume Traffic
  • Standards Based Open Interfaces – XML, JSON and HTTP
  • Comprehensive Administration Interfaces
  • Easy Monitoring
  • Highly Scalable and Fault Tolerant
  • Flexible and Adaptable with easy configuration
  • Near Real-Time Indexing
  • Extensible Plugin Architecture

Installing Apache Solr on Ubuntu 20.04

Run System Update

Update your system package cache;

apt update

Install Java Runtime Environment (JRE) on Ubuntu 20.04

JRE is one of the requirements for installing latest Apache Solr on Ubuntu 20.04. JRE version 1.8 or higher. Hence, run the command below to install the default JRE on Ubuntu 20.04;

apt install default-jre

You can verify the version of installed JRE by executing the command below;

java --version
openjdk 2020-11-04
OpenJDK Runtime Environment (build
OpenJDK 64-Bit Server VM (build, mixed mode, sharing)

Install Apache Solr on Ubuntu

Download latest Apache Solr release version

Solr 8.7.0 is the most recent Apache Solr release. Hence, navigate their downloads page and grab the latest release archive. You can simply obtain the download url and use wget to pull it down.


Verify Integrity of Apache Solr Archive

Before you can proceed, you need to verify the integrity of the downloaded Apache Solr archive. The downloaded archive can be verified using the PGP or SHA checksum. We use the later in this guide. Therefore, download the SHA512 checksum of the same version of the Apache Solr release you downloaded from the download page.


Once the download is done, calculate the SHA512 checksum of the Apache Solr archive downloaded;

gpg --print-md SHA512 solr-8.7.0.tgz
gpg: directory '/root/.gnupg' created
gpg: keybox '/root/.gnupg/pubring.kbx' created
solr-8.7.0.tgz: 15A3AF83 997E2CBC 4BFED304 F7D43EFD 260674D9 80592416 05FF3CDE
                0AE02D8B D1CCD569 73C6CBA1 CC118956 55BB76FC F1991BBB 94B004E5
                17CE15F7 28FA163F

Compare the hash value with the contents of the SHA512 file downloaded.

cat solr-8.7.0.tgz.sha512
15a3af83997e2cbc4bfed304f7d43efd260674d98059241605ff3cde0ae02d8bd1ccd56973c6cba1cc11895655bb76fcf1991bbb94b004e517ce15f728fa163f *solr-8.7.0.tgz

Ensure that the hashes match.

Extract Apache Solr Archive

Once you verify the integrity of the downloaded archive, extract it as follows;

tar xzf solr-8.7.0.tgz

Install Apache Solr on Ubuntu 20.04

Run the command below to install Apache Solr on Ubuntu 20.04;

solr-8.7.0/bin/ solr-8.7.0.tgz
id: ‘solr’: no such user
Creating new user: solr
Adding system user `solr' (UID 114) ...
Adding new group `solr' (GID 120) ...
Adding new user `solr' (UID 114) with group `solr' ...
Creating home directory `/var/solr' ...

Extracting solr-8.7.0.tgz to /opt

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

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

Installing /etc/default/ ...

Service solr installed.
Customize Solr startup configuration in /etc/default/
● solr.service - LSB: Controls Apache Solr as a Service
     Loaded: loaded (/etc/init.d/solr; generated)
     Active: active (exited) since Mon 2020-11-16 14:26:20 UTC; 5s ago
       Docs: man:systemd-sysv-generator(8)
    Process: 30824 ExecStart=/etc/init.d/solr start (code=exited, status=0/SUCCESS)

Nov 16 14:26:07 systemd[1]: Starting LSB: Controls Apache Solr as a Service...
Nov 16 14:26:07 su[30828]: (to solr) root on none
Nov 16 14:26:07 su[30828]: pam_unix(su-l:session): session opened for user solr by (uid=0)
Nov 16 14:26:20 systemd[1]: Started LSB: Controls Apache Solr as a Service.

The command extracts and installs and create Apache Solr systemd service unit, solr.service.

As you can also see from the installation output, Apache Solr is started and hence running.

Note that it is also installed under /opt/solr (symlinked to /opt/solr-$VER, where $VER is the version release number)

ls /opt/solr/
bin/                contrib/            docs/               licenses/           LUCENE_CHANGES.txt  README.txt          
CHANGES.txt         dist/               example/            LICENSE.txt         NOTICE.txt          server/

You can find the various control scripts under the /opt/solr/bin/ directory. For example, you can as well check the status by running the command below;

/opt/solr/bin/solr status
Found 1 Solr nodes: 

Solr process 30901 running on port 8983
  "version":"8.7.0 2dc63e901c60cda27ef3b744bc554f1481b3b067 - atrisharma - 2020-10-29 19:39:16",
  "uptime":"0 days, 0 hours, 5 minutes, 31 seconds",
  "memory":"36.9 MB (%7.2) of 512 MB"}

As you can see, Solr is now listening on port 8983;

ss -altnp | grep 8983
LISTEN   0        50                           *:8983                  *:*       users:(("java",pid=30901,fd=154))

Accessing Apache Solr Admin Interface

To access Apache Solr web admin interface, you can access it via the http://server-ip-or-resolvable-hostname:8983/solr

If you are not accessing Apache Solr on localhost, you need to allow external access to port 8983/tcp, if UFW is running.

ufw allow 8983/tcp
Install latest Apache Solr on Ubuntu 20.04

You can now create Solr Core to start indexing and analyzing your data.

You can create Solr core from the Core Admin interface or from command line using the /opt/solr/bin/solr command whose syntax is;

/opt/solr/bin/solr create [-c name] [-d confdir] [-n configName] [-shards #] [-replicationFactor #] [-p port] [-V]

The command in short Create a core or collection depending on whether Solr is running in standalone (core) or SolrCloud mode (collection). In other words, this action detects which mode Solr is running in, and then takes the appropriate action (either create_core or create_collection).

You can obtain help by executing the commands;

/opt/solr/bin/solr create_core -help


/opt/solr/bin/solr create_collection -help

For example, to create a sample Solr Core using /tmp/mytestcore as the configuration directory;

mkdir /tmp/mytestcore

You need to create a core as Solr user;

su - solr -c "/opt/solr/bin/solr create_core -c mytestcore -d /tmp/mytestcore/"

You core should now be available on the Core Admin panel on Solr web interface.

Further Reading

Apache Solr Documentation

Apache Solr Reference Guide 8.7


We're passionate about sharing our knowledge and experiences with you through our blog. If you appreciate our efforts, consider buying us a virtual coffee. Your support keeps us motivated and enables us to continually improve, ensuring that we can provide you with the best content possible. Thank you for being a coffee-fueled champion of our work!

Photo of author
Co-founder of, Linux Tips and Tutorials. Linux/Unix admin and author at

Leave a Comment