Apache Solr is an Open Source project by Apache Lucene  and a popular enterprise search engine which made in java , It has lots of features like full text searching , hit highlighting, faceted search, real-time indexing, dynamic clustering, database integration etc.

This  Tutorial Document Included three parts as


  1. Install Solr
  2. Set Admin Password
  3. Create cores
  1. Install Solr
  1. For Solr install we should have java compatibility for that install java
[root@server ~]# yum install java-1.8.0-openjdk.x86_64

2. Download apache solr 5.2.1

[root@server ~]# cd /opt
[root@server opt]# wget http://apache.go-parts.com/lucene/solr/5.2.1/solr-5.2.1.tgz &&  tar xvf solr-5.2.1.tgz

Follow the steps to start and stop script for apache solr

#cp /opt/solr-5.2.1/bin/init.d/solr  /etc/init.d/solr

Edit /etc/init.d/solr

#vi /etc/init.d/solr

Change the lines ,Line Number 36



SOLR_INSTALL_DIR=/ opt/solr-5.2.1

search and replace



SOLR_ENV= /opt/solr-5.2.1/bin/ solr.in.sh

search and replace




Save and exit

#   chmod 755 /etc/init.d/solr

#   chown root:root /etc/init.d/solr

Add solr for start at boot time

#cd /etc/init.d
#chkconfig --add solr

Allow Solr port in firewall

#iptables -A INPUT -p tcp -m tcp --dport 8983 -j ACCEPT
#service iptables save
  1. Set Admin Password 

1. Go to the apache solr configure directory

#cd /opt/solr-5.2.1/server/etc

Create a file “realm.properties” and add

admin: password, admin-role

  1. Open jetty.xml and add
<Call name="addBean">
<New class="org.eclipse.jetty.security.HashLoginService">
<Set name="name">Solr Realm</Set>
<Set name="config"><SystemProperty name="jetty.home" default="."/>/etc/realm.properties</Set>
<Set name="refreshInterval">0</Set>

Save and exit

  1. Open webdefault.xml and add
<web-resource-name>Disable TRACE</web-resource-name>
<web-resource-name>Solr authenticated application</web-resource-name>
<realm-name>Solr Realm</realm-name>

Save and exit

Now Star Solr Service

#/etc/init.d/solr start

Open the browser and access solr with http://your_ip:8983

Now login with your user name and password which you have added in realm.properties , in my case the the user name is “admin” and password is “password”

  1. Create Multiple Cores

You can add multiple cores by the following commands

# cd /opt/solr-5.2.1/
# bin/solr create -c core1
# bin/solr create -c core2

Thanks for reading this tutorial, if you have any query you can ask in comments

Reference Links:


By Sachin G

I am a professional freelance contributor and founder of tech transit. Love to write and lover of education, culture, and community. I have been using it, setting, supporting, and maintaining it since 2009.Linux rocks! Sachin G Follow me on LinkedIn and x formerly twitter