Solr 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. Solr powers some of the most heavily trafficked websites and applications in the world.
Here we will show you how to install Apache Solr 8.9.0 on Ubuntu 20.04 LTS systems.
First off, you must be able to log in to your ubuntu system and have sudo access. If you have that, let’s get started by upgrading the current packages on your system with the following command.
sudo apt update && sudo apt upgrade
Solr 8 requires Java 8 or greater to run. If you don’t have java installed on your system, use the following command to install it.
sudo apt install openjdk-11-jdk
Now we should verify the active Java version.
$ 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)
First, download Solr from its official site or mirrors. Or use the command below to download Apache Solr 8.9.0 on your system.
sudo wget https://downloads.apache.org/lucene/solr/8.9.0/solr-8.9.0.tgz
Now we want to extract the Apache Solr service installer script from the downloaded Solr archive file. Run the installer followed by the archive file as below:
tar xzf solr-8.9.0.tgz solr-8.9.0/bin/install_solr_service.sh --strip-components=2
sudo bash ./install_solr_service.sh solr-8.9.0.tgz
Solr is now configured as a service on your ubuntu server. You can use the following commands to Start, Stop and check the status of the Solr service.
To get the status of the Solr service, type
sudo systemctl status solr
Stop and Start the service with these commands:
sudo systemctl stop solr
sudo systemctl start solr
Create a Collection in Solr
To create the first collection in Apache Solr using the following command.
sudo su - solr -c "/opt/solr/bin/solr create -c myfirstcollection -n data_driven_schema_configs"
You then should see:
Created new core 'mycollection'
Solr Admin Panel
The default is for Solr to run on port 8983. You can access your Solr service on this port in a browser using your server IP or FQDN.