What is Solr?
Apache Solr is a fast open-source java search server. It is based on the Apache Lucene search libraries. It enables you to easily create search engines which searches websites, databases and files. It provides full-text search, highlight the hits and near real time indexing.
As I said above Apache Solr search server is written in Java. So, It uses a servlet container in the backend to run. If you install Apache Solr by default it comes with Jetty as the servlet container that you can uses to run some examples.
In this tutorial I will show how you can install Apache Solr 7.1 on CentOS/RHEL and Fedora
Install Apache Solr 7.1
Follow the below steps to install Apache Solr 7.1 on CentOS/RHEL and fedora.
Step #1 : Install Java
First of all you have to install Java 8 or greater to run Apache Solr 7. Follow the below link to install Java 9 if you don’t have Java installed on your system.
After installing Java confirm using below command.
# java -version java version "9" Java(TM) SE Runtime Environment (build 9+181) Java HotSpot(TM) 64-Bit Server VM (build 9+181, mixed mode)
Step #2 : Download and Install Apache Solr 7.1
Next download the required Apache Solr version from its official website. In my case I am going to download Apache Solr 7.1 for its official website.
# cd /usr/local # wget http://www-eu.apache.org/dist/lucene/solr/7.1.0/solr-7.1.0.tgz
After downloading the Solr 7.1, now extract Apache Solr service installer shell script from the downloaded solr tar file and run the installer using below command.
# tar xzf solr-7.1.0.tgz solr-7.1.0/bin/install_solr_service.sh --strip-components=2 # sudo bash ./install_solr_service.sh solr-7.1.0.tgz
Step #3 : Start/Stop Solr Service
Follow the below command to start and stop the solr service.
For SysVinit Users
# service solr stop # service solr start # service solr restart # service solr status
For Systemd Users
# systemctl stop solr # systemctl start solr # systemctl restart solr # systemctl status solr
Step #4 : Create First Solr Collection
Now create your first Solr Collection using below command after installing Solr.
# su - solr -c "/usr/local/solr/bin/solr create -c mycoll -n data_driven_schema_configs" Created new core 'mycol1'
Step #5 : Access Solr Using Web Admin Panel
By default solr runs on port 8983, now open your web browser and type the below URl to access Solr dashboard.
Now click on “Core Selector” on the left side to access the created collections.