Apache Solr is a highly scalable, reliable, and fault tolerant open-source search tool written in Java. Solr aims at providing distributed indexing, replication, and load-balanced querying with automated failover and recovery.
Solr powers the search and navigation features of many of the world’s largest internet sites. In this guide, we will look at how to Install Latest Apache Solr on Ubuntu 22.04/20.04/18.04 & Debian 11/10/9.
For CentOS 7 / Fedora refer to:
Step 1: Install Java on Ubuntu / Debian
Apache Solr requires Java to be installed. Install OpenJDK on Ubuntu 22.04/20.04/18.04 & Debian 11/10/9:
sudo apt update
sudo apt install -y default-jdk
After the installation, confirm that you can run the java
command from your terminal.
$ java -version
openjdk version "11.0.16" 2022-07-19
OpenJDK Runtime Environment (build 11.0.16+8-post-Ubuntu-0ubuntu122.04)
OpenJDK 64-Bit Server VM (build 11.0.16+8-post-Ubuntu-0ubuntu122.04, mixed mode, sharing)
Step 2: Install Apache Solr on Ubuntu / Debian
Apache Solr is not available on Ubuntu & Debian upstream repositories, it needs to be downloaded and installed manually. The releases of Apache Solr are available on the official website, check the link before saving the version to the LATEST_VER
variable.
export LATEST_VER="9.0.0"
curl -O https://dlcdn.apache.org/solr/solr/$LATEST_VER/solr-$LATEST_VER.tgz
Extract the archive downloaded:
tar xvf solr-${LATEST_VER}.tgz
Now 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
Sample output:
...
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. You can check the status by running:
$ 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.
Step 3: Access Solr Dashboard
By default Solr runs on port 8983
. If you have a UFW firewall running, allow port 8983.
sudo ufw allow 8983
The dashboard should be accessible on the URL.
http://<IP|Hostname>:8983
You should get a dashboard similar to one below:
Step 4: Create Solr Collection
You can now create your first Solr collection:
sudo su - solr -c "/opt/solr/bin/solr create -c collection1 -n data_driven_schema_configs"
Sample output:
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'
Create collection should be visible from the web interface.
Beginning with Solr 4.4, a detailed reference guide is available online or as a PDF download.