How to Setup Apache Solr on ubuntu machine step by step

You might have heard solar energy that right very powerful source of energy. But here we will discuss about Solr the most widely and best search tool in industry. It’s very fast and popular open source tool based on Java. From this tool we can fetch any content or perform search activity in quick seconds.

In this tutorial you’ll install using Solr on Ubuntu 18.04 . You’ll then work with Solr to index a page and later retrive using search engine.

Table of Content

  1. What is Solr
  2. Prerequisites
  3. How to Install Solr 8.2.0 on Ubuntu 18.04 LTS
  4. Conclusion

What is Solr ?

Solr is very efficient tool when it comes to search and real time indexing. It is very optimized for high volume of internet traffic. It is very highly scalable and fault tolerant. It has internal monitoring of its own instances as it publishes its own data via JMX. It provides lots of Extensible Plugin which are used for search as well as for indexing.

Solr can be installed on both windows as well as Unix based distributions. You index your data in Solr i.e. upload or put using JSON, XML or CSV or using http & later you can retrieve it using get http.

Prerequisites

  • Ubuntu machine preferably 18.04 version + , if you don’t have any machine you can create a ec2 instance on AWS account
  • Recommended to have 4GB RAM
  • At least 5GB of drive space
  • Java version 8 or 8+ ( If Java is not installed please follow me to next step else skip it )

You may incur a small charge for creating an EC2 instance on Amazon Managed Web Service.

  • Install Java Version 11 on ubuntu 18.04 machine
sudo apt install default-jdk  # Here we are installing Java Version: Java SE 11 (LTS)
java -version               # To check the Installed Java Version
which java :         # It will locate executable file location which is /usr/bin/java 

whereis java         # It will give the location  of all the files related to Java 

The Installation directory of Java is /usr/lib/jvm/java-1.8.0-openjdk-amd64 and this confirms that Java is successfully installed on our ubuntu 18.04 machine. Now, let us install Solr Engine.

How to Install Solr 8.2.0 on Ubuntu 18.04 LTS

  • Update your system packages.
sudo apt update
  • Lets change the directory and Download the Solr package
cd /opt

sudo wget https://archive.apache.org/dist/lucene/solr/8.2.0/solr-8.2.0.tgz
  • Your downloaded package will be in tarball format , Lets extract the tarball into the folder.
sudo tar xzf solr-8.2.0.tgz solr-8.2.0/bin/install_solr_service.sh --strip-components=2
  • Execute the the installer
 sudo ./install_solr_service.sh solr-8.2.0.tgz
  • Now, Solr should be up and running, you may verify by checking the status of Solr service.
sudo service solr stop
sudo service solr start
sudo service solr status
  • Solr should be running now, lets verify by opening a browser and enter : <ip-address>:8983/solr

Conclusion

You should now have a Apache Solr 8.2.0 instance running . Your Solr should now be ready to begin helping you manage your organization’s search.

Hope this tutorial will help you in understanding and setting up Apache Solr on ubuntu machine. Please share with your friends.