In this article, we will have explained the necessary steps to install and configure Apache Solr on Ubuntu 20.04. Before continuing with this tutorial, make sure you are logged in as a user with
sudo privileges. All the commands in this tutorial should be run as a non-root user.
Apache Solr is a professional search server created in Java and sponsored by the Apache Foundation. It is used to store data and query it in near real-time. It is most popular search engine that provides distributed indexing, replication, load balancing with automated failover and recovery. It supports database queries through REST APIs like Elasticsearch.
Install Apache Solr on Ubuntu 20.04
Step 1. The first command will update the package lists to ensure you get the latest version and dependencies.
sudo dnf install epel-release sudo dnf update
Step 2. Install Java.
Apache Solr 8 required Java 8 or greater to run. If not installed you can install it by running the following command:
sudo apt install openjdk-8-jdk
Verify Java version:
$ java -version openjdk version "1.8.0_252" OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09) OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)
Step 3. Download and Install Apache Solr on Ubuntu system.
First, you will need to download the latest version of Apache Solr from the Apache website:
wget https://archive.apache.org/dist/lucene/solr/8.6.0/solr-8.6.0.tgz tar xzf solr-8.6.0.tgz
Next, install the Apache Solr by executing the Solr installation script:
bash solr-8.6.0/bin/install_solr_service.sh solr-8.6.0.tgz
To start and stop the Apache Solr service, run the following command:
sudo systemctl stop solr sudo systemctl start solr
Step 4. Create Collection in Solr.
Create the first collection in Apache Solr using the following command:
sudo su - solr -c "/opt/solr/bin/solr create -c mycollection -n data_driven_schema_configs"
You should get the following output:
Created new core 'mycollection'
Step 5. Accessing Apache Solr Admin Panel.
You can access the Apache Solr web interface using the URL
http://your-server-ip-address:8983/solr. You should see the Apache Solr web interface in the following screen:
That’s all you need to do to install Apache Solr on Ubuntu 20.04 LTS Focal Fossa. I hope you find this quick tip helpful. For further reading on Apache Solr, please refer to their official knowledge base. If you have questions or suggestions, feel free to leave a comment below.